diff --git a/src/lib/components/channel/Messages/Message/UserStatus.svelte b/src/lib/components/channel/Messages/Message/UserStatus.svelte index d04c9eb291..7c4749dc7f 100644 --- a/src/lib/components/channel/Messages/Message/UserStatus.svelte +++ b/src/lib/components/channel/Messages/Message/UserStatus.svelte @@ -77,7 +77,7 @@
{#if user?.status_emoji}
diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 5ef0e96b88..272e6f1c44 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -183,16 +183,9 @@ const initChannels = async () => { // default (none), group, dm type await channels.set( - (await getChannels(localStorage.token)).sort((a, b) => - a.type === b.type - ? 0 - : a.type === 'dm' - ? 1 - : a.type === 'group' - ? b.type === 'dm' - ? -1 - : 0 - : -1 + (await getChannels(localStorage.token)).sort( + (a, b) => + ['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type) ) ); }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 6a3756f4ca..c4a8b6c5b2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -488,16 +488,9 @@ // handle channel created event if (event.data?.type === 'channel:created') { await channels.set( - (await getChannels(localStorage.token)).sort((a, b) => - a.type === b.type - ? 0 - : a.type === 'dm' - ? 1 - : a.type === 'group' - ? b.type === 'dm' - ? -1 - : 0 - : -1 + (await getChannels(localStorage.token)).sort( + (a, b) => + ['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type) ) ); return; @@ -539,16 +532,10 @@ ); } else { await channels.set( - (await getChannels(localStorage.token)).sort((a, b) => - a.type === b.type - ? 0 - : a.type === 'dm' - ? 1 - : a.type === 'group' - ? b.type === 'dm' - ? -1 - : 0 - : -1 + (await getChannels(localStorage.token)).sort( + (a, b) => + ['', null, 'group', 'dm'].indexOf(a.type) - + ['', null, 'group', 'dm'].indexOf(b.type) ) ); }