summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BugmailFilter/Extension.pm27
-rw-r--r--extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl202
-rw-r--r--extensions/BugmailFilter/web/js/bugmail-filter.js5
-rw-r--r--extensions/TrackingFlags/Extension.pm5
-rw-r--r--extensions/TrackingFlags/lib/Constants.pm6
5 files changed, 160 insertions, 85 deletions
diff --git a/extensions/BugmailFilter/Extension.pm b/extensions/BugmailFilter/Extension.pm
index 6bcfe70d6..60c180ca7 100644
--- a/extensions/BugmailFilter/Extension.pm
+++ b/extensions/BugmailFilter/Extension.pm
@@ -116,7 +116,7 @@ sub user_preferences {
# remove all tracking flag fields. these change too frequently to be of
# value, so they only add noise to the list.
- foreach my $field (@{ Bugzilla->tracking_flag_names }) {
+ foreach my $field (Bugzilla->tracking_flag_names) {
delete $fields{$field};
}
@@ -159,6 +159,27 @@ sub user_preferences {
}) }
];
+ # build a list of tracking-flags, grouped by type
+ require Bugzilla::Extension::TrackingFlags::Constants;
+ require Bugzilla::Extension::TrackingFlags::Flag;
+ my %flag_types =
+ map { $_->{name} => $_->{description} }
+ @{ Bugzilla::Extension::TrackingFlags::Constants::FLAG_TYPES() };
+ my %tracking_flags_by_type;
+ foreach my $flag (Bugzilla::Extension::TrackingFlags::Flag->get_all) {
+ my $type = $flag_types{$flag->flag_type};
+ $tracking_flags_by_type{$type} //= [];
+ push @{ $tracking_flags_by_type{$type} }, $flag;
+ }
+ my @tracking_flags_by_type;
+ foreach my $type (sort keys %tracking_flags_by_type) {
+ push @tracking_flags_by_type, {
+ name => $type,
+ flags => $tracking_flags_by_type{$type},
+ };
+ }
+ $vars->{tracking_flags_by_type} = \@tracking_flags_by_type;
+
${ $args->{handled} } = 1;
}
@@ -197,7 +218,7 @@ sub user_wants_mail {
require Bugzilla::Extension::TrackingFlags::Flag;
my %count;
my @tracking_flags;
- foreach my $field (@$fields, @{ Bugzilla->tracking_flag_names }) {
+ foreach my $field (@$fields, Bugzilla->tracking_flag_names) {
$count{$field}++;
}
foreach my $field (keys %count) {
@@ -212,7 +233,7 @@ sub user_wants_mail {
foreach my $type (keys %tracking_types) {
push @$fields, 'tracking.' . $type;
}
- foreach my $field (@{ Bugzilla->tracking_flag_names }) {
+ foreach my $field (Bugzilla->tracking_flag_names) {
$fields = [ grep { $_ ne $field } @$fields ];
}
diff --git a/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl b/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
index 83c8d729a..1bcbd35ae 100644
--- a/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
+++ b/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
@@ -173,84 +173,142 @@ var cpts = new Array();
If multiple filters are applicable to the same [% terms.bug %] change,
<b>include</b> filters override <b>exclude</b> filters.
</p>
+
+<hr>
+<h4>Field Groups</h4>
+
<p>
- Examples:
+ Some fields are grouped into a single entry in the "field" list.
+ Following is a list of the groups and all the fields they contain:
</p>
+
+[% FOREACH type = tracking_flags_by_type %]
+ [% type.name FILTER html %]:
+ <blockquote>
+ [% flag_count = type.flags.size %]
+ [% FOREACH flag = type.flags %]
+ [% IF flag_count > 10 && loop.count == 10 %]
+ <span id="show_all">
+ &hellip;
+ (<a href="#" onclick="showAllFlags(); return false">show all</a>)
+ </span>
+ <span id="all_flags" class="bz_default_hidden">
+ [% END %]
+ [% flag.description FILTER html FILTER no_break %]
+ [% ", " UNLESS loop.last %]
+ [% IF loop.last && flag_count > 10 %]
+ </span>
+ [% END %]
+ [% END %]
+ </blockquote>
+[% END %]
+
+<hr>
+<h4>Examples</h4>
<p>
To never receive changes made to the "QA Whiteboard" field for [% terms.bugs %]
where you are not the assignee:<br>
- <table class="example_filter_table">
- <tr>
- <th>Field:</th>
- <td>QA Whiteboard</td>
- </tr>
- <tr>
- <th>Product:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Component:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Relationship:</th>
- <td>Not Assignee</td>
- </tr>
- <tr>
- <th>Action:</th>
- <td>Exclude</td>
- </tr>
- </table>
</p>
+<table class="example_filter_table">
+ <tr>
+ <th>Field:</th>
+ <td>QA Whiteboard</td>
+ </tr>
+ <tr>
+ <th>Product:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Component:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Relationship:</th>
+ <td>Not Assignee</td>
+ </tr>
+ <tr>
+ <th>Action:</th>
+ <td>Exclude</td>
+ </tr>
+</table>
+
+<p>
+ To receive notifications of new [% terms.bugs %] in Firefox's "New Tab Page"
+ component, and no other changes, you require three filters. First an
+ <b>exclude</b> filter to drop all changes made to [% terms.bugs %] in that
+ component:<br>
+</p>
+<table class="example_filter_table">
+ <tr>
+ <th>Field:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Product:</th>
+ <td>Firefox</td>
+ </tr>
+ <tr>
+ <th>Component:</th>
+ <td>New Tab Page</td>
+ </tr>
+ <tr>
+ <th>Relationship:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Action:</th>
+ <td>Exclude</td>
+ </tr>
+</table>
<p>
- To receive just comments made to Firefox [% terms.bugs %], and no other
- changes, you require two filters. First an <b>exclude</b> filter to drop all
- changes made to [% terms.bugs %] in that product:<br>
- <table class="example_filter_table">
- <tr>
- <th>Field:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Product:</th>
- <td>Firefox</td>
- </tr>
- <tr>
- <th>Component:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Relationship:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Action:</th>
- <td>Exclude</td>
- </tr>
- </table>
- <br>
Then an <b>include</b> filter to indicate that you want to receive
- comments:<br>
- <table class="example_filter_table">
- <tr>
- <th>Field:</th>
- <td>Comment Created</td>
- </tr>
- <tr>
- <th>Product:</th>
- <td>Firefox</td>
- </tr>
- <tr>
- <th>Component:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Relationship:</th>
- <td>__Any__</td>
- </tr>
- <tr>
- <th>Action:</th>
- <td>Include</td>
- </tr>
- </table>
+ notifications when a [% terms.bug %] is created:
+</p>
+<table class="example_filter_table">
+ <tr>
+ <th>Field:</th>
+ <td>[% terms.Bug %] Created</td>
+ </tr>
+ <tr>
+ <th>Product:</th>
+ <td>Firefox</td>
+ </tr>
+ <tr>
+ <th>Component:</th>
+ <td>New Tab Page</td>
+ </tr>
+ <tr>
+ <th>Relationship:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Action:</th>
+ <td>Include</td>
+ </tr>
+</table>
+<p>
+ And finally another <b>include</b> filter to catch when a [% terms.bug %] is
+ moved into the "New Tab Page" component.
</p>
+<table class="example_filter_table">
+ <tr>
+ <th>Field:</th>
+ <td>Component</td>
+ </tr>
+ <tr>
+ <th>Product:</th>
+ <td>Firefox</td>
+ </tr>
+ <tr>
+ <th>Component:</th>
+ <td>New Tab Page</td>
+ </tr>
+ <tr>
+ <th>Relationship:</th>
+ <td>__Any__</td>
+ </tr>
+ <tr>
+ <th>Action:</th>
+ <td>Include</td>
+ </tr>
+</table>
diff --git a/extensions/BugmailFilter/web/js/bugmail-filter.js b/extensions/BugmailFilter/web/js/bugmail-filter.js
index e298a60f1..2b320bbbb 100644
--- a/extensions/BugmailFilter/web/js/bugmail-filter.js
+++ b/extensions/BugmailFilter/web/js/bugmail-filter.js
@@ -29,6 +29,11 @@ function onRemoveChange() {
Dom.get('remove').disabled = true;
}
+function showAllFlags() {
+ Dom.addClass('show_all', 'bz_default_hidden');
+ Dom.removeClass('all_flags', 'bz_default_hidden');
+}
+
Event.onDOMReady(function() {
Event.on('action', 'change', onFilterActionChange);
onFilterProductChange();
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
index 9b3d46ad2..301c10245 100644
--- a/extensions/TrackingFlags/Extension.pm
+++ b/extensions/TrackingFlags/Extension.pm
@@ -32,10 +32,7 @@ BEGIN {
}
sub _tracking_flag_names {
- # return just a list of names, hitting the database directly to avoid the
- # overhead of object creation
- return Bugzilla->request_cache->{tracking_flag_names} ||=
- Bugzilla->dbh->selectcol_arrayref("SELECT name FROM tracking_flags");
+ return Bugzilla::Extension::TrackingFlags::Flag->get_all_names();
}
sub page_before_template {
diff --git a/extensions/TrackingFlags/lib/Constants.pm b/extensions/TrackingFlags/lib/Constants.pm
index b6813c3c2..0b1ae3a1a 100644
--- a/extensions/TrackingFlags/lib/Constants.pm
+++ b/extensions/TrackingFlags/lib/Constants.pm
@@ -34,12 +34,6 @@ sub FLAG_TYPES {
collapsed => 1,
sortkey => 2
},
- {
- name => 'b2g',
- description => 'B2G Flags',
- collapsed => 1,
- sortkey => 3
- },
);
return [ sort { $a->{'sortkey'} <=> $b->{'sortkey'} } @flag_types ];
}