diff --git a/app/mobile/src/context/useCardContext.hook.js b/app/mobile/src/context/useCardContext.hook.js index 21faf966..dea0ef0f 100644 --- a/app/mobile/src/context/useCardContext.hook.js +++ b/app/mobile/src/context/useCardContext.hook.js @@ -465,7 +465,7 @@ export function useCardContext() { }, clearChannelFlag: async (cardId, channelId) => { const { guid } = access.current || {}; - await store.actions.setCardChannelItemBlocked(guid, cardId, channelId); + await store.actions.clearCardChannelItemBlocked(guid, cardId, channelId); setCardChannelField(cardId, channelId, 'blocked', false); }, setTopicFlag: async (cardId, channelId, topicId) => { diff --git a/app/mobile/src/session/settings/Settings.jsx b/app/mobile/src/session/settings/Settings.jsx index 89e090e8..544505a1 100644 --- a/app/mobile/src/session/settings/Settings.jsx +++ b/app/mobile/src/session/settings/Settings.jsx @@ -125,7 +125,7 @@ export function Settings() { { item.name } { item.handle } - unblock(actions.unblockContact, item.cardId)}> + unblock(actions.unblockContact, { cardId: item.cardId })}> { state.strings.restore } @@ -139,7 +139,7 @@ export function Settings() { { item.subject } - unblock(actions.unblockTopic, item.cardId, item.channelId)}> + unblock(actions.unblockTopic, { cardId: item.cardId, channelId: item.channelId })}> { state.strings.restore } @@ -691,7 +691,7 @@ export function Settings() { item.topicId} + keyExtractor={item => `${item.cardId}.${item.channelId}`} /> )} diff --git a/app/mobile/src/session/settings/useSettings.hook.js b/app/mobile/src/session/settings/useSettings.hook.js index ec28f73d..b501275c 100644 --- a/app/mobile/src/session/settings/useSettings.hook.js +++ b/app/mobile/src/session/settings/useSettings.hook.js @@ -88,9 +88,9 @@ export function useSettings() { const setChannelItem = (item) => { const profileGuid = profile.state?.identity?.guid; - const { logo, subject } = getChannelSubjectLogo(null, profileGuid, item, card.state.cards, card.actions.getCardImageUrl); + const { logo, subject } = getChannelSubjectLogo(item.cardId, profileGuid, item, card.state.cards, card.actions.getCardImageUrl); return { - cardId: null, + cardId: item.cardId, channelId: item.channelId, created: item.detail.created, logo: logo, @@ -112,10 +112,10 @@ export function useSettings() { }); updateState({ contacts: sorted }); - contacts.current = []; + cardChannels.current = []; contacts.forEach(contact => { const filtered = Array.from(contact.channels.values()).filter(topic => topic.blocked); - const mapped = filtered.map(setChannelItem).map(item => ({ ...item, cardId: contact.card.cardId })); + const mapped = filtered.map(item => setChannelItem({ ...item, cardId: contact.card.cardId })); cardChannels.current = cardChannels.current.concat(mapped); }); const merged = cardChannels.current.concat(channels.current); @@ -315,9 +315,17 @@ export function useSettings() { removeKey: async () => { await removeKey(); }, - unblockContact: async (cardId) => { + unblockContact: async ({ cardId }) => { await card.actions.clearCardFlag(cardId); }, + unblockTopic: async ({ cardId, channelId }) => { + if (cardId) { + await card.actions.clearChannelFlag(cardId, channelId); + } + else { + await channel.actions.clearChannelFlag(channelId); + } + }, }; return { state, actions };