[polari] telepathyClient: Show notifications for pending messages



commit 98f2c2c7dee68ac9ba06beb1144b49bdc82d334c
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jul 3 14:39:28 2022 +0200

    telepathyClient: Show notifications for pending messages
    
    If a private conversation is initiated by another user, the channel
    is created in response to a message. That is, the message was received
    before the channel existed and is already pending. And as we only
    process notifications when receiving a message, we will never show
    a notification in that case.
    
    Fix that by explicitly processing pending messages when observing
    a new channel.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/254>

 src/telepathyClient.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 6c6cb29e..6f94e958 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -601,12 +601,15 @@ class TelepathyClient extends Tp.BaseClient {
                     return;
             }
 
+            this._roomManager.ensureRoomForChannel(channel, false);
+
             channel.connect('message-received',
                 this._onMessageReceived.bind(this));
             channel.connect('pending-message-removed',
                 this._onPendingMessageRemoved.bind(this));
 
-            this._roomManager.ensureRoomForChannel(channel, false);
+            channel.dup_pending_messages().forEach(
+                m => this._onMessageReceived(channel, m));
         });
     }
 


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