Bug 138596 - preview quotations previously than comment; add user setting for managing comment previews
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1895 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
ae33c2cc1c
commit
731eef21f0
|
@ -109,7 +109,8 @@ sub body
|
|||
my $max_lines = Bugzilla->params->{preview_comment_lines} - 1;
|
||||
my $line_length = Bugzilla->params->{comment_line_length} - 1;
|
||||
my $result = $self->{'thetext'};
|
||||
$result =~ s/^((?>[^\n]{0,$line_length}.){0,$max_lines}(?>[^\n]{0,$line_length}\s)).*$/\1.../s;
|
||||
$result =~ s/(>[^\n]*?\n)+/>...\n/g;
|
||||
$result =~ s/^((?>[^\n]{0,$line_length}.){0,$max_lines}(?>[^\n]{0,$line_length}\s)).*$/\1.../s if !$self->check_length($result);
|
||||
return $result;
|
||||
}
|
||||
return $_[0]->{'thetext'};
|
||||
|
@ -185,8 +186,8 @@ sub body_full {
|
|||
|
||||
sub check_length
|
||||
{
|
||||
my $self = shift;
|
||||
my $test = $self->{'thetext'};
|
||||
my ($self, $test) = @_;
|
||||
$test ||= $self->{'thetext'};
|
||||
my $line_length = Bugzilla->params->{comment_line_length};
|
||||
my $length = $test =~ s/([^\n]{$line_length}|\n)/$1/g;
|
||||
$length = 0 if !$length;
|
||||
|
|
|
@ -212,6 +212,7 @@ $Bugzilla::messages->{en} = {
|
|||
'worktime' => 'With worktime only',
|
||||
'all' => 'All',
|
||||
'comment_width' => 'Show comments in the full screen width',
|
||||
'preview_long_comments' => 'Preview long comment'
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -446,6 +446,14 @@ SET
|
|||
WHERE description LIKE\'%[CC:%\'');
|
||||
}
|
||||
|
||||
# Bug 138596 - Настройки пользователя для управления длинными комментариями
|
||||
if (!$dbh->selectrow_array('SELECT * FROM setting WHERE name=\'preview_long_comments\' LIMIT 1'))
|
||||
{
|
||||
print "Adding 'Preview long comment' user general setting, Off by default for all users\n";
|
||||
$dbh->do('INSERT INTO setting (name, default_value, is_enabled) VALUES (\'preview_long_comments\', \'off\', 1)');
|
||||
$dbh->do('INSERT INTO setting_value (name, value, sortindex) VALUES (\'preview_long_comments\', \'off\', \'10\'), (\'preview_long_comments\', \'on\', \'20\')');
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
# generated HTML
|
||||
#%]
|
||||
<div class="bz_comment_text[% " collapsed" IF wt_only %][% " bz_fullscreen_comment" IF user.settings.comment_width.value == 'on' %]" id="comment_text_[% comment.id %]">
|
||||
[%- comment.body_full({ wrap => 1 }) -%]
|
||||
[%- comment.body_full({ wrap => 1, wo_preview => (user.settings.preview_long_comments.value == 'off') }) -%]
|
||||
</div>
|
||||
</div>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in New Issue