participant removed from chat

Former-commit-id: 2da99899cc
This commit is contained in:
michaelr 2016-04-11 19:44:02 +03:00
parent d0b8b20ca9
commit 16bf960e3c
3 changed files with 17 additions and 3 deletions

BIN
images/trash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -136,6 +136,14 @@
:content (str (or inviter-name from) " invited " (or invitee-name identity))
:content-type text-content-type})))
(defn participant-removed-from-group-msg [chat-id identity from msg-id]
(let [remover-name (:name (contacts/contact-by-identity from))
removed-name (:name (contacts/contact-by-identity identity))]
(save-message chat-id {:from "system"
:msg-id msg-id
:content (str (or remover-name from) " removed " (or removed-name identity))
:content-type text-content-type})))
(defn removed-participant-msg [chat-id identity]
(let [contact-name (:name (contacts/contact-by-identity identity))]
(save-message chat-id {:from "system"
@ -149,6 +157,13 @@
(joined-chat-msg group-id from ack-msg-id)
(signal-chat-updated db group-id)))
(register-handler :participant-removed-from-group
(fn [db [action from group-id identity msg-id]]
(log/debug action msg-id from group-id identity)
(chat-remove-participants group-id [identity])
(participant-removed-from-group-msg group-id identity from msg-id)
(signal-chat-updated db group-id)))
(register-handler :participant-invited-to-group
(fn [db [action from group-id identity msg-id]]
(log/debug action msg-id from group-id identity)

View File

@ -34,9 +34,8 @@
(dispatch [:group-chat-invite-acked from group-id ack-msg-id]))
:group-new-participant (let [{:keys [group-id identity from msg-id]} event]
(dispatch [:participant-invited-to-group from group-id identity msg-id]))
;:group-removed-participant (let [{:keys [group-id identity from]} event]
; (add-to-chat "group-chat" ":" (str (shorten from) " removed " (shorten identity) " from group chat"))
; (remove-identity-from-group-list identity))
:group-removed-participant (let [{:keys [group-id identity from msg-id]} event]
(dispatch [:participant-removed-from-group from group-id identity msg-id]))
;:removed-from-group (let [{:keys [group-id from]} event]
; (add-to-chat "group-chat" ":" (str (shorten from) " removed you from group chat")))
;:participant-left-group (let [{:keys [group-id from]} event]