sort blocked list by most recent block first
This commit is contained in:
parent
8467db568f
commit
85e61819e8
1 changed files with 25 additions and 17 deletions
|
@ -528,8 +528,12 @@ export function doFetchModBlockedList() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((blockLists) => {
|
.then((blockLists) => {
|
||||||
let globalBlockList = new Set();
|
let globalBlockList = [];
|
||||||
blockLists.forEach((channelBlockListData) => {
|
blockLists
|
||||||
|
.sort((a, b) => {
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
.forEach((channelBlockListData) => {
|
||||||
const blockListForChannel = channelBlockListData && channelBlockListData.blocked_channels;
|
const blockListForChannel = channelBlockListData && channelBlockListData.blocked_channels;
|
||||||
if (blockListForChannel) {
|
if (blockListForChannel) {
|
||||||
blockListForChannel.forEach((blockedChannel) => {
|
blockListForChannel.forEach((blockedChannel) => {
|
||||||
|
@ -540,7 +544,9 @@ export function doFetchModBlockedList() {
|
||||||
claimId: blockedChannel.blocked_channel_id,
|
claimId: blockedChannel.blocked_channel_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
globalBlockList.add(channelUri);
|
if (!globalBlockList.find((blockedChannel) => blockedChannel.channelUri === channelUri)) {
|
||||||
|
globalBlockList.push({ channelUri, blockedAt: blockedChannel.blocked_at });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -549,7 +555,9 @@ export function doFetchModBlockedList() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.COMMENT_MODERATION_BLOCK_LIST_COMPLETED,
|
type: ACTIONS.COMMENT_MODERATION_BLOCK_LIST_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
blockList: Array.from(globalBlockList).reverse(),
|
blockList: globalBlockList
|
||||||
|
.sort((a, b) => new Date(a.blockedAt) - new Date(b.blockedAt))
|
||||||
|
.map((blockedChannel) => blockedChannel.channelUri),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue