From 88a08fdfecff07015bbc2141d16cd384fa65cef5 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 2 Oct 2018 13:52:39 +0530 Subject: [PATCH] Add "pin post" feature --- .../js/frappe/social/components/Post.vue | 12 ++- .../frappe/social/components/PostAction.vue | 16 +++- .../public/js/frappe/social/pages/Profile.vue | 2 +- frappe/public/js/frappe/social/pages/Wall.vue | 23 +++-- frappe/social/doctype/post/post.json | 91 ++++++++++++++++++- frappe/social/doctype/post/post.py | 4 + 6 files changed, 138 insertions(+), 10 deletions(-) diff --git a/frappe/public/js/frappe/social/components/Post.vue b/frappe/public/js/frappe/social/components/Post.vue index ae3f2fd143..df964fb3a1 100644 --- a/frappe/public/js/frappe/social/components/Post.vue +++ b/frappe/public/js/frappe/social/components/Post.vue @@ -7,12 +7,15 @@
{ this.replies.push(post); }) + frappe.realtime.on('toggle_pin' + this.post.name, (is_pinned) => { + this.post.is_pinned = cint(is_pinned); + }) frappe.realtime.on('update_liked_by' + this.post.name, this.update_liked_by) }, methods: { @@ -91,6 +98,9 @@ const Post = { frappe.xcall('frappe.social.doctype.post.post.toggle_like', { post_name: this.post.name, }) + }, + toggle_pin() { + frappe.db.set_value('Post', this.post.name, 'is_pinned', cint(!this.post.is_pinned)) } } } diff --git a/frappe/public/js/frappe/social/components/PostAction.vue b/frappe/public/js/frappe/social/components/PostAction.vue index 8b7a37d3e9..877a085ba3 100644 --- a/frappe/public/js/frappe/social/components/PostAction.vue +++ b/frappe/public/js/frappe/social/components/PostAction.vue @@ -1,5 +1,8 @@