From b4948d49587a7dab4a3a55c9169a2de2ff975736 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 16 Dec 2014 13:50:40 +0800 Subject: Bug 1107247: Updates to Spreadsheet Data in form.dev-engagement-event --- extensions/BMO/Extension.pm | 63 +++++++++++++++------- .../create/create-dev-engagement-event.html.tmpl | 4 +- .../hook/global/messages-messages.html.tmpl | 18 ++++++- 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 = < + + + + Spreadsheet Data + + + + + + +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 @@
-
+
Is this a developer event?
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 %] -- cgit v1.2.3-24-g4f1b