Skip to content

Commit

Permalink
fix: redirect to specific comment or tab on click
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 30, 2024
1 parent 674bb28 commit cd4b87a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
16 changes: 15 additions & 1 deletion crm/api/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_notifications():
"type": notification.type,
"to_user": notification.to_user,
"read": notification.read,
"comment": notification.comment,
"hash": get_hash(notification),
"notification_text": notification.notification_text,
"notification_type_doctype": notification.notification_type_doctype,
"notification_type_doc": notification.notification_type_doc,
Expand Down Expand Up @@ -58,3 +58,17 @@ def mark_as_read(user=None, doc=None):
d = frappe.get_doc("CRM Notification", n.name)
d.read = True
d.save()

def get_hash(notification):
_hash = ""
if notification.type == "Mention" and notification.notification_type_doc:
_hash = "#" + notification.notification_type_doc

if notification.type == "WhatsApp":
_hash = "#whatsapp"

if notification.type == "Assignment" and notification.notification_type_doctype == "CRM Task":
_hash = "#tasks"
if "has been removed by" in notification.message:
_hash = ""
return _hash
3 changes: 2 additions & 1 deletion frontend/src/components/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ function getRoute(notification) {
dealId: notification.reference_name,
}
}
return {
name: notification.route_name,
params: params,
hash: '#' + notification.comment || notification.notification_type_doc,
hash: notification.hash,
}
}
Expand Down

0 comments on commit cd4b87a

Please sign in to comment.