Clear notification when the last one is removed
Previously, we switched to not updating the notification popup on a removal, since this usually respawns a new notification popup unexpectedly. However, when the last relevant notification is cleared (ie, by opening/reading the thread before the notification times out and disappears on its own) we should clear the existing popup if there is one. // FREEBIE
This commit is contained in:
parent
1f897f32b7
commit
f7191ad9de
1 changed files with 7 additions and 5 deletions
|
@ -15,6 +15,7 @@
|
|||
Whisper.Notifications = new (Backbone.Collection.extend({
|
||||
initialize: function() {
|
||||
this.on('add', this.onAdd);
|
||||
this.on('remove', this.onRemove);
|
||||
},
|
||||
onclick: function() {
|
||||
var last = this.last();
|
||||
|
@ -29,11 +30,6 @@
|
|||
this.clear();
|
||||
},
|
||||
update: function() {
|
||||
if (this.length === 0) {
|
||||
extension.notification.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
var setting = storage.get('notification-setting') || 'message';
|
||||
if (setting === SETTINGS.OFF) {
|
||||
return;
|
||||
|
@ -124,6 +120,12 @@
|
|||
extension.notification.clear();
|
||||
this.update();
|
||||
},
|
||||
onRemove: function() {
|
||||
if (this.length === 0) {
|
||||
extension.notification.clear();
|
||||
return;
|
||||
}
|
||||
},
|
||||
clear: function() {
|
||||
this.reset([]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue