+
@@ -47,6 +47,7 @@ export default {
frappe.utils.scroll_to(0);
}
});
+ frappe.ui.setup_like_popover($(this.$refs.social), '.likes', false);
},
methods: {
set_current_page() {
diff --git a/frappe/public/js/frappe/social/components/Post.vue b/frappe/public/js/frappe/social/components/Post.vue
index 20e80e6474..9419713802 100644
--- a/frappe/public/js/frappe/social/components/Post.vue
+++ b/frappe/public/js/frappe/social/components/Post.vue
@@ -3,15 +3,14 @@
-
{{ user_name }}
+
{{ user_name }}
{
this.replies = replies;
})
+
+ if (!this.post.liked_by) {
+ this.$set(this.post, 'liked_by', '')
+ }
+
frappe.realtime.on('new_post_reply' + this.post.name, (post) => {
this.replies.push(post);
})
@@ -79,6 +75,7 @@ const Post = {
this.post.is_pinned = cint(is_pinned);
})
frappe.realtime.on('update_liked_by' + this.post.name, this.update_liked_by)
+
},
methods: {
goto_profile(user) {
@@ -91,15 +88,8 @@ const Post = {
toggle_reply() {
this.show_replies = !this.show_replies
},
- update_liked_by(user) {
- const liked_by = this.post.liked_by ? this.post.liked_by.split('\n') : []
- const user_index = liked_by.indexOf(user)
- if (user_index > -1) {
- liked_by.splice(user_index, 1);
- } else {
- liked_by.push(user);
- }
- this.post.liked_by = liked_by.join('\n')
+ update_liked_by(liked_by) {
+ this.post.liked_by = liked_by;
},
toggle_like() {
frappe.xcall('frappe.social.doctype.post.post.toggle_like', {
diff --git a/frappe/public/js/frappe/social/components/PostAction.vue b/frappe/public/js/frappe/social/components/PostAction.vue
index 877a085ba3..8856060602 100644
--- a/frappe/public/js/frappe/social/components/PostAction.vue
+++ b/frappe/public/js/frappe/social/components/PostAction.vue
@@ -7,27 +7,30 @@
{{ reply_count }}
-