mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 16:53:44 +08:00
Use Discourse.getURL for /clicks/track so clicks can be tracked on relative URLs (#8079)
This commit is contained in:
parent
39a427efce
commit
21c11c2bb2
|
@ -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) => {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user