remove group-chat-local-version

This commit is contained in:
yenda 2019-09-15 20:25:34 +02:00
parent ee042bd1c4
commit 47bae76c73
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
5 changed files with 3 additions and 16 deletions

View File

@ -197,10 +197,7 @@
(cond
(and (= :group-user-message message-type)
(and (get-in cofx [:db :chats chat-id :contacts from])
;; Version 0 does not have a concept of joining, so any message is ok
;; otherwise check we joined
(or (= 0 (get-in cofx [:db :chats chat-id :group-chat-local-version]))
(get-in cofx [:db :chats chat-id :members-joined (multiaccounts.model/current-public-key cofx)])))) chat-id
(get-in cofx [:db :chats chat-id :members-joined (multiaccounts.model/current-public-key cofx)]))) chat-id
(and (= :public-group-user-message message-type)
(get-in cofx [:db :chats chat-id :public?])) chat-id
(and (= :user-message message-type)

View File

@ -124,7 +124,7 @@
(dissoc :referenced-messages :message-groups :gaps-loaded? :pagination-info
:public? :group-chat :messages
:might-have-join-time-messages?
:group-chat-local-version :loaded-unviewed-messages-ids
:loaded-unviewed-messages-ids
:messages-initialized? :contacts :admins :members-joined)))
(defn <-rpc [chat]
@ -143,7 +143,6 @@
(update :membership-updates (partial unmarshal-membership-updates (:id chat)))
(update :last-message-content utils/safe-read-message-content)
(update :last-clock-value utils.clocks/safe-timestamp)
(assoc :group-chat-local-version 1) ;; TODO(cammellos): this can be removed
(dissoc :chatType :members)))
(fx/defn save-chat [cofx {:keys [chat-id] :as chat}]

View File

@ -483,7 +483,6 @@
(fx/merge cofx
(models.chat/upsert-chat {:chat-id chat-id
:name (:name new-group)
:group-chat-local-version (get previous-chat :group-chat-local-version 1)
:is-active (or member?
(get previous-chat :is-active true))
:group-chat true

View File

@ -10,16 +10,10 @@
(map #(assoc % :from from) events))
all-updates))
(defn joined-event?
(defn joined?
[public-key {:keys [members-joined] :as chat}]
(contains? members-joined public-key))
(defn joined?
[public-key {:keys [group-chat-local-version] :as chat}]
;; We consider group chats with local version of 0 as joined for local events
(or (zero? group-chat-local-version)
(joined-event? public-key chat)))
(defn invited?
[my-public-key {:keys [contacts]}]
(contains? contacts my-public-key))

View File

@ -30,7 +30,6 @@
:pagination-info {}
:last-message-content "content"
:last-message-content-type "type"
:group-chat-local-version 1
:chat-id "chat-id"
:loaded-unviewed-messages-ids []
:timestamp 2
@ -132,7 +131,6 @@
:members #{"a" "b"}}]}}
:unviewed-messages-count 2
:is-active true
:group-chat-local-version 1
:chat-id "chat-id"
:timestamp 2}]
(testing "from-rpc"