Allow to disable silent comments

hinted-selects
Vitaliy Filippov 2014-10-20 19:49:46 +04:00
parent 35377d4591
commit bbfd9e6be3
12 changed files with 45 additions and 25 deletions

View File

@ -1488,7 +1488,8 @@ sub save_added_comments
foreach my $comment (@{$self->{added_comments} || []})
{
# FIXME Do not use input_params from Bugzilla::Bug
if (Bugzilla->input_params->{commentsilent})
if (Bugzilla->input_params->{commentsilent} &&
Bugzilla->params->{allow_commentsilent})
{
# Log silent comments
SilentLog($self->id, $comment->{thetext});

View File

@ -72,30 +72,33 @@ sub send_results
shift if $_[0] eq __PACKAGE__;
my ($vars) = @_;
next if $vars->{message} eq 'bugmail' && $vars->{sent_bugmail};
# FIXME check if commentsilent is working correctly
$vars->{commentsilent} = Bugzilla->input_params->{commentsilent}
&& Bugzilla->params->{allow_commentsilent};
if ($vars->{message} eq 'flagmail')
{
$vars->{message} = 'bugmail';
$vars->{type} = 'flag';
$vars->{sent_bugmail} = SendFlag($vars->{notify_data});
$vars->{commentsilent} &&= Bugzilla->user->settings->{silent_affects_flags}->{value} eq 'do_not_send';
if (!$vars->{commentsilent})
{
$vars->{sent_bugmail} = SendFlag($vars->{notify_data});
}
$vars->{new_flag} = {
name => $vars->{notify_data}->{flag} ? $vars->{notify_data}->{flag}->name : $vars->{notify_data}->{old_flag}->name,
status => $vars->{notify_data}->{flag} ? $vars->{notify_data}->{flag}->status : 'X',
};
$vars->{commentsilent} = 0; # Custis Bug 132647
delete $vars->{notify_data}; # erase data, don't store it in session
}
elsif ($vars->{message} eq 'votes-removed')
{
$vars->{message} = 'bugmail';
$vars->{sent_bugmail} = SendVotesRemoved($vars);
$vars->{commentsilent} = 0;
delete $vars->{notify_data}; # erase data, don't store it in session
}
elsif ($vars->{message} eq 'bugmail')
{
$vars->{sent_bugmail} = Send($vars->{bug_id}, $vars->{mailrecipients}, $vars->{commentsilent});
# FIXME Do not use input_params from Bugzilla::BugMail
$vars->{commentsilent} = Bugzilla->input_params->{commentsilent} ? 1 : 0;
}
return $vars;
}

View File

@ -78,6 +78,12 @@ sub get_param_list
};
my @param_list = (
{
name => 'allow_commentsilent',
type => 'b',
default => 1,
},
{
name => 'duplicate_or_move_bug_status',
type => 's',

View File

@ -1088,7 +1088,6 @@ or deleted.
=cut
# FIXME move this notification out of here!
sub notify
{
my ($class, $flag, $old_flag, $obj, $comment) = @_;
@ -1099,7 +1098,8 @@ sub notify
$attachment = $obj;
$bug = $attachment->bug;
}
elsif (blessed($obj) && $obj->isa('Bugzilla::Bug')) {
elsif (blessed($obj) && $obj->isa('Bugzilla::Bug'))
{
$bug = $obj;
}
else
@ -1108,14 +1108,6 @@ sub notify
return;
}
# FIXME move "silent" indication out of cgi.commentsilent
if (Bugzilla->input_params->{commentsilent} &&
Bugzilla->user->settings->{silent_affects_flags}->{value} eq 'do_not_send')
{
# Your changes are marked as Silent. No mail is sent.
return;
}
my $addressee;
# If the flag is set to '?', maybe the requestee wants a notification.
if ($flag && $flag->requestee_id

View File

@ -63,6 +63,7 @@ Other new features:
* Detect changes for multi-selects during mid-air collisions.
* Automatically decode known MediaWiki URLs in comments and show them nicely
using <wikiname>:[[Page name#Section]] syntax.
* Allow to disable Silent and Worktime-Only comments.
Bugfixes:
* More correct select field population on bug and query forms.

View File

@ -269,7 +269,6 @@ else
######################################################################
$vars->{title_tag} = "bug_processed";
$vars->{commentsilent} = $ARGS->{commentsilent};
my $next_bug_id;
my $action;

View File

@ -25,6 +25,10 @@
[% param_descs = {
allow_commentsilent =>
"If this is on, users are allowed to make bug changes without notifying" _
" anyone by checking the Silent checkbox."
duplicate_or_move_bug_status =>
"When $terms.abug is marked as a duplicate of another one " _
"or is moved to another installation, use this $terms.bug status."

View File

@ -149,7 +149,9 @@
<th><label for="comment">Comment:</label></th>
<td>
<em>(optional) Add a comment about this attachment to the [% terms.bug %].</em>
<input type="checkbox" id="commentsilent" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
[% IF Param('allow_commentsilent') %]
<input type="checkbox" id="commentsilent" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
[% END %]
<br />
[% INCLUDE global/textarea.html.tmpl
name = 'comment'

View File

@ -162,7 +162,10 @@
[% IF user.id %]
<div id="smallCommentFrame">
<label for="comment">Comment (on the [% terms.bug %]):</label>
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label></small><br />
[% IF Param('allow_commentsilent') %]
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
[% END %]
<br />
[% INCLUDE global/textarea.html.tmpl
id = 'comment_textarea'
name = 'comment'

View File

@ -938,11 +938,13 @@ document.changeform = document.[% cfname %];
onclick="updateCommentTagControl(this, form)" />
<label for="newcommentprivacy">Private</label>
[% END %]
[% IF Param('allow_commentsilent') %]
<input type="checkbox" name="commentsilent" value="1" id="commentsilent" />
<label for="commentsilent">Silent</label>
<input type="checkbox" name="cmt_worktime" value="1" id="cmt_worktime"
onclick="if(this.checked)document.getElementById('commentsilent').checked=true" />
<label for="cmt_worktime">Worktime only</label>
[% END %]
<!-- This table keeps the submit button aligned with the box. -->
<table[% ' width="100%"' IF user.settings.comment_width.value == 'on' %]><tr><td>

View File

@ -175,7 +175,12 @@ function checkColumns()
[% END %]
</tbody>
</table>
<p><input type="submit" value="Import selected bugs / updates" /> &nbsp; <input type="checkbox" name="commentsilent" id="commentsilent" value="1" /> <label for="commentsilent">Silent</label></p>
<p>
<input type="submit" value="Import selected bugs / updates" /> &nbsp;
[% IF Param('allow_commentsilent') %]
<input type="checkbox" name="commentsilent" id="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
[% END %]
</p>
</form>
<p><a href="javascript:history.back()">Back</a></p>

View File

@ -295,17 +295,19 @@ document.write(' <input type="button" name="check_all" value="Check All" onclick
<strong>[% Param('insidergroup') FILTER html %]</strong> group)
</label>
[% END %]
<input type="checkbox" name="commentsilent" value="1"
id="newcommentsilent"/>
<label for="newcommentsilent">Silent</label>
<br>
[% IF Param('allow_commentsilent') %]
<input type="checkbox" name="commentsilent" value="1" id="newcommentsilent" />
<label for="newcommentsilent">Silent</label>
[% END %]
<br />
[% INCLUDE global/textarea.html.tmpl
name = 'comment'
id = 'comment'
minrows = 5
maxrows = 25
cols = constants.COMMENT_COLS
%]<br>
%]
<br />
[% Hook.process('before_groups') %]