Closed Bug 1265392 Opened 8 years ago Closed 8 years ago

Clicking "stop following this bug" also turned off the 'restrict comments to users not in editbugs' flag

Categories

(bugzilla.mozilla.org :: User Interface, defect, P1)

Production

Tracking

()

RESOLVED FIXED

People

(Reporter: Gijs, Assigned: dylan)

References

Details

Attachments

(1 file, 1 obsolete file)

See the change at:

https://bugzilla.mozilla.org/show_activity.cgi?id=959893

at 2016-04-18 14:56:53 BST

Clicking the "stop following" button should *only* remove me from the CC list and do NOTHING else.
Blocks: 1150541
Assignee: nobody → dylan
Severity: normal → major
Priority: -- → P1
Attached patch 1265392_1.patch (obsolete) — Splinter Review
Attachment #8753411 - Flags: review?(dkl)
Comment on attachment 8753411 [details] [diff] [review]
1265392_1.patch

woops, now it can never be unset.
Attachment #8753411 - Flags: review?(dkl)
Attached patch 1265392_2.patchSplinter Review
Attachment #8753411 - Attachment is obsolete: true
Attachment #8753419 - Flags: review?(dkl)
Comment on attachment 8753419 [details] [diff] [review]
1265392_2.patch

Review of attachment 8753419 [details] [diff] [review]:
-----------------------------------------------------------------

I would not do the i_am_webservice check as we want to be able to set the value via API even though it is not documented currently. This change works for me just as well to fix the issue.

diff --git a/extensions/RestrictComments/Extension.pm b/extensions/RestrictComments/Extension.pm
index 001332a..35780fb 100644
--- a/extensions/RestrictComments/Extension.pm
+++ b/extensions/RestrictComments/Extension.pm
@@ -47,8 +47,8 @@ sub _can_restrict_comments {
 sub object_end_of_set_all {
     my ($self, $args) = @_;
     my $object = $args->{object};
-    if ($self->_can_restrict_comments($object)) {
-        my $input = Bugzilla->input_params;
+    my $input = Bugzilla->input_params;
+    if (exists $input->{restrict_comments} && $self->_can_restrict_comments($object)) {
         $object->set('restrict_comments', $input->{restrict_comments} ? 1 : undef);
     }
 }
Attachment #8753419 - Flags: review?(dkl) → review+
I think my patch allows it to be updated by a webservice or by the frontend. checkboxes are never sent over the wire when unchecked... am I wrong? :(
Flags: needinfo?(dkl)
(In reply to Dylan William Hardison [:dylan] from comment #5)
> I think my patch allows it to be updated by a webservice or by the frontend.
> checkboxes are never sent over the wire when unchecked... am I wrong? :(

Ok at first read it was confusing what was going on. So technically it would work via API but 
I now see that the check is just redundant. You only need to check for the existence of the
'restrict_comments' key in either case. As far as the API works, if a attribute does not exist
in the PUT data, it is simply ignored and the DB value is not changed. But if it does exist,
then it can be either true or false and will change the value if needed. The UI is slightly 
different in that it used to treat non-existent keys as empty values and actually change the
DB value but that has gotten better.

dkl
Flags: needinfo?(dkl)
To ssh://gitolite3@git.mozilla.org/webtools/bmo/bugzilla.git
   73fffe5..d7db0c1  master -> master
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Component: User Interface: Modal → User Interface
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: