Skip to content

Commit

Permalink
Use Discourse.getURL for /clicks/track so clicks can be tracked on re…
Browse files Browse the repository at this point in the history
…lative URLs (#8079)
  • Loading branch information
qrush authored and featheredtoast committed Sep 10, 2019
1 parent 39a427e commit 21c11c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/discourse/lib/ajax.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,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) => {
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/discourse/lib/click-track.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 21c11c2

Please sign in to comment.