From: Kohei Yoshino Date: Fri, 7 Feb 2020 20:59:09 +0000 (-0500) Subject: Bug 1556727 - Replace “Email sent to” message with a toast notification X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=102e4c43c83ab738a54c490d61b77352473a8b04;p=thirdparty%2Fbugzilla.git Bug 1556727 - Replace “Email sent to” message with a toast notification --- diff --git a/Bugzilla/Test/Selenium.pm b/Bugzilla/Test/Selenium.pm index 2a303f200..da658f107 100644 --- a/Bugzilla/Test/Selenium.pm +++ b/Bugzilla/Test/Selenium.pm @@ -91,7 +91,9 @@ sub is_text_present { my ($self, $text) = @_; TRACE("is_text_present: $text"); return 0 unless $text; - my $body = $self->driver->get_body(); + # Execute script directly because `get_body()` doesn't contain hidden text + my $body = $self->driver->execute_script( + "return document.body.textContent.replace(/\\s+/g, ' ')"); if ($text =~ /^regexp:(.*)$/) { return $body =~ /$1/ ? 1 : 0; } diff --git a/extensions/BugModal/template/en/default/bug/show-modal.html.tmpl b/extensions/BugModal/template/en/default/bug/show-modal.html.tmpl index 036d1ff14..5664921c2 100644 --- a/extensions/BugModal/template/en/default/bug/show-modal.html.tmpl +++ b/extensions/BugModal/template/en/default/bug/show-modal.html.tmpl @@ -13,7 +13,10 @@ [% header_done = 1 %] [% END %] -[%# Display changes to bugs that happened in the last request #%] +[%# Display a short summary of the change when a bug or attachment is created or updated. + # The user will see a toast notification, and verbose messages are hidden by default. #%] +[% change_short_summary = '' %] + [% sentmail = c.flash("last_sent_changes") %] [% FOREACH item = sentmail %] [% INCLUDE bug/process/results.html.tmpl @@ -21,6 +24,16 @@ type = item.type recipient_count = item.recipient_count %] + [% IF loop.first %] + [% change_short_summary = BLOCK %] + [% IF item.type == 'created' %] + [% terms.Bug %] created. + [% ELSE %] + Changes submitted. + [% END %] + [%+ PROCESS "bug/process/bugmail.html.tmpl" recipient_count = item.recipient_count %] + [% END %] + [% END %] [% END %] [% sentattachmentmail = c.flash("last_sent_attachment_changes") %] @@ -31,6 +44,16 @@ recipient_count = item.recipient_count content_type_method = item.content_type_method %] + [% IF loop.first %] + [% change_short_summary = BLOCK %] + [% IF item.type == 'created' %] + Attachment created. + [% ELSE %] + Attachment updated. + [% END %] + [%+ PROCESS "bug/process/bugmail.html.tmpl" recipient_count = item.recipient_count %] + [% END %] + [% END %] [% END %] [% INCLUDE bug_modal/edit.html.tmpl %] diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index 4464cd878..cc2aeca37 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -251,7 +251,7 @@ [% WRAPPER bug_modal/module.html.tmpl diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index 50ac93252..77dff1578 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -1278,6 +1278,14 @@ a.lightbox-icon.markdown { width: 235px; } +/** + * verbose change summary + */ + +.change-summary { + display: none; +} + /** * search navigation */ diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index b9a6d38bf..c2136d5ff 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -206,6 +206,11 @@ $(function() { $.scrollTo($('#bottom-actions')); }); + // show floating message after creating/updating a bug/attachment + if ($('#floating-message-text').text()) { + $('#floating-message').fadeIn(250).delay(4000).fadeOut(); + } + // hide floating message when clicked $('#floating-message') .click(function(event) { diff --git a/qa/t/test_bmo_autolinkification.t b/qa/t/test_bmo_autolinkification.t index ee947f563..29b6f3862 100644 --- a/qa/t/test_bmo_autolinkification.t +++ b/qa/t/test_bmo_autolinkification.t @@ -29,8 +29,7 @@ $sel->type_ok("comment", "bp-63f096f7-253b-4ee2-ae3d-8bb782090824"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "crash report added"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); +go_to_bug($sel, $bug_id); attribute_is($sel, 'bp-63f096f7-253b-4ee2-ae3d-8bb782090824', 'https://crash-stats.mozilla.org/report/index/63f096f7-253b-4ee2-ae3d-8bb782090824' ); @@ -39,9 +38,7 @@ $sel->type_ok("comment", "CVE-2010-2884"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "cve added"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); - +go_to_bug($sel, $bug_id); attribute_is($sel, 'CVE-2010-2884', 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2884'); @@ -49,9 +46,7 @@ $sel->type_ok("comment", "r12345"); $sel->click_ok("bottom-save-btn"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/\d+ \S $bug_summary/, "svn revision added"); -$sel->click_ok("link=bug $bug_id"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); - +go_to_bug($sel, $bug_id); attribute_is($sel, 'r12345', 'https://viewvc.svn.mozilla.org/vc?view=rev&revision=12345'); diff --git a/qa/t/test_flags.t b/qa/t/test_flags.t index 62a86d983..5504aff46 100644 --- a/qa/t/test_flags.t +++ b/qa/t/test_flags.t @@ -385,8 +385,7 @@ my $attachment1_id = $1; # Now create another attachment, and set requestees. -$sel->click_ok( - "//a[contains(text(),'Create\n Another Attachment to Bug $bug1_id')]"); +$sel->click_ok("link=Attach File"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); @@ -413,8 +412,7 @@ my $attachment2_id = $1; # Create a third attachment, but we now set the MIME type manually. -$sel->click_ok( - "//a[contains(text(),'Create\n Another Attachment to Bug $bug1_id')]"); +$sel->click_ok("link=Attach File"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create New Attachment for Bug #$bug1_id"); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); diff --git a/qa/t/test_time_summary.t b/qa/t/test_time_summary.t index fc7349206..bb6b261a2 100644 --- a/qa/t/test_time_summary.t +++ b/qa/t/test_time_summary.t @@ -39,8 +39,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok("Changes submitted for bug $test_bug_1"); # Make sure the correct bug is redisplayed. -$sel->click_ok("link=bug $test_bug_1"); -$sel->wait_for_page_to_load_ok(WAIT_TIME); +go_to_bug($sel, $test_bug_1); $sel->title_like(qr/^$test_bug_1/, "Display bug $test_bug_1"); $sel->is_text_present_ok("I did some work"); $sel->is_text_present_ok("Hours Worked: 2.6"); diff --git a/template/en/default/bug/process/attachment-results.html.tmpl b/template/en/default/bug/process/attachment-results.html.tmpl index 8dd793665..3463b78cf 100644 --- a/template/en/default/bug/process/attachment-results.html.tmpl +++ b/template/en/default/bug/process/attachment-results.html.tmpl @@ -30,7 +30,7 @@ [% PROCESS global/variables.none.tmpl %] -
+
[% IF type == 'created' %]
-

+

Create Another Attachment to [% terms.Bug %] [%+ attachment.bug_id FILTER none %]

diff --git a/template/en/default/bug/process/bugmail.html.tmpl b/template/en/default/bug/process/bugmail.html.tmpl index 5f32bae10..f0cabae97 100644 --- a/template/en/default/bug/process/bugmail.html.tmpl +++ b/template/en/default/bug/process/bugmail.html.tmpl @@ -27,10 +27,10 @@ [% USE Bugzilla %] [% PROCESS global/variables.none.tmpl %] -
- [% IF recipient_count > 0 %] - Email sent to [% recipient_count FILTER html %] recipient[% 's' UNLESS recipient_count == 1 %]. - [% ELSE %] - No emails were sent. - [% END %] -
+[% IF recipient_count > 1 %] + Email sent to [% recipient_count FILTER none %] recipients. +[% ELSIF recipient_count == 1 %] + Email sent to 1 recipient. +[% ELSE %] + No emails sent. +[% END %] diff --git a/template/en/default/bug/process/results.html.tmpl b/template/en/default/bug/process/results.html.tmpl index c62a7a597..f43a5e5b6 100644 --- a/template/en/default/bug/process/results.html.tmpl +++ b/template/en/default/bug/process/results.html.tmpl @@ -49,7 +49,7 @@ [% Hook.process('title') %] -
+
[% title.$type %]
[% PROCESS "bug/process/bugmail.html.tmpl" mailing_bugid = id %]