From b6b00b8804b1e0a0defb5b687013190dfda42b57 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 13 Oct 2011 15:53:31 +0800 Subject: bug 693913: set up upper limit on the number of changes to show inline --- extensions/InlineHistory/Extension.pm | 10 +++++++ .../hook/bug/comments-comment_banner.html.tmpl | 31 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 extensions/InlineHistory/template/en/default/hook/bug/comments-comment_banner.html.tmpl (limited to 'extensions/InlineHistory') diff --git a/extensions/InlineHistory/Extension.pm b/extensions/InlineHistory/Extension.pm index d8d5161cc..61bc232da 100644 --- a/extensions/InlineHistory/Extension.pm +++ b/extensions/InlineHistory/Extension.pm @@ -33,6 +33,9 @@ use Bugzilla::Attachment; our $VERSION = '1.4'; +# don't show inline history for bugs with lots of changes +use constant MAXIMUM_ACTIVITY_COUNT => 500; + sub template_before_process { my ($self, $args) = @_; my $file = $args->{'file'}; @@ -61,6 +64,13 @@ sub template_before_process { my ($activity) = Bugzilla::Bug::GetBugActivity($bug_id); $activity = _add_duplicates($bug_id, $activity); + if (scalar @$activity > MAXIMUM_ACTIVITY_COUNT) { + $activity = []; + $vars->{'ih_activity'} = 0; + $vars->{'ih_activity_max'} = 1; + return; + } + # augment and tweak foreach my $operation (@$activity) { # make operation.who an object diff --git a/extensions/InlineHistory/template/en/default/hook/bug/comments-comment_banner.html.tmpl b/extensions/InlineHistory/template/en/default/hook/bug/comments-comment_banner.html.tmpl new file mode 100644 index 000000000..73f428508 --- /dev/null +++ b/extensions/InlineHistory/template/en/default/hook/bug/comments-comment_banner.html.tmpl @@ -0,0 +1,31 @@ +[%# ***** BEGIN LICENSE BLOCK ***** + # Version: MPL 1.1 + # + # The contents of this file are subject to the Mozilla Public License Version + # 1.1 (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS IS" basis, + # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + # for the specific language governing rights and limitations under the + # License. + # + # The Original Code is the InlineHistory Bugzilla Extension; + # Derived from the Bugzilla Tweaks Addon. + # + # The Initial Developer of the Original Code is the Mozilla Foundation. + # Portions created by the Initial Developer are Copyright (C) 2011 the + # Initial Developer. All Rights Reserved. + # + # Contributor(s): + # Byron Jones + # + # ***** END LICENSE BLOCK ***** + #%] + +[% IF ih_activity_max %] +

+ This [% terms.bug %] contains too many changes to be displayed inline. +

+[% END %] -- cgit v1.2.3-24-g4f1b