[polari] chatView: Use more unique notification IDs



commit 9ea9dbda609443ea164f00319e25e4bcaabb3573
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jul 31 04:18:14 2016 +0200

    chatView: Use more unique notification IDs
    
    How did this go unnoticed all the time? Notification IDs that are
    used to withdraw notifications are unique within the application,
    while messages' pending IDs are only unique in the scope of the
    channel. Update the ID to include the room identifier to stop
    replacing notifications from other rooms.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769355

 src/chatView.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index ccb4d96..eadc083 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -707,6 +707,10 @@ const ChatView = new Lang.Class({
             }));
     },
 
+    _getNotificationID: function(id) {
+        return 'pending-message-%s-%d'.format(this._room.id, id);
+    },
+
     _pendingMessageRemoved: function(channel, message) {
         let [id,] = message.get_pending_message_id();
         let mark = this._pending.get(id);
@@ -716,7 +720,7 @@ const ChatView = new Lang.Class({
         if (this._view.buffer.get_iter_at_mark(mark).is_end())
             this._autoscroll = true;
         this._view.buffer.delete_mark(mark);
-        this._app.withdraw_notification('pending-message-' + id);
+        this._app.withdraw_notification(this._getNotificationID(id));
         this._pending.delete(id);
     },
 
@@ -1225,7 +1229,7 @@ const ChatView = new Lang.Class({
                                            this._room.channel_name,
                                            Utils.getTpEventTime() ]);
             notification.set_default_action_and_target('app.join-room', param);
-            this._app.send_notification('pending-message-' + message.pendingId,
+            this._app.send_notification(this._getNotificationID(message.pendingId),
                                         notification);
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]