diff --git a/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs index e83adaba65..f734b9b6ff 100644 --- a/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/user/impl/src/lifecycle/post_upgrade.rs @@ -34,6 +34,8 @@ fn post_upgrade(args: Args) { && state.data.communities.len() == 0 && state.data.diamond_membership_expires_at.is_none() && state.data.unique_person_proof.is_none() + && state.data.group_chats.removed_len() == 0 + && state.data.communities.removed_len() == 0 { let now = state.env.now(); if state.data.user_created + SIX_MONTHS < now && state.data.chit_events.last_updated() + SIX_MONTHS < now { diff --git a/backend/canisters/user/impl/src/model/communities.rs b/backend/canisters/user/impl/src/model/communities.rs index 69b5c636fc..9aa9f9a7e0 100644 --- a/backend/canisters/user/impl/src/model/communities.rs +++ b/backend/canisters/user/impl/src/model/communities.rs @@ -98,6 +98,10 @@ impl Communities { self.communities.len() } + pub fn removed_len(&self) -> usize { + self.removed.len() + } + fn next_index(&self) -> u32 { self.communities.values().map(|c| c.index.value).max().unwrap_or_default() + 1 } diff --git a/backend/canisters/user/impl/src/model/group_chats.rs b/backend/canisters/user/impl/src/model/group_chats.rs index 1b08772663..23f9750a5c 100644 --- a/backend/canisters/user/impl/src/model/group_chats.rs +++ b/backend/canisters/user/impl/src/model/group_chats.rs @@ -97,6 +97,10 @@ impl GroupChats { self.group_chats.len() } + pub fn removed_len(&self) -> usize { + self.removed.len() + } + pub fn pin(&mut self, chat_id: ChatId, now: TimestampMillis) { if !self.pinned.value.contains(&chat_id) { self.pinned.timestamp = now;