Use Discourse.getURL for /clicks/track so clicks can be tracked on relative URLs (#8079)

This commit is contained in:
Nick Quaranto 2019-09-09 03:41:37 -04:00 committed by Jeff Wong
parent 39a427efce
commit 21c11c2bb2
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ export function ajax() {
if ( if (
args.type && args.type &&
args.type.toUpperCase() !== "GET" && args.type.toUpperCase() !== "GET" &&
url !== "/clicks/track" && url !== Discourse.getURL("/clicks/track") &&
!Discourse.Session.currentProp("csrfToken") !Discourse.Session.currentProp("csrfToken")
) { ) {
promise = new Ember.RSVP.Promise((resolve, reject) => { promise = new Ember.RSVP.Promise((resolve, reject) => {

View File

@ -102,9 +102,9 @@ export default {
data.append("url", href); data.append("url", href);
data.append("post_id", postId); data.append("post_id", postId);
data.append("topic_id", topicId); data.append("topic_id", topicId);
navigator.sendBeacon("/clicks/track", data); navigator.sendBeacon(Discourse.getURL("/clicks/track"), data);
} else { } else {
trackPromise = ajax("/clicks/track", { trackPromise = ajax(Discourse.getURL("/clicks/track"), {
type: "POST", type: "POST",
data: { data: {
url: href, url: href,