From 7e41532fd90edd907bffc283b39f1c1d3397ab4a Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 10 Aug 2015 21:21:05 +0800 Subject: Bug 1153108 - add page allowing users to grant canconfirm rights onto themselves --- extensions/BMO/Extension.pm | 15 +++++ .../en/default/pages/triage_request.html.tmpl | 76 ++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 extensions/BMO/template/en/default/pages/triage_request.html.tmpl (limited to 'extensions/BMO') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 34e346a24..a72cc3cab 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -227,6 +227,9 @@ sub page_before_template { elsif ($page eq 'attachment_bounty_form.html') { bounty_attachment($vars); } + elsif ($page eq 'triage_request.html') { + triage_request($vars); + } } sub bounty_attachment { @@ -355,6 +358,18 @@ sub parse_bounty_attachment_description { }; } +sub triage_request { + my ($vars) = @_; + my $user = Bugzilla->login(LOGIN_REQUIRED); + if (Bugzilla->input_params->{update}) { + Bugzilla->set_user(Bugzilla::User->super_user); + $user->set_groups({ add => [ 'canconfirm' ] }); + Bugzilla->set_user($user); + $user->update(); + $vars->{updated} = 1; + } +} + sub _get_field_values_sort_key { my ($field) = @_; my $dbh = Bugzilla->dbh; diff --git a/extensions/BMO/template/en/default/pages/triage_request.html.tmpl b/extensions/BMO/template/en/default/pages/triage_request.html.tmpl new file mode 100644 index 000000000..954ad5a06 --- /dev/null +++ b/extensions/BMO/template/en/default/pages/triage_request.html.tmpl @@ -0,0 +1,76 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[% inline_style = BLOCK %] +#triage-request { + padding: 0 6px; +} +#blurb { + background: #fff; + color: #000; + border-radius: 10px; + padding: 10px 20px 20px 20px; + max-width: 800px; +} +[% END %] + +[% inline_javascript = BLOCK %] +[% END %] + +[% PROCESS global/header.html.tmpl + title = terms.Bug _ " Triage Request" + style = inline_style + javascript = inline_javascript +%] + +
+ +

[% terms.Bug %] Triage Request

+ +
+ + [% IF user.in_group('canconfirm') %] + + [% UNLESS updated %] +

Awesome - You can already triage [% terms.bugs %]

+ [% END %] + +

+ Thank you. +

+

+ With your help sorting and triaging [% terms.bugs %] Mozilla will be able + to ship a better product to hundreds of millions of users that much + faster. +

+ + [% ELSE %] + +

+ Triage is the first step in a [% terms.bug %]'s road to resolution; having + 'canconfirm' rights gives you the access you'll need to help move that [% + terms.bug %] it into the right component, narrow it down and confirm it as + "new". This helps Mozilla's engineers learn about it sooner and fix it + faster. +

+ +

+ Would you like to add "canconfirm" permissions to your account? +

+ +
+ + + +
+ + [% END %] + +
+ +[% PROCESS global/footer.html.tmpl %] -- cgit v1.2.3-24-g4f1b