refac
This commit is contained in:
@@ -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)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user