Fix mention message

This commit is contained in:
Suraj Shetty 2019-03-11 22:04:08 +05:30
parent 9eadc918f0
commit a9739c453b
2 changed files with 6 additions and 4 deletions

View file

@ -15,9 +15,6 @@ class Post(Document):
frappe.publish_realtime('global_pin', after_commit=True)
def after_insert(self):
mentions = extract_mentions(self.content)
for mention in mentions:
frappe.publish_realtime('mention', "Someone mentioned you", user=mention, after_commit=True)
frappe.publish_realtime('new_post', self.owner, after_commit=True)
@frappe.whitelist()

View file

@ -11,5 +11,10 @@ class PostComment(Document):
def after_insert(self):
mentions = extract_mentions(self.content)
for mention in mentions:
frappe.publish_realtime('mention', "Someone mentioned you", user=mention, after_commit=True)
if mention == self.owner: continue
frappe.publish_realtime('mention', """{} mentioned you!
<br><a class="text-muted text-small" href="desk#social/home">Check Social<a>"""
.format(frappe.utils.get_fullname(self.owner)),
user=mention,
after_commit=True)
frappe.publish_realtime('new_post_comment' + self.parent, self, after_commit=True)