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

Fix report abuse #380

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Fix report abuse #380

wants to merge 5 commits into from

Conversation

CasperL1218
Copy link
Contributor

@CasperL1218 CasperL1218 commented Nov 18, 2024

Summary

This pull request enhanced the Report Abuse feature for reviews. The new Report Abuse feature provides a more comprehensive process for reporting reviews, and allowing admin to monitor reported reviews to take actions.

Main Requirements Completed:

  • Added confirmation modal for reporting
  • Added success toast for report submission
  • Kept reported reviews visible on apartment page
  • Admin section exists for handling reported reviews

Backend Changes Completed:

  • Added report functionality to endpoints
  • Added report fields to review type
    • Include date, reason, and userId
    • reason field will require future frontend process
  • Implemented proper status handling
    • Create REPORTED review status
    • Implemented new report entry creation
  • Added validation for report submissions
    • Relevant authorization and identity check for report functionality (admin, review owner, etc.)

Frontend Changes Completed:

  • Report process
    • Added report confirmation modal
    • Added report abuse success toast
  • Page display
    • Modified review fetching to include reported reviews (so users can see both APPROVED and REPORTED reviews)
    • Updated ApartmentPage, AdminPage, ProfilePage, LandlordPage, and BookmarkPage
  • Review owner page (ProfilePage)
    • Prevent reported review owner to edit reviews
    • Prevent review owner to report their own reviews
    • Added reported reviews section to profile page
  • Admin Page
    • Reported review section
    • Review dropdown UI enhancement

Review Status Flow Fixed:

  • PENDING → APPROVED → can be REPORTED
  • Can't report PENDING reviews
  • Can't report own reviews
  • Reported reviews remain visible to all users

Edge Cases Handled:

  • Users can't report their own reviews
  • Users can't report pending reviews
  • Reported reviews stay visible but can't be edited
  • Profile page shows all review statuses correctly

Test Plan

*Reported reviews in profile page: 1. Reported reviews can't be edited/deleted. 2. Can't report self's reviews.
reviews in profile page

*Only able to report other users' review. REPORTED reviews are still visible.
Screenshot 2024-11-17 at 23 00 48

*Admin page reported review display
Screenshot 2024-11-17 at 23 01 08

*Admin page review section dropdown menu
Screenshot 2024-11-17 at 23 01 29

Test the following flows:

  1. Regular user flow:

    • View an approved review
    • Click report abuse button
    • Confirm report in modal
    • See success toast
    • Verify review remains visible
  2. Edge cases:

    • Verify can't report own reviews (report button hidden)
    • Verify can't report pending reviews (pending reviews are only available in owner's profile page, where report button is hidden)
    • Verify reported reviews can't be edited
    • Verify reported reviews show up in profile page

Notes

  • Using lazy migration for the reports field in review documents
  • Reported reviews remain visible to prevent abuse of the report system
  • Only admins can take action on reported reviews

Breaking Changes

  • Database schema change: Added reports array field to review documents (lazy migration)

Future Plans

  • Receive feedbacks
  • Implement report-reason functionality

- Add report validation
- Update review status endpoint
- Prevent reporting of pending reviews and own reviews
- Add report confirmation modal
- Add report button logic
- Prevent reporting of own reviews
- Show reported reviews in apartment page
- Add reported reviews section to profile page
- Add success toast notifications
@dti-github-bot
Copy link
Member

dti-github-bot commented Nov 18, 2024

[diff-counting] Significant lines: 350.

Copy link
Member

@kea-roy kea-roy left a comment

Choose a reason for hiding this comment

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

PR Review

You implemented the report abuse confirmation modal really well with no flaws, and the toast works correctly as expected. Good work on these parts.

You also adjusted the app.ts really well, I love the security checks and the logic works correctly.

I like the addition of the collapsing arrows and it really helps improve the user experience! One minor change would be to switch the open and close state direction to match the convention across our site, so just flip the rotate CSS.

This is the current state, but it should be the opposite.

Screenshot 2024-11-19 at 6 59 08 PM

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