fix: hide indicator on seen event instead of dropdown hide
This commit is contained in:
parent
eb12a00364
commit
dd82f5d815
2 changed files with 7 additions and 3 deletions
|
|
@ -94,3 +94,4 @@ def mark_as_seen(docnames):
|
|||
if docnames:
|
||||
filters = {'name': ['in', docnames]}
|
||||
frappe.db.set_value('Notification Log', filters, 'seen', 1, update_modified=False)
|
||||
frappe.publish_realtime('seen_notification', after_commit=True, user=frappe.session.user)
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ frappe.ui.Notifications = class Notifications {
|
|||
}
|
||||
|
||||
bind_events() {
|
||||
this.setup_notification_listener();
|
||||
this.setup_notification_listeners();
|
||||
this.setup_dropdown_events();
|
||||
|
||||
this.$dropdown_list.on('click', '.recent-item', () => {
|
||||
|
|
@ -391,11 +391,15 @@ frappe.ui.Notifications = class Notifications {
|
|||
});
|
||||
}
|
||||
|
||||
setup_notification_listener() {
|
||||
setup_notification_listeners() {
|
||||
frappe.realtime.on('notification', () => {
|
||||
this.$dropdown.find('.notifications-indicator').show();
|
||||
this.update_dropdown();
|
||||
});
|
||||
|
||||
frappe.realtime.on('seen_notification', () => {
|
||||
this.$dropdown.find('.notifications-indicator').hide();
|
||||
});
|
||||
}
|
||||
|
||||
setup_dropdown_events() {
|
||||
|
|
@ -407,7 +411,6 @@ frappe.ui.Notifications = class Notifications {
|
|||
toggle: false
|
||||
});
|
||||
this.$dropdown.on('hide.bs.dropdown', e => {
|
||||
this.$notification_indicator.hide();
|
||||
let hide = $(e.currentTarget).data('closable');
|
||||
if (hide) {
|
||||
this.$dropdown_list
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue