Skip to content

Commit

Permalink
Fix group chat inviter name
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed Apr 7, 2020
1 parent 2ff5531 commit 37b2c58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 6 additions & 12 deletions src/status_im/group_chats/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
(:require [status-im.chat.models :as models.chat]
[status-im.multiaccounts.core :as multiaccounts]))

(defn unwrap-events
"Flatten all events, denormalizing from field"
[all-updates]
(mapcat
(fn [{:keys [events from]}]
(map #(assoc % :from from) events))
all-updates))
(def members-added-type 3)

(defn joined?
[public-key {:keys [members-joined] :as chat}]
Expand All @@ -19,14 +13,14 @@
(contains? contacts my-public-key))

(defn get-inviter-pk
[my-public-key {:keys [membership-updates]}]
(->> membership-updates
unwrap-events
[my-public-key {:keys [membership-update-events]}]
(->> membership-update-events
reverse
(keep (fn [{:keys [from type members]}]
(when (and (= type "members-added")
(when (and (= type members-added-type)
((set members) my-public-key))
from)))
last))
first))

(defn get-pending-invite-inviter-name
"when the chat is a private group chat in which the user has been
Expand Down
4 changes: 2 additions & 2 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"owner": "status-im",
"repo": "status-go",
"version": "feature/change-group-chat-name",
"commit-sha1": "07a44ac1ef003b72cbff6ceb4ceda6aa1e2f90ff",
"src-sha256": "17kqqd388pn8isq5fw9gg39ssr2qgi86rh1prvjknczvw2sf7xad"
"commit-sha1": "3f7190382222b512c6097577565d4739fa02c02c",
"src-sha256": "025pswwfl4mi4i0c700xxzghwg64bb3cf8y8m9g6ld0vmz991g4f"
}

0 comments on commit 37b2c58

Please sign in to comment.