[polari] telepathyClient: Don't show notifications from muted nicks



commit ada4a4805b2bf3b89d147fa5d731753b45c02453
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Apr 20 03:22:27 2019 +0200

    telepathyClient: Don't show notifications from muted nicks
    
    This is the main annoyance for bots (and tech-savy in-laws), and the
    main driver for adding a muting capability, so it's the natural
    starting point for supporting the new property.
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/153

 src/telepathyClient.js | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 3adbf2a3..de954ce5 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -4,6 +4,7 @@ const { Gio, GLib, GObject, Polari, TelepathyGLib: Tp } = imports.gi;
 
 const { AccountsMonitor } = imports.accountsMonitor;
 const { RoomManager } = imports.roomManager;
+const { UserStatusMonitor } = imports.userTracker;
 const Utils = imports.utils;
 
 const SHELL_CLIENT_PREFIX = 'org.freedesktop.Telepathy.Client.GnomeShell';
@@ -136,6 +137,8 @@ class TelepathyClient extends Tp.BaseClient {
         this._accountsMonitor = AccountsMonitor.getDefault();
         this._accountsMonitor.prepare(this._onPrepared.bind(this));
 
+        this._userStatusMonitor = UserStatusMonitor.getDefault();
+
         this._shellHandlesPrivateChats = false;
         this._monitorShellClient();
     }
@@ -676,6 +679,10 @@ class TelepathyClient extends Tp.BaseClient {
         if (this._shellHandlesPrivateChats && room.type === Tp.HandleType.CONTACT)
             return;
 
+        const tracker = this._userStatusMonitor.getUserTrackerForAccount(room.account);
+        if (tracker.isMuted(msg.sender.identifier))
+            return;
+
         let summary;
 
         if (room.type === Tp.HandleType.CONTACT) {


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