Skip to content
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

feat: Introduce User Report Section on Moderation Console #30554

Merged
merged 62 commits into from Jan 23, 2024

Conversation

Dnouv
Copy link
Member

@Dnouv Dnouv commented Oct 3, 2023

Proposed changes (including videos or screenshots)

Introduce a new window (tab, to be precise) on the Moderation Console to view and manage reported users.

Added:

  • A new tab for Reported Users is now available on the Moderation Console page.
  • A new endpoint has been added to retrieve user reports by user ID.
  • A new endpoint has been added to dismiss user reports by user ID.
  • A new endpoint has been added to fetch all the user reports grouped by unique users.
  • A new component has been added to show user report details on the Contextual Bar.
  • A new common filter component ModFilter can be used in both the User & Message Reports.
  • A few i18n have been added.

Changed:

  • Replaced useRoute with useRouter on the Moderation Console page.
  • Added reported user name and username columns to the Moderation Console table.
  • Shortened long file names, e.g., "ModConsoleReportDetails" instead of "ModerationConsoleReportDetails".
  • Improved the no results page view with more informative messages for each tab.
  • Changed the Date filters to a dropdown with pre-defined options, rather than a date selector, for better i18n.
  • Added an isUserReport prop to the useDismissUserAction to enable dismissing user reports as well as message reports.
  • Updated the useResetAvatarAction with more calls to invalidate react-queries.
  • Renamed the ReportMessageHistoryParams to GetUserReportsParams, for more clarity.

APIs

API Endpoint: moderation.dismissUserReports

Description

This endpoint allows a moderator to dismiss user reports. The moderator could provide a reason and an action for the dismissal.

Method: POST

Parameters

  • userId: The ID of the user whose reports are to be dismissed.
  • reason: The reason for dismissing the reports.
  • action: The action taken upon dismissing the reports.

Response

  • success: A boolean indicating if the operation was successful.
  • message: A message indicating the result of the operation.
API Endpoint: moderation.user.reportsByUserId

Description

This endpoint retrieves all the moderation reports for a specific user.

Method: GET

Query Parameters

  • userId: The ID of the user whose reports are to be retrieved.
  • selector: (Optional) A string to filter the reports.
  • count: (Optional) The number of reports to retrieve. Default is 50.
  • offset: (Optional) The number of reports to skip before starting to retrieve. Default is 0.

Response

  • success: A boolean indicating if the operation was successful.
  • user: The user object.
  • reports: An array of report objects.
  • count: The number of reports returned.
  • total: The total number of reports.
  • offset: The offset value.
API Endpoint: moderation.userReports

Description

This endpoint retrieves all the user reports.

Method: GET

Query Parameters

  • latest: (Optional) The latest date (in ISO format) from which to retrieve reports. Default is the current date.
  • oldest: (Optional) The oldest date (in ISO format) from which to retrieve reports. Default is the date of the oldest report.
  • selector: (Optional) A string to filter the reports.
  • count: (Optional) The number of reports to retrieve. Default is 20.
  • offset: (Optional) The number of reports to skip before starting to retrieve. Default is 0.

Response

  • success: A boolean indicating if the operation was successful.
  • reports: An array of report objects.
  • count: The number of reports returned.
  • total: The total number of reports.
  • offset: The offset value.

Issue(s)

Steps to test or reproduce

This video shows the main features of the product:

-moderation_console_userreport.mp4

Further comments

AECO-336

To the reviewer:

This PR might look a bit large at first glance, and you might think it could be split into smaller ones. However, from my experience with similar changes in the past, I’ve found that keeping everything in one PR actually makes the review and testing process easier.
That being said, I understand this might not be the most convenient approach for everyone. So, my apologies if this causes any inconvenience during your review. Thanks for your understanding and patience as you go through this PR. 🙏

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2023

🦋 Changeset detected

Latest commit: 0868710

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 32 packages
Name Type
@rocket.chat/model-typings Minor
@rocket.chat/rest-typings Minor
@rocket.chat/i18n Minor
@rocket.chat/meteor Minor
@rocket.chat/models Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/omnichannel-services Patch
rocketchat-services Patch
@rocket.chat/core-services Patch
@rocket.chat/ui-contexts Major
@rocket.chat/api-client Patch
@rocket.chat/ddp-client Patch
@rocket.chat/presence Patch
@rocket.chat/mock-providers Patch
@rocket.chat/web-ui-registration Major
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/ui-client Major
@rocket.chat/ui-video-conf Major
@rocket.chat/uikit-playground Patch
@rocket.chat/livechat Patch
@rocket.chat/core-typings Minor
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (da410ef) 59.83% compared to head (0868710) 49.57%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop   #30554       +/-   ##
============================================
- Coverage    59.83%   49.57%   -10.27%     
============================================
  Files         1793     3320     +1527     
  Lines        34892    81614    +46722     
  Branches      7268    16773     +9505     
============================================
+ Hits         20879    40460    +19581     
- Misses       12411    36435    +24024     
- Partials      1602     4719     +3117     
Flag Coverage Δ
e2e 53.22% <100.00%> (+0.06%) ⬆️
e2e-api 40.70% <74.07%> (?)
unit 76.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@Dnouv Dnouv marked this pull request as ready for review October 13, 2023 12:49
@Dnouv Dnouv requested review from a team as code owners October 13, 2023 12:49
Copy link
Contributor

@AllanPazRibeiro AllanPazRibeiro left a comment

Choose a reason for hiding this comment

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

LGTM

@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: conflict labels Jan 22, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 22, 2024
Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

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

tests can be improved later during the release candidate cycle.. the other change requests should be very simple to get done before the cut. 😉

apps/meteor/app/api/server/v1/moderation.ts Show resolved Hide resolved
.changeset/rare-eels-fetch.md Outdated Show resolved Hide resolved
apps/meteor/server/models/raw/ModerationReports.ts Outdated Show resolved Hide resolved
apps/meteor/app/api/server/v1/moderation.ts Outdated Show resolved Hide resolved
apps/meteor/app/api/server/v1/moderation.ts Outdated Show resolved Hide resolved
Co-authored-by: Diego Sampaio <chinello@gmail.com>
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 22, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 22, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 22, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 23, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 23, 2024
@kodiakhq kodiakhq bot merged commit 2260c04 into develop Jan 23, 2024
44 of 45 checks passed
@kodiakhq kodiakhq bot deleted the new/MCreptUser branch January 23, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA tested stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants