[fix #3057] fix chat-contact.identity must be of type string error

This commit is contained in:
Eric Dvorsak 2018-01-17 01:43:25 +01:00
parent 17e886da11
commit b8ddc2b16b
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
1 changed files with 14 additions and 15 deletions

View File

@ -181,7 +181,7 @@
(re-frame/reg-fx (re-frame/reg-fx
::participant-invited-to-group-message ::participant-invited-to-group-message
(fn [{:keys [chat-id current-identity identity from message-id timestamp]}] (fn [{:keys [group-id current-identity identity from message-id timestamp]}]
(let [inviter-name (:name (contacts/get-by-id from)) (let [inviter-name (:name (contacts/get-by-id from))
invitee-name (if (= identity current-identity) invitee-name (if (= identity current-identity)
(i18n/label :t/You) (i18n/label :t/You)
@ -189,7 +189,7 @@
(re-frame/dispatch (re-frame/dispatch
[:chat-received-message/add [:chat-received-message/add
{:from "system" {:from "system"
:group-id chat-id :group-id group-id
:timestamp timestamp :timestamp timestamp
:message-id message-id :message-id message-id
:content (str (or inviter-name from) " " (i18n/label :t/invited) " " (or invitee-name identity)) :content (str (or inviter-name from) " " (i18n/label :t/invited) " " (or invitee-name identity))
@ -507,13 +507,12 @@
{:keys [group-id identity message-id timestamp]} :payload}]] {:keys [group-id identity message-id timestamp]} :payload}]]
(let [admin (get-in chats [group-id :group-admin])] (let [admin (get-in chats [group-id :group-admin])]
(when (= from admin) (when (= from admin)
(merge (merge {::participant-invited-to-group-message {:group-id group-id :current-public-key current-public-key
{::participant-invited-to-group-message {:group-id group-id :current-public-key current-public-key
:identity identity :from from :message-id message-id :identity identity :from from :message-id message-id
:timestamp timestamp}} :timestamp timestamp}}
(when-not (and (= current-public-key identity) has-contact?) (when-not (and (= current-public-key identity) has-contact?)
{:db (update-in db [:chats group-id :contacts] conj {:identity identity}) {:db (update-in db [:chats group-id :contacts] conj {:identity identity})
::chats-add-contact [group-id [identity]]})))))) ::chats-add-contact [group-id identity]}))))))
(handlers/register-handler-fx (handlers/register-handler-fx
::you-removed-from-group ::you-removed-from-group