Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
d74d76b0
Commit
d74d76b0
authored
Apr 05, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556429: Stop sending bugmail from inside the template
r=LpSolit, a=LpSolit
parent
3b351275
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
54 deletions
+44
-54
BugMail.pm
Bugzilla/BugMail.pm
+0
-1
Template.pm
Bugzilla/Template.pm
+0
-7
attachment.cgi
attachment.cgi
+9
-4
Extension.pm
extensions/Voting/Extension.pm
+10
-1
updated-changes.html.tmpl
.../en/default/hook/admin/products/updated-changes.html.tmpl
+1
-1
post_bug.cgi
post_bug.cgi
+13
-13
process_bug.cgi
process_bug.cgi
+3
-4
created.html.tmpl
template/en/default/bug/create/created.html.tmpl
+1
-4
bugmail.html.tmpl
template/en/default/bug/process/bugmail.html.tmpl
+4
-17
results.html.tmpl
template/en/default/bug/process/results.html.tmpl
+0
-2
release-notes.html.tmpl
template/en/default/pages/release-notes.html.tmpl
+3
-0
No files found.
Bugzilla/BugMail.pm
View file @
d74d76b0
...
...
@@ -107,7 +107,6 @@ sub relationships {
# roles when the email is sent.
# All the names are email addresses, not userids
# values are scalars, except for cc, which is a list
# This hash usually comes from the "mailrecipients" var in a template call.
sub
Send
{
my
(
$id
,
$forced
)
=
(
@_
);
...
...
Bugzilla/Template.pm
View file @
d74d76b0
...
...
@@ -739,13 +739,6 @@ sub create {
# started the session.
'sudoer'
=>
sub
{
return
Bugzilla
->
sudoer
;
},
# SendBugMail - sends mail about a bug, using Bugzilla::BugMail.pm
'SendBugMail'
=>
sub
{
my
(
$id
,
$mailrecipients
)
=
(
@_
);
require
Bugzilla::
BugMail
;
Bugzilla::BugMail::
Send
(
$id
,
$mailrecipients
);
},
# Allow templates to access the "corect" URLBase value
'urlbase'
=>
sub
{
return
Bugzilla::Util::
correct_urlbase
();
},
...
...
attachment.cgi
View file @
d74d76b0
...
...
@@ -39,6 +39,7 @@ use strict;
use
lib
qw(. lib)
;
use
Bugzilla
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Flag
;
...
...
@@ -532,8 +533,6 @@ sub insert {
$dbh
->
bz_commit_transaction
;
# Define the variables and functions that will be passed to the UI template.
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
,
'owner'
=>
$owner
};
$vars
->
{
'attachment'
}
=
$attachment
;
# We cannot reuse the $bug object as delta_ts has eventually been updated
# since the object was created.
...
...
@@ -541,6 +540,9 @@ sub insert {
$vars
->
{
'header_done'
}
=
1
;
$vars
->
{
'contenttypemethod'
}
=
$cgi
->
param
(
'contenttypemethod'
);
my
$recipients
=
{
'changer'
=>
$user
->
login
,
'owner'
=>
$owner
};
$vars
->
{
'sent_bugmail'
}
=
Bugzilla::BugMail::
Send
(
$bugid
,
$recipients
);
print
$cgi
->
header
();
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
"attachment/created.html.tmpl"
,
$vars
)
...
...
@@ -662,10 +664,11 @@ sub update {
$dbh
->
bz_commit_transaction
();
# Define the variables and functions that will be passed to the UI template.
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
};
$vars
->
{
'attachment'
}
=
$attachment
;
$vars
->
{
'bugs'
}
=
[
$bug
];
$vars
->
{
'header_done'
}
=
1
;
$vars
->
{
'sent_bugmail'
}
=
Bugzilla::BugMail::
Send
(
$bug
->
id
,
{
'changer'
=>
$user
->
login
});
print
$cgi
->
header
();
...
...
@@ -714,7 +717,6 @@ sub delete_attachment {
$vars
->
{
'attachment'
}
=
$attachment
;
$vars
->
{
'date'
}
=
$date
;
$vars
->
{
'reason'
}
=
clean_text
(
$cgi
->
param
(
'reason'
)
||
''
);
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
};
$template
->
process
(
"attachment/delete_reason.txt.tmpl"
,
$vars
,
\
$msg
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
@@ -738,6 +740,9 @@ sub delete_attachment {
$vars
->
{
'bugs'
}
=
[
$bug
];
$vars
->
{
'header_done'
}
=
1
;
$vars
->
{
'sent_bugmail'
}
=
Bugzilla::BugMail::
Send
(
$bug
->
id
,
{
'changer'
=>
$user
->
login
});
$template
->
process
(
"attachment/updated.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
}
...
...
extensions/Voting/Extension.pm
View file @
d74d76b0
...
...
@@ -29,6 +29,7 @@ use strict;
use
base
qw(Bugzilla::Extension)
;
use
Bugzilla::
Bug
;
use
Bugzilla::
BugMail
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Field
;
...
...
@@ -614,10 +615,12 @@ sub _update_votes {
$dbh
->
bz_commit_transaction
();
$vars
->
{
'type'
}
=
"votes"
;
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
};
$vars
->
{
'title_tag'
}
=
'change_votes'
;
foreach
my
$bug_id
(
@updated_bugs
)
{
$vars
->
{
'id'
}
=
$bug_id
;
$vars
->
{
'sent_bugmail'
}
=
Bugzilla::BugMail::
Send
(
$bug_id
,
{
'changer'
=>
$user
->
login
});
$template
->
process
(
"bug/process/results.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
# Set header_done to 1 only after the first bug.
...
...
@@ -723,6 +726,12 @@ sub _modify_bug_votes {
foreach
my
$msg
(
@msgs
)
{
MessageToMTA
(
$msg
);
}
# And send out emails about changed bugs
foreach
my
$bug_id
(
@updated_bugs
)
{
my
$sent_bugmail
=
Bugzilla::BugMail::
Send
(
$bug_id
,
{
changer
=>
Bugzilla
->
user
->
login
});
$changes
->
{
'confirmed_bugs_sent_bugmail'
}
->
{
$bug_id
}
=
$sent_bugmail
;
}
}
# If a bug is moved to a product which allows less votes per bug
...
...
extensions/Voting/template/en/default/hook/admin/products/updated-changes.html.tmpl
View file @
d74d76b0
...
...
@@ -89,8 +89,8 @@
overwritten, which happens otherwise %]
[% INCLUDE bug/process/results.html.tmpl
type = 'votes'
mailrecipients = { 'changer' => user.login }
header_done = 1
sent_bugmail = changes.confirmed_bugs_sent_bugmail.$id
id = id
%]
[% END %]
...
...
post_bug.cgi
View file @
d74d76b0
...
...
@@ -231,9 +231,6 @@ my ($flags, $new_flags) = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $v
$bug
->
set_flags
(
$flags
,
$new_flags
);
$bug
->
update
(
$timestamp
);
# Email everyone the details of the new bug
$vars
->
{
'mailrecipients'
}
=
{
'changer'
=>
$user
->
login
};
$vars
->
{
'id'
}
=
$id
;
$vars
->
{
'bug'
}
=
$bug
;
...
...
@@ -241,22 +238,25 @@ Bugzilla::Hook::process('post_bug_after_creation', { vars => $vars });
ThrowCodeError
(
"bug_error"
,
{
bug
=>
$bug
})
if
$bug
->
error
;
$vars
->
{
'sentmail'
}
=
[]
;
push
(
@
{
$vars
->
{
'sentmail'
}},
{
type
=>
'created'
,
id
=>
$id
,
});
foreach
my
$i
(
@
{
$bug
->
dependson
||
[]
},
@
{
$bug
->
blocked
||
[]
})
{
push
(
@
{
$vars
->
{
'sentmail'
}},
{
type
=>
'dep'
,
id
=>
$i
,
});
}
if
(
$token
)
{
trick_taint
(
$token
);
$dbh
->
do
(
'UPDATE tokens SET eventdata = ? WHERE token = ?'
,
undef
,
(
"createbug:$id"
,
$token
));
}
my
$recipients
=
{
changer
=>
$user
->
login
};
my
$bug_sent
=
Bugzilla::BugMail::
Send
(
$id
,
$recipients
);
$bug_sent
->
{
type
}
=
'created'
;
$bug_sent
->
{
id
}
=
$id
;
my
@all_mail_results
=
(
$bug_sent
);
foreach
my
$dep
(
@
{
$bug
->
dependson
||
[]
},
@
{
$bug
->
blocked
||
[]
})
{
my
$dep_sent
=
Bugzilla::BugMail::
Send
(
$dep
,
$recipients
);
$dep_sent
->
{
type
}
=
'dep'
;
$dep_sent
->
{
id
}
=
$dep
;
push
(
@all_mail_results
,
$dep_sent
);
}
$vars
->
{
sentmail
}
=
\
@all_mail_results
;
print
$cgi
->
header
();
$template
->
process
(
"bug/create/created.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
process_bug.cgi
View file @
d74d76b0
...
...
@@ -78,10 +78,9 @@ my $vars = {};
sub
send_results
{
my
(
$bug_id
,
$vars
)
=
@_
;
my
$template
=
Bugzilla
->
template
;
if
(
Bugzilla
->
usage_mode
==
USAGE_MODE_EMAIL
)
{
Bugzilla::BugMail::
Send
(
$bug_id
,
$vars
->
{
'mailrecipients'
});
}
else
{
$vars
->
{
'sent_bugmail'
}
=
Bugzilla::BugMail::
Send
(
$bug_id
,
$vars
->
{
'mailrecipients'
});
if
(
Bugzilla
->
usage_mode
!=
USAGE_MODE_EMAIL
)
{
$template
->
process
(
"bug/process/results.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
}
...
...
template/en/default/bug/create/created.html.tmpl
View file @
d74d76b0
...
...
@@ -24,8 +24,6 @@
# type: string; type of change for this bug, either 'created' if this bug
# was created or 'dep' if it was added as a dependent/blocker
# id: integer; the ID of the bug
# mailrecipients: hash; contains the BugMail recipients, for details on
# this contents, see template bug/process/bugmail.html.tmpl
# bug: object; Bugzilla::Bug object of the bug that was created (used in
# template bug/edit.html.tmpl
#%]
...
...
@@ -44,8 +42,7 @@
[% PROCESS bug/process/results.html.tmpl
type = item.type
id = item.id
mail = item.mail
mailrecipients = mailrecipients
sent_bugmail = item
%]
[% END %]
...
...
template/en/default/bug/process/bugmail.html.tmpl
View file @
d74d76b0
...
...
@@ -20,34 +20,21 @@
#%]
[%# INTERFACE:
# mailing_bugid: string. ID of the bug this mail is concerning.
# mailrecipients: hash. People involved in this change. Hash has up to five
# elements:
# changer: string. The login name of the user who made the
# change.
#
# For bug changes where people need to be notified:
# owner: string. The login name of the bug assignee.
# reporter: string. The login name of the bug reporter.
# qacontact: string. The login name of the bug's QA contact.
# Optional.
# cc: list of strings. The login names of those on the CC
# list.
# mailing_bugid: The bug ID that email is being sent for.
# sent_bugmail: The results of Bugzilla::BugMail::Send().
#%]
[% PROCESS global/variables.none.tmpl %]
[% mail = SendBugMail(mailing_bugid, mailrecipients) %]
<dl>
[% PROCESS emails
description = "Email sent to"
names = mail.sent
names =
sent_bug
mail.sent
%]
[% PROCESS emails
description = "Excluding"
names = mail.excluded
names =
sent_bug
mail.excluded
%]
</dl>
...
...
template/en/default/bug/process/results.html.tmpl
View file @
d74d76b0
...
...
@@ -24,8 +24,6 @@
# type: string; the type of change/check that was made: "bug" when a bug
# is changed, "dupe" when a duplication notation is added to a bug,
# and "dep" when a bug is checked for changes to its dependencies.
#
# mailrecipients: hash; BugMail recipient params. Optional.
#%]
[% PROCESS global/variables.none.tmpl %]
...
...
template/en/default/pages/release-notes.html.tmpl
View file @
d74d76b0
...
...
@@ -523,6 +523,9 @@
<h2 id="v36_code_changes">Code Changes Which May Affect Customizations</h2>
<ul>
<li>There is no longer a SendBugMail method in the templates, and bugmail
is no longer sent by processing a template. Instead, it is sent
by using <kbd>Bugzilla::BugMail::Send</kbd>.</li>
<li>Comments are now represented as a
<a href="[% docs_urlbase FILTER html %]api/Bugzilla/Comment.html">Bugzilla::Comment</a>
object instead of just being hashes.</li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment