Closed Bug 1235270 Opened 8 years ago Closed 8 years ago

Set submitter_id before calling _check_data()

Categories

(Bugzilla :: Attachments & Requests, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: mokhi64, Assigned: mokhi64)

Details

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; FreeBSD i386) AppleWebKit/535.22+ (KHTML, like Gecko) Chromium/17.0.963.56 Chrome/17.0.963.56 Safari/535.22+ Epiphany/2.30.6

Steps to reproduce:

tried to print submitter_id accessed via attachement attributes


Actual results:

printing submitter_id via attachement attributes returns empty object


Expected results:

it should return sumbitter id
The point is that we call the hook in Bugzilla::Attachment::_check_data() before setting submitter_id, and so submitter_id is still undefined when the hook is called. This is not a big deal, because the extension can access the user ID with Bugzilla->user->id. But defining submitter_id before calling _check_data() is safe.
Assignee: general → attach-and-request
Severity: normal → minor
Status: UNCONFIRMED → NEW
Component: Bugzilla-General → Attachments & Requests
Ever confirmed: true
Target Milestone: --- → Bugzilla 5.0
Attached patch patch for Bugzilla/Attachment.pm (obsolete) — Splinter Review
Patch that fixes this issue (tnx from LpSolit :D)
Flags: needinfo?(attach-and-request)
Assignee: attach-and-request → mokhi64
Status: NEW → ASSIGNED
Flags: needinfo?(attach-and-request)
Comment on attachment 8702145 [details] [diff] [review]
patch for Bugzilla/Attachment.pm

>+    $params->{creation_ts} ||= Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
>+    $params->{modification_time} = $params->{creation_ts};
>+    $params->{submitter_id} = Bugzilla->user->id || ThrowUserError('invalid_user');

Hum no, only move submitter_id here. Leave the other two where they are currently. They will be set when the attachment is ready to be uploaded.
Attachment #8702145 - Flags: review-
Attachment #8702145 - Attachment is obsolete: true
Attachment #8702147 - Flags: review?(LpSolit)
Attachment #8702147 - Flags: feedback?(LpSolit)
Comment on attachment 8702147 [details] [diff] [review]
newer patch for Bugzilla/Attachment.pm

>+    #moved for fixing bug #1235270

This comment is useless and should be removed on checkin. Otherwise your patch is ok, so r=LpSolit. Thanks for the patch! :)
Attachment #8702147 - Flags: review?(LpSolit)
Attachment #8702147 - Flags: review+
Attachment #8702147 - Flags: feedback?(LpSolit)
Flags: approval5.0?
removed extra comment in patch.
Attachment #8702147 - Attachment is obsolete: true
Attachment #8702149 - Flags: review?(LpSolit)
Comment on attachment 8702149 [details] [diff] [review]
even newer patch for Bugzilla/Attachment.pm

r=LpSolit
Attachment #8702149 - Flags: review?(LpSolit) → review+
Flags: approval5.0? → approval5.0+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   7829cc8..66e373d  master -> master

To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   f729352..6e6093a  5.0 -> 5.0
Status: ASSIGNED → RESOLVED
Closed: 8 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: