cleanup: Use Array.includes() to check for element existence
We can use that newer method where we don't care about the actual position of an element inside the array. (Array.includes() and Array.indexOf() do behave differently in edge cases, for example in the handling of NaN, but those don't matter to us) https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/152
This commit is contained in:

committed by
Florian Müllner

parent
b87455c089
commit
f6b4b96737
@ -228,7 +228,7 @@ class NotificationApplicationPolicy extends NotificationPolicy {
|
||||
this._settings.set_string('application-id', this.id + '.desktop');
|
||||
|
||||
let apps = this._masterSettings.get_strv('application-children');
|
||||
if (apps.indexOf(this._canonicalId) < 0) {
|
||||
if (!apps.includes(this._canonicalId)) {
|
||||
apps.push(this._canonicalId);
|
||||
this._masterSettings.set_strv('application-children', apps);
|
||||
}
|
||||
@ -772,7 +772,7 @@ var Source = class Source {
|
||||
}
|
||||
|
||||
pushNotification(notification) {
|
||||
if (this.notifications.indexOf(notification) >= 0)
|
||||
if (this.notifications.includes(notification))
|
||||
return;
|
||||
|
||||
while (this.notifications.length >= MAX_NOTIFICATIONS_PER_SOURCE)
|
||||
@ -1069,7 +1069,7 @@ var MessageTray = class MessageTray {
|
||||
// If a new notification is updated while it is being hidden,
|
||||
// we stop hiding it and show it again.
|
||||
this._updateShowingNotification();
|
||||
} else if (this._notificationQueue.indexOf(notification) < 0) {
|
||||
} else if (!this._notificationQueue.includes(notification)) {
|
||||
// If the queue is "full", we skip banner mode and just show a small
|
||||
// indicator in the panel; however do make an exception for CRITICAL
|
||||
// notifications, as only banner mode allows expansion.
|
||||
|
Reference in New Issue
Block a user