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 Sam
parent 1d73754e84
commit 530356f465
2 changed files with 3 additions and 3 deletions

View File

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

View File

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