[Gekidou][MM-43870, MM-43896, MM-43898, MM-43902, MM-43903] CRT related bug fixes (#6205)

* Fixes

* Updated snapshot

* Excluding current user from getting updated

* Doesn't handle users if it's empty

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Anurag Shivarathri
2022-05-05 18:36:18 +05:30
committed by GitHub
parent 251ef0992b
commit 2deb2e01e0
13 changed files with 119 additions and 23 deletions

View File

@@ -131,7 +131,10 @@ export const transformMyChannelRecord = async ({action, database, value}: Transf
const fieldsMapper = (myChannel: MyChannelModel) => {
myChannel._raw.id = isCreateAction ? (raw.channel_id || myChannel.id) : record.id;
myChannel.roles = raw.roles;
myChannel.messageCount = isCRTEnabled ? raw.msg_count_root! : raw.msg_count;
// ignoring msg_count_root because msg_count is already calculated in "handleMyChannel" based on CRT is enabled or not
myChannel.messageCount = raw.msg_count;
myChannel.isUnread = Boolean(raw.is_unread);
myChannel.mentionsCount = isCRTEnabled ? raw.mention_count_root! : raw.mention_count;
myChannel.lastPostAt = (isCRTEnabled ? (raw.last_root_post_at || raw.last_post_at) : raw.last_post_at) || 0;