Bug 46701

CC unsubscribe links


git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@129 6955db30-a419-402b-8a0d-67ecbb4d7f56
custis
vfilippov 2009-02-13 13:34:51 +00:00
parent 5d0d1d4c55
commit 5d97d7b95d
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,18 @@
[%# 1.0@bugzilla.org %]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS global/header.html.tmpl %]
<h3>Removing you from CC list of bug #<a href="[% urlbase %]show_bug.cgi?id=[% bug.id %]">[% bug.id %]</a></h3>
[% IF rm_cc_ok %]
<p>OK, you are removed from CC list of bug #<a href="[% urlbase %]show_bug.cgi?id=[% bug.id %]">[% bug.id %]</a>.</p>
[% ELSE %]
<p>You are not in the CC list of bug #<a href="[% urlbase %]show_bug.cgi?id=[% bug.id %]">[% bug.id %]</a>.</p>
[% END %]
[% PROCESS global/footer.html.tmpl %]

View File

@ -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 %]. <a href="[% urlbase %]unsubscribe.cgi?id=[% bugid %]">Remove yourself from the CC list</a>.
[% CASE constants.REL_VOTER %]
You are a voter for the [% terms.bug %].
[% CASE constants.REL_GLOBAL_WATCHER %]

49
unsubscribe.cgi Executable file
View File

@ -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__