diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/InlineHistory/Extension.pm | 13 | ||||
-rw-r--r-- | extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/extensions/InlineHistory/Extension.pm b/extensions/InlineHistory/Extension.pm index f761a9fbd..df7ae9f62 100644 --- a/extensions/InlineHistory/Extension.pm +++ b/extensions/InlineHistory/Extension.pm @@ -18,6 +18,19 @@ our $VERSION = '1.5'; # don't show inline history for bugs with lots of changes use constant MAXIMUM_ACTIVITY_COUNT => 500; +# don't show really long values +use constant MAXIMUM_VALUE_LENGTH => 256; + +sub template_before_create { + my ($self, $args) = @_; + $args->{config}->{FILTERS}->{ih_short_value} = sub { + my ($str) = @_; + return length($str) <= MAXIMUM_VALUE_LENGTH + ? $str + : substr($str, 0, MAXIMUM_VALUE_LENGTH - 3) . '...'; + }; +} + sub template_before_process { my ($self, $args) = @_; my $file = $args->{'file'}; diff --git a/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl b/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl index 6debea594..079af95f0 100644 --- a/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl +++ b/extensions/InlineHistory/template/en/default/hook/bug/comments-aftercomments.html.tmpl @@ -137,7 +137,7 @@ [%~%]<a href="[% value FILTER html FILTER js %]" target="_blank" [%~ ' onclick="return inline_history.confirmUnsafeUrl(this.href)"' UNLESS is_safe_url(value) %]> - [%~%][% value FILTER html FILTER js %]</a> + [%~%][% value FILTER ih_short_value FILTER html FILTER js %]</a> [% ELSIF change.fieldname == 'see_also' %] [% FOREACH see_also = value.split(', ') %] [%~%]<a href="[% see_also FILTER html FILTER js %]" target="_blank"> @@ -151,7 +151,7 @@ change.fieldname == 'flagtypes.name' %] [% value FILTER email FILTER js %] [% ELSE %] - [% value FILTER html FILTER js %] + [% value FILTER ih_short_value FILTER html FILTER js %] [% END %] [%~ %]'; [% END %] |