Add more analytics events
The ability to track when likes and bookmarks are toggled
This commit is contained in:
parent
1aaddf13a0
commit
afe7429e7d
|
@ -316,7 +316,10 @@ const Post = RestModel.extend({
|
||||||
// need to wait to hear back from server (stuff may not be loaded)
|
// need to wait to hear back from server (stuff may not be loaded)
|
||||||
|
|
||||||
return Discourse.Post.updateBookmark(this.id, this.bookmarked)
|
return Discourse.Post.updateBookmark(this.id, this.bookmarked)
|
||||||
.then(result => this.set("topic.bookmarked", result.topic_bookmarked))
|
.then(result => {
|
||||||
|
this.set("topic.bookmarked", result.topic_bookmarked);
|
||||||
|
this.appEvents.trigger("page:bookmark-post-toggled", this);
|
||||||
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.toggleProperty("bookmarked");
|
this.toggleProperty("bookmarked");
|
||||||
if (bookmarkedTopic) {
|
if (bookmarkedTopic) {
|
||||||
|
|
|
@ -692,9 +692,10 @@ export default createWidget("post", {
|
||||||
const likeAction = post.get("likeAction");
|
const likeAction = post.get("likeAction");
|
||||||
|
|
||||||
if (likeAction && likeAction.get("canToggle")) {
|
if (likeAction && likeAction.get("canToggle")) {
|
||||||
return likeAction
|
return likeAction.togglePromise(post).then(result => {
|
||||||
.togglePromise(post)
|
this.appEvents.trigger("page:like-toggled", post, likeAction);
|
||||||
.then(result => this._warnIfClose(result));
|
return this._warnIfClose(result);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue