diff options
Diffstat (limited to 'extensions/BMO')
3 files changed, 63 insertions, 22 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index b4ff1b01d..7d182c7a3 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -1410,22 +1410,47 @@ sub _post_dev_engagement { } push(@attach_values, '"' . join(",", @requested) . '"'); - my $attachment = Bugzilla::Attachment->create({ - bug => $parent_bug, - creation_ts => $parent_bug->creation_ts, - data => join("\t", @attach_values), - description => 'Spreadsheet Data', - filename => 'dev_engagement_submission.txt', - ispatch => 0, - isprivate => 0, - mimetype => 'text/plain' - }); + # we wrap the data inside a textarea to allow for the delimited data to + # be pasted directly into google docs. + + my $values = html_quote(join("\t", @attach_values)); + my $data = <<EOF; +<!doctype html> +<html> + <head> + <meta charset="utf-8"> + <title>Spreadsheet Data</title> + <style> + * { + box-sizing: border-box; + height: 100%; + margin: 0; + padding: 0; + width: 100%; + } + body { + overflow: hidden; + } + textarea { + background: none; + border: 0; + padding: 1em; + resize: none; + } + </style> + </head> + <body> + <textarea>$values</textarea> + </body> +</html> +EOF - # Insert comment for attachment - $parent_bug->add_comment('', { isprivate => 0, - type => CMT_ATTACHMENT_CREATED, - extra_data => $attachment->id }); - delete $parent_bug->{'attachments'}; # So the new attachment displays properly + $self->_add_attachment($args, { + data => $data, + description => 'Spreadsheet Data', + filename => 'dev_engagement_submission.html', + mimetype => 'text/html', + }); # File discussion bug Bugzilla->set_user(Bugzilla::User->new({ name => 'nobody@mozilla.org' })); @@ -1477,16 +1502,18 @@ sub _post_dev_engagement { $parent_bug->set_all({ dependson => { add => [ $discussion_bug->id ] } }); $parent_bug->add_comment('This request is being discussed in bug ' . $discussion_bug->id); - $parent_bug->update($parent_bug->creation_ts); - # No need to send mail for parent bug }; my $error = $@; Bugzilla->set_user($old_user); Bugzilla->error_mode($error_mode_cache); + # No matter what happened, ensure the parent bug gets marked as updated + # There's no need to send mail for parent bug + $parent_bug->update($parent_bug->creation_ts); + if ($error || !$discussion_bug) { - warn "Failed to create additional dev-engagement bug: $error" if $error; + warn "Failed to create additional dev-engagement bug: $error\n" if $error; $vars->{'message'} = 'dev_engagement_creation_failed'; } } diff --git a/extensions/BMO/template/en/default/bug/create/create-dev-engagement-event.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-dev-engagement-event.html.tmpl index 9665bcc27..5d1771013 100644 --- a/extensions/BMO/template/en/default/bug/create/create-dev-engagement-event.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-dev-engagement-event.html.tmpl @@ -134,7 +134,7 @@ </div> <div class="form_section"> - <div class="field_label"> + <div class="field_label required"> Is this a developer event? </div> <select id="developer_event" name="developer_event"> @@ -149,7 +149,7 @@ </div> <div class="form_section"> - <div class="field_label"> + <div class="field_label required"> Is someone from Mozilla attending? </div> <select id="mozilla_attending" name="mozilla_attending"> diff --git a/extensions/BMO/template/en/default/hook/global/messages-messages.html.tmpl b/extensions/BMO/template/en/default/hook/global/messages-messages.html.tmpl index 0c90b97b9..8a1580850 100644 --- a/extensions/BMO/template/en/default/hook/global/messages-messages.html.tmpl +++ b/extensions/BMO/template/en/default/hook/global/messages-messages.html.tmpl @@ -1,5 +1,19 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + [% IF message_tag == "employee_incident_creation_failed" %] - The [% terms.bug %] was created successfully, but the dependent - Employee Incident [% terms.bug %] creation failed. The error has + The [% terms.bug %] was created successfully, but the dependent + Employee Incident [% terms.bug %] creation failed. The error has been logged and no further action is required at this time. + +[% ELSIF message_tag == "dev_engagement_creation_failed" %] + The [% terms.bug %] was created successfully, but the dependent + discussion [% terms.bug %] creation failed. The error has + been logged and no further action is required at this time. + [% END %] |