don't show notifications from self

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
Michele Balistreri 2021-08-26 14:15:30 +03:00
parent a818dd4a2a
commit fea2b9a9af
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
1 changed files with 7 additions and 4 deletions

View File

@ -94,11 +94,14 @@
:message description}))
(defn show-message-pn?
[{{:keys [app-state]} :db :as cofx}
[{{:keys [app-state multiaccount]} :db :as cofx}
notification]
(let [chat-id (get-in notification [:body :chat :id])]
(or (= app-state "background")
(not (chat.models/foreground-chat? cofx chat-id)))))
(let [chat-id (get-in notification [:body :chat :id])
notification-author (get-in notification [:notificationAuthor :id])]
(and
(not= notification-author (:public-key multiaccount))
(or (= app-state "background")
(not (chat.models/foreground-chat? cofx chat-id))))))
(defn create-notification
([notification]