Skip to content

feat: Introduce User Report Section on Moderation Console - #30554

Merged
kodiakhq[bot] merged 62 commits into
developfrom
new/MCreptUser
Jan 23, 2024
Merged

feat: Introduce User Report Section on Moderation Console#30554
kodiakhq[bot] merged 62 commits into
developfrom
new/MCreptUser

Conversation

@Dnouv

@Dnouv Dnouv commented Oct 3, 2023

Copy link
Copy Markdown
Member

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

changeset-bot Bot commented Oct 3, 2023

Copy link
Copy Markdown

🦋 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

codecov Bot commented Oct 3, 2023

Copy link
Copy Markdown

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.

Comment thread apps/meteor/app/api/server/v1/moderation.ts
Comment thread apps/meteor/app/api/server/v1/moderation.ts Outdated
@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
Comment thread apps/meteor/app/api/server/v1/moderation.ts

@AllanPazRibeiro AllanPazRibeiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@casalsgh
casalsgh requested a review from debdutdeb October 18, 2023 11:57
@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

@sampaiodiego sampaiodiego left a comment

Copy link
Copy Markdown
Member

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. 😉

Comment thread apps/meteor/app/api/server/v1/moderation.ts
Comment thread .changeset/rare-eels-fetch.md
Comment thread apps/meteor/server/models/raw/ModerationReports.ts Outdated
Comment thread apps/meteor/app/api/server/v1/moderation.ts Outdated
Comment thread apps/meteor/app/api/server/v1/moderation.ts Outdated
Comment thread apps/meteor/tests/end-to-end/api/27-moderation.ts
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants