[NEW] New API endpoints for Moderation feature#27798
Merged
debdutdeb merged 69 commits intoRocketChat:feat/moderation-dashboardfrom Mar 20, 2023
Merged
[NEW] New API endpoints for Moderation feature#27798debdutdeb merged 69 commits intoRocketChat:feat/moderation-dashboardfrom
debdutdeb merged 69 commits intoRocketChat:feat/moderation-dashboardfrom
Conversation
debdutdeb
requested changes
Jan 20, 2023
Member
debdutdeb
left a comment
There was a problem hiding this comment.
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 👏🏼
debdutdeb
requested changes
Jan 26, 2023
Member
|
I'll review in a couple of hours. |
Member
Author
|
Thank you! I just wanted to let you know that I have fixed it according to the comments. |
…d, try to fix test
debdutdeb
added a commit
that referenced
this pull request
Mar 28, 2023
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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