From 7a93e17c52f59ac19b2d26068bb3931d5a3e7877 Mon Sep 17 00:00:00 2001 From: "bzrmirror%bugzilla.org" Date: Thu, 20 Mar 2014 20:00:53 +0000 Subject: [PATCH] Bug 983839 - Add the ability to add see_also values in enter_bug.cgi and Bug.create r/a=glob git-svn-id: svn://10.0.0.236/trunk@265290 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/.gitrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/Bug.pm | 20 +++++++++++ .../bugzilla/Bugzilla/WebService/Bug.pm | 3 +- mozilla/webtools/bugzilla/enter_bug.cgi | 1 + mozilla/webtools/bugzilla/post_bug.cgi | 13 +++++++- .../bugzilla/skins/standard/global.css | 2 +- .../en/default/bug/create/create.html.tmpl | 9 +++++ .../template/en/default/bug/field.html.tmpl | 33 ++++++++++--------- 9 files changed, 64 insertions(+), 21 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index d0a14334bf4..dab8c3f5e0e 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8958 \ No newline at end of file +8959 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/.gitrev b/mozilla/webtools/bugzilla/.gitrev index 2b664b22219..9e0fac08183 100644 --- a/mozilla/webtools/bugzilla/.gitrev +++ b/mozilla/webtools/bugzilla/.gitrev @@ -1 +1 @@ -ca7b39aa66be9b4deea1ead8e6a788025759b80d \ No newline at end of file +1282244bf80703f541d19dca1c4733bff49275b0 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm index f05533d2582..b53847790b2 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Bug.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Bug.pm @@ -652,6 +652,7 @@ sub create { my $blocked = delete $params->{blocked}; my $keywords = delete $params->{keywords}; my $creation_comment = delete $params->{comment}; + my $see_also = delete $params->{see_also}; # We don't want the bug to appear in the system until it's correctly # protected by groups. @@ -715,6 +716,25 @@ sub create { } } + # Insert any see_also values + if ($see_also) { + my $see_also_array = $see_also; + if (!ref $see_also_array) { + $see_also = trim($see_also); + $see_also_array = [ split(/[\s,]+/, $see_also) ]; + } + foreach my $value (@$see_also_array) { + $bug->add_see_also($value); + } + foreach my $see_also (@{ $bug->see_also }) { + $see_also->insert_create_data($see_also); + } + foreach my $ref_bug (@{ $bug->{_update_ref_bugs} || [] }) { + $ref_bug->update(); + } + delete $bug->{_update_ref_bugs}; + } + # Comment #0 handling... # We now have a bug id so we can fill this out diff --git a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm index 7c6547de91b..09f6e1adc36 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm @@ -717,7 +717,8 @@ sub create { $dbh->bz_commit_transaction(); - Bugzilla::BugMail::Send($bug->bug_id, { changer => $bug->reporter }); + $bug->send_changes(); + return { id => $self->type('int', $bug->bug_id) }; } diff --git a/mozilla/webtools/bugzilla/enter_bug.cgi b/mozilla/webtools/bugzilla/enter_bug.cgi index da80e9d15b1..93997e665d0 100755 --- a/mozilla/webtools/bugzilla/enter_bug.cgi +++ b/mozilla/webtools/bugzilla/enter_bug.cgi @@ -262,6 +262,7 @@ else { $vars->{'blocked'} = formvalue('blocked'); $vars->{'deadline'} = formvalue('deadline'); $vars->{'estimated_time'} = formvalue('estimated_time'); + $vars->{'see_also'} = formvalue('see_also'); $vars->{'cc'} = join(', ', $cgi->param('cc')); diff --git a/mozilla/webtools/bugzilla/post_bug.cgi b/mozilla/webtools/bugzilla/post_bug.cgi index 24fa331b48d..782bb22939f 100755 --- a/mozilla/webtools/bugzilla/post_bug.cgi +++ b/mozilla/webtools/bugzilla/post_bug.cgi @@ -22,6 +22,8 @@ use Bugzilla::Hook; use Bugzilla::Token; use Bugzilla::Flag; +use List::MoreUtils qw(uniq); + my $user = Bugzilla->login(LOGIN_REQUIRED); my $cgi = Bugzilla->cgi; @@ -101,7 +103,7 @@ push(@bug_fields, qw( version target_milestone status_whiteboard - + see_also estimated_time deadline )); @@ -204,12 +206,21 @@ my $bug_sent = Bugzilla::BugMail::Send($id, $recipients); $bug_sent->{type} = 'created'; $bug_sent->{id} = $id; my @all_mail_results = ($bug_sent); + foreach my $dep (@{$bug->dependson || []}, @{$bug->blocked || []}) { my $dep_sent = Bugzilla::BugMail::Send($dep, $recipients); $dep_sent->{type} = 'dep'; $dep_sent->{id} = $dep; push(@all_mail_results, $dep_sent); } + +# Sending emails for any referenced bugs. +foreach my $ref_bug_id (uniq @{ $bug->{see_also_changes} || [] }) { + my $ref_sent = Bugzilla::BugMail::Send($ref_bug_id, $recipients); + $ref_sent->{id} = $ref_bug_id; + push(@all_mail_results, $ref_sent); +} + $vars->{sentmail} = \@all_mail_results; $format = $template->get_format("bug/create/created", diff --git a/mozilla/webtools/bugzilla/skins/standard/global.css b/mozilla/webtools/bugzilla/skins/standard/global.css index ab8a44f6093..13949edc4d5 100644 --- a/mozilla/webtools/bugzilla/skins/standard/global.css +++ b/mozilla/webtools/bugzilla/skins/standard/global.css @@ -638,7 +638,7 @@ input.required, select.required, span.required_explanation { } .bug_urls { - margin: 0 0 1em 0; + margin: 0; padding: 0; list-style-type: none; } diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl index 05f1396460a..d3f56d00c41 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/create/create.html.tmpl @@ -625,6 +625,15 @@ TUI_hide_default('attachment_text_field'); [% END %] + + + [% INCLUDE bug/field.html.tmpl + bug = default + field = bug_fields.see_also + editable = 1 + value = see_also + %] + diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl index f8612eebbf6..b3b92e19828 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl @@ -167,32 +167,33 @@ true); [% CASE constants.FIELD_TYPE_BUG_URLS %] - [% '' IF value.size %] - [% IF Param('use_see_also') %] (add)
-
+ class="text_input" name="[% field.name FILTER html %]" + [% IF !bug.id %]value="[% value FILTER html %]"[% END %]>
- + + [% END %] [% END %] [% CASE constants.FIELD_TYPE_KEYWORDS %]