Closed Bug 625437 Opened 14 years ago Closed 13 years ago

Use 'Importance' / 'X-Priority' headers in incoming mail to influence bug's initial priority

Categories

(Bugzilla :: Incoming Email, enhancement)

3.6.3
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: reed, Assigned: reed)

Details

Attachments

(1 file, 4 obsolete files)

email_in.pl should check incoming e-mails for 'Importance' (and/or 'X-Priority') header(s). If it/they is/are present, use the value of the 'Importance' header to influence the initial priority of the bug. I've seen at least one other bug tracker do this well, and it's very useful if you're mostly only submitting bugs via e-mail. For example, if an e-mail has 'Importance: High', the bug should be set to P1. If it's 'Importance: Low', set it to P5. X-Priority field may also influence this somewhat. http://tools.ietf.org/html/rfc4021#section-2.1.52
Sounds reasonable. I think a good implementation would be something like this: 1) If somebody specifies @priority, use it. 2) If there's an importance header, use it as something that is relative to the default priority. So if it's High, increase the priority by 1. If it's Low, decrease the priority by 1. 3) Otherwise, use the default priority.
Attached patch patch - v1 (untested) (obsolete) — Splinter Review
First crack at this... Untested.
Assignee: incoming.email → reed
Status: NEW → ASSIGNED
Comment on attachment 503615 [details] [diff] [review] patch - v1 (untested) I can't really test this, as I have no dev environment that supports the incoming e-mail stuff.
Attachment #503615 - Flags: review?(LpSolit)
Do we want to also look at X-Priority, as Thunderbird doesn't support Importance yet (bug 406189)?
Comment on attachment 503615 [details] [diff] [review] patch - v1 (untested) >+ my $importance = $input_email->header('Importance'); Please also look at the X-Priority header, as Thunderbird doesn't set nor understand the Importance header, see my previous comment: my $importance = $input_email->header('Importance') || $input_email->header('X-Priority') >+ my $legal_priorities = Bugzilla::Field::get_legal_field_values('priority'); get_legal_field_values() is exported by Bugzilla::Field, so you don't need to prepend Bugzilla::Field:: when calling the method. >+ my $i = firstidx { $_ eq Bugzilla->params->{'defaultpriority'} } @legal_priorities; Your code doesn't compile because you defined $legal_priorities (arrayref) and here and below you use @legal_priorities (array): "Global symbol "@legal_priorities" requires explicit package name at ./email_in.pl line 156." >+ if ($importance =~ /high/i) { >+ $i++ unless $i == $#legal_priorities; >+ } You did it the wrong way. A higher priority has a lower index, and vice versa.
Attachment #503615 - Flags: review?(LpSolit) → review-
Attached patch patch - v2 (untested) (obsolete) — Splinter Review
Attachment #503615 - Attachment is obsolete: true
Attachment #647703 - Flags: review?(LpSolit)
Summary: Use 'Importance' header in incoming mail to influence bug's initial priority → Use importance / priority header in incoming mail to influence bug's initial priority
Attached patch patch - v3 (untested) (obsolete) — Splinter Review
Oops, had a typo in the last one... Also, removed X-MSMail-Priority, as per IRC discussion.
Attachment #647703 - Attachment is obsolete: true
Attachment #647703 - Flags: review?(LpSolit)
Attachment #647713 - Flags: review?(LpSolit)
Comment on attachment 647713 [details] [diff] [review] patch - v3 (untested) Please test your patch! It doesn't compile: Global symbol "@legal_priorities" requires explicit package name at ./email_in.pl line 163. Global symbol "@legal_priorities" requires explicit package name at ./email_in.pl line 165. Execution of ./email_in.pl aborted due to compilation errors. You don't need any special environment to test your patch. Just save an email (with its headers) in a text file, and call: ./email_in.pl < email.txt
Attachment #647713 - Flags: review?(LpSolit) → review-
Attached patch patch - v4 (untested) (obsolete) — Splinter Review
compiles now. ;)
Attachment #647713 - Attachment is obsolete: true
Attachment #647744 - Flags: review?(LpSolit)
This should only be used for new bugs.
Attachment #647744 - Attachment is obsolete: true
Attachment #647744 - Flags: review?(LpSolit)
Attachment #647748 - Flags: review?(LpSolit)
Comment on attachment 647748 [details] [diff] [review] patch - v5 (untested) >+ # The importance/priority field is only used for a post_bug. "The Importance/X-Priority field is only used when creating a new bug". >+ # 2) If there's an importance header, use it as something that "If there is an Importance or X-Priority header, ..." r=LpSolit
Attachment #647748 - Flags: review?(LpSolit) → review+
Flags: approval+
Keywords: relnote
Target Milestone: --- → Bugzilla 4.4
Summary: Use importance / priority header in incoming mail to influence bug's initial priority → Use 'Importance' / 'X-Priority' headers in incoming mail to influence bug's initial priority
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified email_in.pl Committed revision 8320.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Added to relnotes for 4.4.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: