Closed Bug 308581 Opened 19 years ago Closed 19 years ago

excluding yourself from a restricted bug generates an error if the user pref is set to "show the updated bug"

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

2.21
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: LpSolit, Assigned: glob)

Details

Attachments

(1 file)

Starting from 2.21, you can now decide to "show the updated bug" after changing
a bug. But if the bug is restricted to groups you don't belong to and you
exclude yourself from this bug (because you reassigned the bug or removed
yourself from the CC list, for instance), an error is generated:

Internal Error

 Trying to retrieve bug 153 returned the error NotPermitted.

As a bonus, the header banner is displayed twice.

CCing glob who introduced this feature.
i guess the correct behavour should be to display a slightly more informative
error message?  and only one banner :)
Actually, the error message comes from $bug->{'error'}. At least, this bug shows
us that this feature works ;)

Even better than a message, the updated bug should be ignored completely, as it
does already when there is no "next bug" to display (and the usual "show next
bug" is selected), or when the next bug is not accessible. This is the less
confusing solution for the user.
Attached patch v1Splinter Review
don't try to show the updated bug if the user don't have access to it.
Assignee: create-and-change → bugzilla
Status: NEW → ASSIGNED
Attachment #196116 - Flags: review?
Comment on attachment 196116 [details] [diff] [review]
v1

>Index: process_bug.cgi

> } elsif ($action eq 'same_bug') {
>+    if (Bugzilla->user->can_see_bug($cgi->param('id'))) {
>+        my $bug = new Bugzilla::Bug($cgi->param('id'), $whoid);
>+        ThrowCodeError("bug_error", { bug => $bug }) if $bug->error;
> 
>+        $vars->{'bugs'} = [$bug];
> 
>+        $template->process("bug/show.html.tmpl", $vars)
>+          || ThrowTemplateError($template->error());
> 
>+        exit;
>+    }

Nit: Bugzilla->user->can_see_bug() could be $user->can_see_bug() as $user has
already been defined as the current user.

Nit: going to the next bug and going back to the same bug have a large part of
the code in common. Having a subroutine like display_bug($bug_id, $next_bug)
would avoid this duplication of the code. But that's another bug.

The patch works as expected and ThrowCodeError() isn't called anymore.
r=LpSolit
Attachment #196116 - Flags: review? → review+
Flags: approval?
Target Milestone: --- → Bugzilla 2.22
Flags: approval? → approval+
Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.285; previous revision: 1.284
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: