]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1556727 - Replace “Email sent to” message with a toast notification
authorKohei Yoshino <kohei.yoshino@gmail.com>
Fri, 7 Feb 2020 20:59:09 +0000 (15:59 -0500)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2020 20:59:09 +0000 (15:59 -0500)
Bugzilla/Test/Selenium.pm
extensions/BugModal/template/en/default/bug/show-modal.html.tmpl
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
extensions/BugModal/web/bug_modal.css
extensions/BugModal/web/bug_modal.js
qa/t/test_bmo_autolinkification.t
qa/t/test_flags.t
qa/t/test_time_summary.t
template/en/default/bug/process/attachment-results.html.tmpl
template/en/default/bug/process/bugmail.html.tmpl
template/en/default/bug/process/results.html.tmpl

index 2a303f20031e9473d701b57fd1769f7812b57340..da658f10704800ddc8f729ecb7b52327a088f407 100644 (file)
@@ -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;
   }
index 036d1ff149096dee44939e887438cc650199a81e..5664921c2d5112bd0368461f71706c7618cac886 100644 (file)
   [% 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
      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") %]
      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 %]
index 4464cd8789762590e4621a73cf7819263f64ce57..cc2aeca376da0276d570f9912aa646c779518e6a 100644 (file)
 
 <div role="status" id="io-error" style="display:none"></div>
 <div role="status" id="floating-message" style="display:none">
-  <div id="floating-message-text"></div>
+  <div id="floating-message-text">[% change_short_summary FILTER html %]</div>
 </div>
 
 [% WRAPPER bug_modal/module.html.tmpl
index 50ac9325229e48a4b105c99e6b8c10ffdc2a8f8e..77dff1578ca95cf40334e0a0410ff434a5a6fdc2 100644 (file)
@@ -1278,6 +1278,14 @@ a.lightbox-icon.markdown {
   width: 235px;
 }
 
+/**
+ * verbose change summary
+ */
+
+.change-summary {
+  display: none;
+}
+
 /**
  * search navigation
  */
index b9a6d38bfb6ef7c216cc0ca4f3548955610a6039..c2136d5ff33f36c88e8b9750d29ab1bbb59a532d 100644 (file)
@@ -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) {
index ee947f563aae0b468d4b3f6e3d0068211e92d64e..29b6f3862d89fc87442166e8357f4ce66726951e 100644 (file)
@@ -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');
 
index 62a86d9836d7bb11092823f1dda19d55e203a3b1..5504aff46c749d942d7e92d0ffc41c77bcf8308e 100644 (file)
@@ -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});
index fc7349206cdc03c5558e16d85beb393962af6399..bb6b261a22fc2b3e1c0e0e0e0eebf5e8799d2a30 100644 (file)
@@ -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");
index 8dd793665527ac2ae3f1391f74268ac600ba8217..3463b78cfaba3450f7abed448c3d1945af89f514 100644 (file)
@@ -30,7 +30,7 @@
 
 [% PROCESS global/variables.none.tmpl %]
 
-<dl>
+<dl class="change-summary attachment">
   <dt>
     [% IF type == 'created' %]
         <a title="[% attachment.description FILTER html %]"
@@ -62,7 +62,7 @@
   </dd>
 </dl>
 
-<p>
+<p class="change-summary attachment extra">
 <a href="[% basepath FILTER none %]attachment.cgi?bugid=[% attachment.bug_id FILTER none %]&amp;action=enter">Create
  Another Attachment to [% terms.Bug %] [%+ attachment.bug_id FILTER none %]</a>
 </p>
index 5f32bae10fdca237c2ad7ca4925052eaaa6b28df..f0cabae9739f4fda2352416e7882877d7b120da3 100644 (file)
 [% USE Bugzilla %]
 [% PROCESS global/variables.none.tmpl %]
 
-<div id="bugmail_summary_[% mailing_bugid FILTER none %]_short">
-  [% IF recipient_count > 0 %]
-    Email sent to [% recipient_count FILTER html %] recipient[% 's' UNLESS recipient_count == 1 %].
-  [% ELSE %]
-    No emails were sent.
-  [% END %]
-</div>
+[% 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 %]
index c62a7a597213acd46e2ef173040fa59b79810d67..f43a5e5b64cca36e6aa63131fc7f73bc5c4f472e 100644 (file)
@@ -49,7 +49,7 @@
 
 [% Hook.process('title') %]
 
-<dl>
+<dl class="change-summary bug">
   <dt>[% title.$type %]</dt>
   <dd>
     [% PROCESS "bug/process/bugmail.html.tmpl" mailing_bugid = id %]