-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
get-list-mute.js
35 lines (35 loc) · 968 Bytes
/
get-list-mute.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export async function getListMute(type = 'all') {
var muteList = (await window.Store.Mute)._models,
noMute = new Array(),
toMute = new Array();
for (var i in muteList)
muteList[i].__x_isMuted
? toMute.push(WAPI.interfaceMute(muteList[i]))
: noMute.push(WAPI.interfaceMute(muteList[i]));
var r = null;
console.log(0, type);
switch (type) {
case 'all':
r = [
{
total: toMute.length + noMute.length,
amountToMute: toMute.length,
amountnoMute: noMute.length
},
toMute,
noMute
];
break;
case 'toMute':
r = [{ total: toMute.length }, toMute];
break;
case 'noMute':
r = [{ total: noMute.length }, noMute];
break;
}
return r;
}
export function interfaceMute(arr) {
let { attributes, expiration, id, isMuted, isState, promises, stale } = arr;
return { attributes, expiration, id, isMuted, isState, promises, stale };
}