world-class / compass

Compass is a suite of tools for students enrolled in the University of London's online BSc in Computer Science program.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow users to edit reviews

ankush opened this issue · comments

Users should be able to edit or delete their reviews somehow.

We can achieve this by giving each review a specific page e.g. /review/id/ or as get parameter. Either way it would work.

Another way is to have per user reviews page. A page showing all reviews from logged in user.

Depends on #31

We talked about a related issue that I think can be a subcomponent of this issue.

Each card needs a permalink (and an easy way to copy this link for sharing). We can change the reviews.html template to assign the review id to the card's html id. One of @amenat's proposed solutions for editing involved giving each review it's own page. If we do that, we can make the card a link to the review's page and then sharing that page will be straightfoward.

Alternatively, we can make a separate button or link that captures the card's position on the page via it's element id.

If we go the unique page per review route, should we utilize the same app.get("/reviews" ... route that we use for the full review page and review filtered by course page? We could use the same strategy that we use for filtering by course (check if the review id is specified and if so, use a WHERE clause to just get that one)

What's best practice? utilize the same route and make it flexible (I think this is the answer) or make more unique, single purpose routes?

I'd suggest leaving /reviews page as is and adding a "singular" route /review/:id that links to individual review.

You'll get the id by using req.params.id in your function for that route.

Added the single page route as a subgoal #41 that I will tackle first

A couple of broad ideas on this matter:

  • User shouldn't see an option to edit anywhere if they don't own the review
  • Check also needs to be performed on/before update query to ensure user owns review

What will the user experience be like? A user might have the review up in front of them when they want to edit. In that case, it would be nice to have a button right there. However, if a user is not currently at the review, there isn't a very direct way to reach it. You currently have to filter by the class or go through all the reviews. So I think a list of all reviews in the user profile is vital. Editing both places is ideal, but I think having it in the profile is the bare minimum.

Here is a rough outline of my plan.

  • Add list of user-owned reviews with 'edit' button in user profile
    • Add an edit button on the review itself (if the user owns it). Should make a new issue for this if not accomplished in this one.
  • make review update form with message flashing on top
  • make review update route