mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 00:06:04 +08:00
FIX: Allow opening FAQ in a new tab (#10039)
This commit is contained in:
parent
ce37561e10
commit
df0e3b4ed4
@ -6,6 +6,7 @@ import { h } from "virtual-dom";
|
|||||||
import DiscourseURL from "discourse/lib/url";
|
import DiscourseURL from "discourse/lib/url";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { userPath } from "discourse/lib/url";
|
import { userPath } from "discourse/lib/url";
|
||||||
|
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||||
|
|
||||||
const flatten = array => [].concat.apply([], array);
|
const flatten = array => [].concat.apply([], array);
|
||||||
@ -26,14 +27,24 @@ createWidget("priority-faq-link", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
e.preventDefault();
|
|
||||||
if (this.siteSettings.faq_url === this.attrs.href) {
|
if (this.siteSettings.faq_url === this.attrs.href) {
|
||||||
ajax(userPath("read-faq"), { type: "POST" }).then(() => {
|
ajax(userPath("read-faq"), { type: "POST" }).then(() => {
|
||||||
this.currentUser.set("read_faq", true);
|
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 {
|
} 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() {
|
panelContents() {
|
||||||
const { currentUser } = this;
|
const { currentUser } = this;
|
||||||
const results = [];
|
const results = [];
|
||||||
|
const faqUrl = this.siteSettings.faq_url || getURL("/faq");
|
||||||
let faqUrl = this.siteSettings.faq_url;
|
|
||||||
if (!faqUrl || faqUrl.length === 0) {
|
|
||||||
faqUrl = getURL("/faq");
|
|
||||||
}
|
|
||||||
|
|
||||||
const prioritizeFaq =
|
const prioritizeFaq =
|
||||||
this.settings.showFAQ && this.currentUser && !this.currentUser.read_faq;
|
this.settings.showFAQ && this.currentUser && !this.currentUser.read_faq;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user