diff --git a/template/en/custom/bug/process/unsubscribe.html.tmpl b/template/en/custom/bug/process/unsubscribe.html.tmpl new file mode 100644 index 000000000..51d84fc87 --- /dev/null +++ b/template/en/custom/bug/process/unsubscribe.html.tmpl @@ -0,0 +1,18 @@ +[%# 1.0@bugzilla.org %] + +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +[% PROCESS global/variables.none.tmpl %] +[% PROCESS global/header.html.tmpl %] + +

Removing you from CC list of bug #[% bug.id %]

+ +[% IF rm_cc_ok %] +

OK, you are removed from CC list of bug #[% bug.id %].

+[% ELSE %] +

You are not in the CC list of bug #[% bug.id %].

+[% END %] + +[% PROCESS global/footer.html.tmpl %] + diff --git a/template/en/default/email/newchangedmail.txt.tmpl b/template/en/default/email/newchangedmail.txt.tmpl index ffe0dbd62..26d62945d 100644 --- a/template/en/default/email/newchangedmail.txt.tmpl +++ b/template/en/default/email/newchangedmail.txt.tmpl @@ -56,7 +56,7 @@ You reported the [% terms.bug %]. [% CASE constants.REL_QA %] You are the QA contact for the [% terms.bug %]. [% CASE constants.REL_CC %] -You are on the CC list for the [% terms.bug %]. +You are on the CC list for the [% terms.bug %]. Remove yourself from the CC list. [% CASE constants.REL_VOTER %] You are a voter for the [% terms.bug %]. [% CASE constants.REL_GLOBAL_WATCHER %] diff --git a/unsubscribe.cgi b/unsubscribe.cgi new file mode 100755 index 000000000..92489368c --- /dev/null +++ b/unsubscribe.cgi @@ -0,0 +1,49 @@ +#!/usr/bin/perl -wT +# Bugzilla Unsubscribe page + +use strict; + +use lib qw(. lib); + +use Bugzilla; +use Bugzilla::Constants; +use Bugzilla::Bug; +use Bugzilla::BugMail; +use Bugzilla::Mailer; +use Bugzilla::User; +use Bugzilla::Util; +use Bugzilla::Error; + +my $user = Bugzilla->login(LOGIN_REQUIRED); + +my $cgi = Bugzilla->cgi; +my $dbh = Bugzilla->dbh; +my $template = Bugzilla->template; +my $vars = {}; + +my $bug = $cgi->param('id'); +Bugzilla::Bug::ValidateBugID($bug); + +$cgi->param('id', $bug); +$bug = Bugzilla::Bug->new($bug); +$vars->{bug} = $bug; + +if (grep { $_->id == $user->id } @{$bug->cc_users}) +{ + $bug->remove_cc($user); + $bug->update; + $vars->{rm_cc_ok} = 1; +} +else +{ + $vars->{not_in_cc} = 1; +} + +print $cgi->header(); +$template->process('bug/process/unsubscribe.html.tmpl', $vars) + || ThrowTemplateError($template->error()); + +exit; + +1; +__END__