Bug 1390042 - [Onboarding] The complete sign is not shown at first time when set the performance tour as the first item;r=rexboy draft
authorgasolin <gasolin@gmail.com>
Mon, 14 Aug 2017 15:38:35 +0800
changeset 645766 4b019700d1dadfebeebb74367f155754bc83efce
parent 645674 3bfcbdf5c6c381d5a8febb5c209e27a69fb89f9b
child 726019 d74b6ac8eafe04f9cd7a1cf077fdadaa7523c35f
push id73880
push userbmo:gasolin@mozilla.com
push dateMon, 14 Aug 2017 07:46:57 +0000
reviewersrexboy
bugs1390042
milestone57.0a1
Bug 1390042 - [Onboarding] The complete sign is not shown at first time when set the performance tour as the first item;r=rexboy MozReview-Commit-ID: AVv4pcBfTbf
browser/extensions/onboarding/content/onboarding.js
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -489,22 +489,16 @@ class Onboarding {
         this._removeTourFromNotificationQueue(this._notificationBar.dataset.targetTourId);
         break;
       case "onboarding-notification-action-btn":
         let tourId = this._notificationBar.dataset.targetTourId;
         this.toggleOverlay();
         this.gotoPage(tourId);
         this._removeTourFromNotificationQueue(tourId);
         break;
-      // These tours are tagged completed instantly upon showing.
-      case "onboarding-tour-default-browser":
-      case "onboarding-tour-sync":
-      case "onboarding-tour-performance":
-        this.setToursCompleted([ evt.target.id ]);
-        break;
     }
     let classList = evt.target.classList;
     if (classList.contains("onboarding-tour-item")) {
       this.gotoPage(evt.target.id);
     } else if (classList.contains("onboarding-tour-action-button")) {
       let activeItem = this._tourItems.find(item => item.classList.contains("onboarding-active"));
       this.setToursCompleted([ activeItem.id ]);
     }
@@ -554,16 +548,25 @@ class Onboarding {
     }
     for (let li of this._tourItems) {
       if (li.id == tourId) {
         li.classList.add("onboarding-active");
       } else {
         li.classList.remove("onboarding-active");
       }
     }
+
+    switch (tourId) {
+      // These tours should tagged completed instantly upon showing.
+      case "onboarding-tour-default-browser":
+      case "onboarding-tour-sync":
+      case "onboarding-tour-performance":
+        this.setToursCompleted([tourId]);
+        break;
+    }
   }
 
   isTourCompleted(tourId) {
     return Services.prefs.getBoolPref(`browser.onboarding.tour.${tourId}.completed`, false);
   }
 
   setToursCompleted(tourIds) {
     let params = [];