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,28 +528,36 @@ export function doFetchModBlockedList() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((blockLists) => {
|
.then((blockLists) => {
|
||||||
let globalBlockList = new Set();
|
let globalBlockList = [];
|
||||||
blockLists.forEach((channelBlockListData) => {
|
blockLists
|
||||||
const blockListForChannel = channelBlockListData && channelBlockListData.blocked_channels;
|
.sort((a, b) => {
|
||||||
if (blockListForChannel) {
|
return 1;
|
||||||
blockListForChannel.forEach((blockedChannel) => {
|
})
|
||||||
// REMOVE THIS
|
.forEach((channelBlockListData) => {
|
||||||
if (blockedChannel.blocked_channel_name) {
|
const blockListForChannel = channelBlockListData && channelBlockListData.blocked_channels;
|
||||||
const channelUri = buildURI({
|
if (blockListForChannel) {
|
||||||
channelName: blockedChannel.blocked_channel_name,
|
blockListForChannel.forEach((blockedChannel) => {
|
||||||
claimId: blockedChannel.blocked_channel_id,
|
// REMOVE THIS
|
||||||
});
|
if (blockedChannel.blocked_channel_name) {
|
||||||
|
const channelUri = buildURI({
|
||||||
|
channelName: blockedChannel.blocked_channel_name,
|
||||||
|
claimId: blockedChannel.blocked_channel_id,
|
||||||
|
});
|
||||||
|
|
||||||
globalBlockList.add(channelUri);
|
if (!globalBlockList.find((blockedChannel) => blockedChannel.channelUri === channelUri)) {
|
||||||
}
|
globalBlockList.push({ channelUri, blockedAt: blockedChannel.blocked_at });
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
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