-
Notifications
You must be signed in to change notification settings - Fork 13.1k
[NEW] New API endpoints for Moderation feature #27798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] New API endpoints for Moderation feature #27798
Conversation
debdutdeb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please create raw models instead of meteor ones; take a look at apps/meteor/server/models/raw;
I think we're also reducing the use of underscore;
please also don't create meteor methods;
overall good job 👏🏼
|
I'll review in a couple of hours. |
|
Thank you! I just wanted to let you know that I have fixed it according to the comments. |
…d, try to fix test
* draft getreports api * prettier * fix lint error * fix lint error * fix lint error * add raw model * fix prop type * fix lint * add oldest undefine check * test * fix offset and count * add new migration and fix report history api * add e2e tests * check array and remove API failure and change the migration version * add hidebyid endpoint * add hidebymid method * add test for report hide * fix build * add moderation.info enfpoint and hiddenby fields * add test for mdoeration.info * fix e2e tests * add new property in reporthistoryprop * moderation.history -> moderation.getReports * moderation.hide -> moderation.markChecked * moderation.info -> moderation.reportsByMessage * add additional sort param * add query param * remove deprecated query * add single report detail endpoint * fix link * add test for new API * add reportedBy user details * fix type error and add new count api endpoint * fix type error * fix count api return value * add query to group together reported messages based on message content * update test * add totalcounts for grouped results * reduce data overload * add new count field * update IReport schema and support new fields in Moderation method * try to fix error * revert grouping by message content * update moderation interface * fix type error * add moderation.user.getMessageHistory endpoint * avoid duplicated messsages * fix hidereport api * fix reportsbymsg endpoint * flag deleteMessage method as deprecated * add reported message delete endpoint * add new permissions to the deactivate & reset emoji enfpoints * fix test and try out to append roomnames * fix api errors * add roomname append query * update the ireport schema and also the report function * add more fields in schema * reduce aggregation calls * fix return type of API calls * fix tests and deleteReportedMessages method * add intial migration logic * try to fix type error in moderation.ts * fix the typescript error, and remove migration logic * fix setActiveStatus persmission * fix projection * add count propoerty in IModerationAudit * add _id to usermessages * fix deletmessage function * add new function for reportMessage, deprecate the reportMessage method, try to fix test --------- Co-authored-by: Debdut Chakraborty <debdut.chakraborty@rocket.chat>
Proposed changes (including videos or screenshots)
A new API endpoint to fetch all of the reported messages within a certain timestamp.
A new API endpoint to hide the reported messages.
A new API endpoint to fetch the reported messages of a user
A new API endpoint to fetch reports by MessageId
Two new permission
view-moderation-consoleandmanage-moderation-actionsIssue(s)
Steps to test or reproduce
manage-moderation-actionsto make the POST requests.Test the API endpoint using the following:
Or pass the
latestand/oroldestparameters for filtered search:To test the
/moderation.markCheckedendpoint (which hides the reported messages)To test the
/moderation.reportsByMessageenpoint, we need a messageId; the message must have been reported:GET: To test the
moderation.user.getMessageHistory, we need the userId, the API returns all the messages that were reported for theuserIdprovidedPOST: To test the
moderation.user.deleteMessageHistory, we need theuserIdto delete any and all the messages that were reported for the provideduserIdFurther comments