From e5fdfefcb7bedfa67ef785ae2b8a3aa39ee8b4e7 Mon Sep 17 00:00:00 2001 From: balzack Date: Sun, 7 May 2023 23:21:13 -0700 Subject: [PATCH] fix for delayed rendering of offsync card status --- app/mobile/src/context/useCardContext.hook.js | 2 +- app/mobile/src/context/useConversationContext.hook.js | 4 ++-- app/mobile/src/context/useStoreContext.hook.js | 4 ++-- app/mobile/src/session/cards/cardItem/CardItem.jsx | 4 ++-- app/mobile/src/session/conversation/useConversation.hook.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/mobile/src/context/useCardContext.hook.js b/app/mobile/src/context/useCardContext.hook.js index 9c162109..9f9b2e41 100644 --- a/app/mobile/src/context/useCardContext.hook.js +++ b/app/mobile/src/context/useCardContext.hook.js @@ -186,7 +186,7 @@ export function useCardContext() { } catch (err) { console.log(err); - entry.offsync = true; + entry.card.offsync = true; await store.actions.setCardItemOffsync(guid, card.id); } } diff --git a/app/mobile/src/context/useConversationContext.hook.js b/app/mobile/src/context/useConversationContext.hook.js index a623e392..4d96410e 100644 --- a/app/mobile/src/context/useConversationContext.hook.js +++ b/app/mobile/src/context/useConversationContext.hook.js @@ -354,7 +354,7 @@ export function useConversationContext() { else if (channelId) { channel.actions.setTopicFlag(channelId, topicId); } - setTopicField(topicId, 'blocked', 1); + setTopicField(topicId, 'blocked', true); updateState({ topics: topics.current }); }, clearTopicFlag: async (topicId) => { @@ -365,7 +365,7 @@ export function useConversationContext() { else if (channelId) { channel.actions.clearTopicFlag(channelId, topicId); } - setTopicField(topicId, 'blocked', 0); + setTopicField(topicId, 'blocked', false); updateState({ topics: topics.current }); }, getTopicAssetUrl: (topicId, assetId) => { diff --git a/app/mobile/src/context/useStoreContext.hook.js b/app/mobile/src/context/useStoreContext.hook.js index 3778ef77..e3c8cfe7 100644 --- a/app/mobile/src/context/useStoreContext.hook.js +++ b/app/mobile/src/context/useStoreContext.hook.js @@ -180,8 +180,8 @@ export function useStoreContext() { notifiedProfile: card.notified_profile, notifiedArticle: card.notified_article, notifiedChannel: card.notified_channel, - offsync: card.offsync, - blocked: card.blocked, + offsync: card.offsync === 1, + blocked: card.blocked === 1, })); }, diff --git a/app/mobile/src/session/cards/cardItem/CardItem.jsx b/app/mobile/src/session/cards/cardItem/CardItem.jsx index 92c794f1..75e26dbd 100644 --- a/app/mobile/src/session/cards/cardItem/CardItem.jsx +++ b/app/mobile/src/session/cards/cardItem/CardItem.jsx @@ -35,10 +35,10 @@ export function CardItem({ item, openContact, enableIce, call, message }) { )} )} - { item.status === 'connected' && item.offsync === 1 && ( + { item.status === 'connected' && item.offsync && ( )} - { item.status === 'connected' && item.offsync !== 1 && ( + { item.status === 'connected' && !item.offsync && ( )} { item.status === 'requested' && ( diff --git a/app/mobile/src/session/conversation/useConversation.hook.js b/app/mobile/src/session/conversation/useConversation.hook.js index 66854fb2..143ee41a 100644 --- a/app/mobile/src/session/conversation/useConversation.hook.js +++ b/app/mobile/src/session/conversation/useConversation.hook.js @@ -91,7 +91,7 @@ export function useConversation() { } return -1; }); - const filtered = sorted.filter(item => !(item.blocked === 1)); + const filtered = sorted.filter(item => !(item.blocked)); updateState({ hosted, loaded, logo, subject, topics: filtered, delayed: false });