FIX: Read FAQ wasn't working with a URL on the same site

This commit is contained in:
Robin Ward 2016-08-12 13:47:19 -04:00
parent 11939fa8b9
commit 86c970bac0

View File

@ -4,7 +4,7 @@ import DiscourseURL from 'discourse/lib/url';
import { ajax } from 'discourse/lib/ajax';
createWidget('priority-faq-link', {
tagName: 'a.faq-priority',
tagName: 'a.faq-priority.widget-link',
buildAttributes(attrs) {
return { href: attrs.href };
@ -15,12 +15,14 @@ createWidget('priority-faq-link', {
},
click(e) {
e.preventDefault();
if (this.siteSettings.faq_url === this.attrs.href) {
e.preventDefault();
ajax("/users/read-faq", { method: "POST" }).then(() => {
this.currentUser.set('read_faq', true);
return DiscourseURL.routeToTag($(e.target).closest('a')[0]);
DiscourseURL.routeToTag($(e.target).closest('a')[0]);
});
} else {
DiscourseURL.routeToTag($(e.target).closest('a')[0]);
}
}
});