Skip to content

Conversation

@cvle
Copy link
Contributor

@cvle cvle commented Sep 19, 2017

What does this PR do?

  • New slot adminCommentLabels
  • Fix toxic comments not adding a flag and not appearing in reported queue
  • Fix all comments queue and userDetail all tab not showing all comments.
  • Fix mod queue loadMore feature not considering tags.
  • Return actions for CreateComment Mutation
  • Posting a toxic comment twice will show a different notification now and not the default premod notification
  • Show toxic comment flag label
  • Implement core labels:
    • reply label
    • premod label
    • history flag label
    • suspect flag label
    • user flag label

How do I test this PR?

  • Post a toxic comment (twice), see new notification text that states that your text might still violates guidelines etc.
  • Check the existance of the above mentioned labels in the modqueue and user detail
  • Check that the all moderation tab contains SYSTEM_WITHHELD comments
  • Test as a priviledged and as a normal user.

@cvle cvle changed the title New flags Implement Labels, Fix Flags, apply Modqueue fixes Sep 19, 2017
@cvle cvle changed the title Implement Labels, Fix Flags, apply Modqueue fixes Flags: Implement Labels, bugfixes and improvements Sep 19, 2017
@cvle cvle requested review from kgardnr and wyattjoh September 19, 2017 20:08
query = query.where({id: {$in: ids}});
if (
(context.user != null && context.user.can(SEARCH_NON_NULL_OR_ACCEPTED_COMMENTS)) ||
statuses && statuses.every((status) => ['NONE', 'ACCEPTED'].includes(status))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If statuses is null/undefined, no comments will be returned. Is that desired?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll return all comments if permissions are there, look inside the if clause

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these if statements, if you can write a short comment above that describes how/why we're doing this. It'll make it super clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* @param {String} [asset_id] asset for the comment
* @param {Object} [wordlist={}] the results of the wordlist scan
* @return {Promise} resolves to the comment's status
* @return {Object} resolves to the comment's status and actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every async function returns a Promise


// Then we actually create the comment with the new status.
comment = await createComment(context, comment);
const result = await createComment(context, comment);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we just assign this to the original comment variable? We don't use the old one here, and truly, it's realized the new comment here instead.

Copy link
Contributor Author

@cvle cvle Sep 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I added this because I used to have more changes here.
But I think it is good to have a different variable here.
Because comment in my mind was the input and
result is the created comment. Different concepts and as such I would assign them to different variables just to make it more clear.


// Include the asset id in the search.
query.asset_id = id;
query.statuses = ['NONE', 'ACCEPTED'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be applied at the resolver level, instead should apply at the schema level. This prevents any future query to support a statuses field, which currently, the graph schema says it does allow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed this up with the RepliesQuery as that one does not allow specifying statuses.


query.asset_id = asset_id;
query.parent_id = id;
query.statuses = ['NONE', 'ACCEPTED'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reply query currently does not allow specifying statuses.

const actions = await Actions.getByID.load(comment.id);
const flags = actions.filter(({action_type}) => action_type === 'FLAG');

return {comment, flags};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too specific, this should instead be actions, don't filter out the flags.

Copy link
Contributor Author

@cvle cvle Sep 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said something about filter in the call, so I was thinking what possibly could I filter and ended up filtering out the flags 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can revert it 👍

comment: Comment

# Flags that was assigned during creation of the comment.
flags: [FlagAction]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, should return actions: [Action] instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@wyattjoh wyattjoh merged commit 525da57 into master Sep 19, 2017
@wyattjoh wyattjoh deleted the new-flags branch September 19, 2017 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants