Skip to content

Commit

Permalink
Merge pull request #1226 from coralproject/handle-empty-queue
Browse files Browse the repository at this point in the history
Fix error when queue is empty
  • Loading branch information
cvle authored Dec 19, 2017
2 parents 7b92e58 + f27de81 commit 519464c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions client/coral-admin/src/routes/Moderation/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export function cleanUpQueue(root, queue, sortOrder, queueConfig) {
let nodes = root[queue].nodes;
let hasNextPage = root[queue].hasNextPage;

if (!nodes.length) {
return root;
}

if (queueConfig) {
nodes = root[queue].nodes.filter((comment) => commentBelongToQueue(queue, comment, queueConfig));
}
Expand All @@ -161,8 +165,8 @@ export function cleanUpQueue(root, queue, sortOrder, queueConfig) {
sortOrder,
);

if (nodes.length > 2) {
nodes = nodes.slice(0, 2);
if (nodes.length > 100) {
nodes = nodes.slice(0, 100);
hasNextPage = true;
}

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/04_userStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = {
.waitForElementVisible('@usernameDialogSuspend')
.click('@usernameDialogSuspend')
.waitForElementVisible('@usernameDialogSuspensionMessage')
.click('@usernameDialogSuspend'),
.click('@usernameDialogSuspend');

community
.waitForElementNotPresent('@flaggedUser');
Expand Down

0 comments on commit 519464c

Please sign in to comment.