[polari] telepathyClient: Change notification title for private chats



commit ceb7642338abc87696348a3c173e7b63443c63c0
Author: Daronion <stefanosdimos 98 gmail com>
Date:   Tue Apr 2 20:38:43 2019 +0300

    telepathyClient: Change notification title for private chats
    
    The notification title made sense for normal rooms, but it is weird
    for private chats since nick and room.display_name are the same.
    (Example: Daronion in daronion)
    This change makes it so that the titles is set to the sender's nickname
    only for private rooms.
    
    https://gitlab.gnome.org/GNOME/polari/issues/18

 src/telepathyClient.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 9cc1267..3646646 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -666,9 +666,16 @@ class TelepathyClient extends Tp.BaseClient {
         if (this._shellHandlesPrivateChats && room.type == Tp.HandleType.CONTACT)
             return;
 
-        /* Translators: This is the title of the notification announcing a newly
-          received message, in the form "user-nickname in room-display-name" */
-        let summary = _('%s in %s').format(nick, room.display_name);
+        let summary;
+
+        if (room.type == Tp.HandleType.CONTACT) {
+            summary = '%s'.format(nick);
+        } else {
+            /* Translators: This is the title of the notification announcing a newly
+               received message, in the form "user-nickname in room-display-name" */
+            summary = _('%s in %s').format(nick, room.display_name);
+        }
+
         let notification = this._createNotification(room, summary, text);
         this._app.send_notification(this._getPendingNotificationID(room, id), notification);
     }


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