diff --git a/crm/api/notifications.py b/crm/api/notifications.py
index 2067b8f0c..afe495dbf 100644
--- a/crm/api/notifications.py
+++ b/crm/api/notifications.py
@@ -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,
@@ -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
\ No newline at end of file
diff --git a/frontend/src/components/Activities/Activities.vue b/frontend/src/components/Activities/Activities.vue
index 58a67cae8..f8cf5fe17 100644
--- a/frontend/src/components/Activities/Activities.vue
+++ b/frontend/src/components/Activities/Activities.vue
@@ -720,6 +720,7 @@ watch([reload, reload_email], ([reload_value, reload_email_value]) => {
})
function scroll(hash) {
+ if (['tasks', 'notes'].includes(route.hash?.slice(1))) return
setTimeout(() => {
let el
if (!hash) {
diff --git a/frontend/src/components/Activities/AllModals.vue b/frontend/src/components/Activities/AllModals.vue
index b8b4a2c48..1217b0390 100644
--- a/frontend/src/components/Activities/AllModals.vue
+++ b/frontend/src/components/Activities/AllModals.vue
@@ -5,6 +5,7 @@
:task="task"
:doctype="doctype"
:doc="doc.data?.name"
+ @after="redirect('tasks')"
/>