Skip to content

Restrict "Add Review" to Logged-in Users & Save Reviews #179

@ash-jh

Description

@ash-jh

Currently, any visitor can submit a review, and the review is only stored locally in the frontend state.
This poses two problems:

  1. Unauthorized submissions : Non-authenticated users can add reviews, which is not ideal for data integrity.
  2. No backend persistence : Reviews are not stored in the database. This means if any review is to be moderated, analysed, or otherwise worked upon by the admin, it cannot be done because the data isn’t persisted or accessible server-side.

Solution :

  1. On the frontend : When a non-logged-in user clicks “Add Review”, show a toast notification: "Please log in to add a review", and do not open the review form. For logged-in users, allow the form to open.
Image
  1. On form submission by a logged-in user : Push the review into the logged-in user’s reviews array in the user.js model.

Display Strategy:
Reviews stored in the user.js model can also be displayed on the homepage, depending on admin preferences.
Two possible approaches:

  1. Latest-first rendering: Push new reviews to the collection and automatically show the most recent ones on the site.
  2. Selective rendering: Only display reviews approved/selected by the admin, while storing all others for internal analytics, sentiment analysis, or feature improvement.

Questions:

  1. Which approach should we implement, automatic display of the latest reviews, or an admin-controlled curation process? (either can be worked upon)
  2. If the admin thinks this issue is genuine and can be worked upon, please assign :) @AditiGupta-tech

⚠️ Comment on this issue to get it assigned before starting your work. Unassigned PRs will not be counted under Commit and Conquer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MediumCarries 10 points under Commit and ConquerenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions