FIX: Persist notifications in OS X (#14843)

FIX: Persist notifications in OS X (#14843)

We were previously triggering the close event, which in OSX meant that notifications would disappear from Notification Center.

diff --git a/app/assets/javascripts/discourse/app/lib/desktop-notifications.js b/app/assets/javascripts/discourse/app/lib/desktop-notifications.js
index 313473d..4fb5c91 100644
--- a/app/assets/javascripts/discourse/app/lib/desktop-notifications.js
+++ b/app/assets/javascripts/discourse/app/lib/desktop-notifications.js
@@ -177,18 +177,10 @@ function onNotification(data, siteSettings, user) {
       tag: notificationTag,
     });
 
-    function clickEventHandler() {
+    notification.onclick = () => {
       DiscourseURL.routeTo(data.post_url);
-      // Cannot delay this until the page renders
-      // due to trigger-based permissions
-      window.focus();
-    }
-
-    notification.addEventListener("click", clickEventHandler);
-    later(() => {
       notification.close();
-      notification.removeEventListener("click", clickEventHandler);
-    }, 10 * 1000);
+    };
   });
 }
 

GitHub sha: e0ced68eec84f0e156d2614a9aba651ddab2cb5f

This commit appears in #14843 which was approved by CvX. It was merged by pmusaraj.