Skip to content

Commit

Permalink
Fix pinned/muted chats so they're instantly shown
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbroman committed Jun 29, 2023
1 parent 4c0002b commit 99daac8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/src/renderer/apps/Courier/views/Inbox/InboxBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const InboxBody = ({
</Button.IconButton>
</Flex>
</InboxBodyHeaderContainer>
{isLoading && <InboxBodyLoadingHeader />}
{isLoading && isStandaloneChat && <InboxBodyLoadingHeader />}
<InboxBodyList
inboxes={filteredInboxes}
spacePath={spacePath}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const InboxBodyLoadingHeader = () => (
transition={{ duration: 0.2, ease: 'easeInOut' }}
>
<Spinner size="16px" width={1.5} color="var(--rlm-text-color)" />
<Text.Body>Loading new messages...</Text.Body>
<Text.Body>Syncing messages...</Text.Body>
</Container>
);
21 changes: 14 additions & 7 deletions app/src/renderer/stores/chat.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,11 @@ export const ChatStore = types
self.inboxInitLoader.set('loading');

try {
const pinnedChats = yield ChatIPC.fetchPinnedChats();
const pinned = yield ChatIPC.fetchPinnedChats();
const muted = yield ChatIPC.fetchMuted();
self.inbox = yield ChatIPC.getChatList();
self.inbox.forEach((chat) => {
chat.setMuted(muted.includes(chat.path));
chat.setPinned(pinnedChats.includes(chat.path));
});
self.pinnedChats = pinnedChats;
self.mutedChats = muted;
self.pinnedChats = pinned;
} catch (error) {
console.error(error);
}
Expand All @@ -185,7 +182,17 @@ export const ChatStore = types
self.inboxLoader.set('loading');

try {
self.inbox = yield ChatIPC.getChatList();
const initialInbox = yield ChatIPC.getChatList();
const pins = initialInbox
.filter((chat: any) => chat.pinned)
.map((chat: any) => chat.path);
const mutes = initialInbox
.filter((chat: any) => chat.muted)
.map((chat: any) => chat.path);

self.inbox = initialInbox;
self.pinnedChats = pins;
self.mutedChats = mutes;
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit 99daac8

Please sign in to comment.