FIX: Allow opening FAQ in a new tab (#10039)

FIX: Allow opening FAQ in a new tab (#10039)

diff --git a/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js b/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js
index 669d759..8f24468 100644
--- a/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js
+++ b/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js
@@ -6,6 +6,7 @@ import { h } from "virtual-dom";
 import DiscourseURL from "discourse/lib/url";
 import { ajax } from "discourse/lib/ajax";
 import { userPath } from "discourse/lib/url";
+import { wantsNewWindow } from "discourse/lib/intercept-click";
 import { NotificationLevels } from "discourse/lib/notification-levels";
 
 const flatten = array => [].concat.apply([], array);
@@ -26,14 +27,24 @@ createWidget("priority-faq-link", {
   },
 
   click(e) {
-    e.preventDefault();
     if (this.siteSettings.faq_url === this.attrs.href) {
       ajax(userPath("read-faq"), { type: "POST" }).then(() => {
         this.currentUser.set("read_faq", true);
-        DiscourseURL.routeToTag($(e.target).closest("a")[0]);
+
+        if (wantsNewWindow(e)) {
+          return;
+        }
+
+        e.preventDefault();
+        DiscourseURL.routeTo(this.attrs.href);
       });
     } else {
-      DiscourseURL.routeToTag($(e.target).closest("a")[0]);
+      if (wantsNewWindow(e)) {
+        return;
+      }
+
+      e.preventDefault();
+      DiscourseURL.routeTo(this.attrs.href);
     }
   }
 });
@@ -267,12 +278,7 @@ export default createWidget("hamburger-menu", {
   panelContents() {
     const { currentUser } = this;
     const results = [];
-
-    let faqUrl = this.siteSettings.faq_url;
-    if (!faqUrl || faqUrl.length === 0) {
-      faqUrl = getURL("/faq");
-    }
-
+    const faqUrl = this.siteSettings.faq_url || getURL("/faq");
     const prioritizeFaq =
       this.settings.showFAQ && this.currentUser && !this.currentUser.read_faq;
 

GitHub sha: df0e3b4e

This commit appears in #10039 which was approved by eviltrout. It was merged by CvX.