Resolves #35 "Implement Marketplace likes"
#35 (closed)
ClosesNotes:
Adds frontend button for liking marketplace stalls that turns to a unlike when a marketplace stall is liked. Spinner for while REST call is made. Only displays for team users an not on their own page.
Button state is loaded in componentDidMount
to see if liked and if the user can like (can only like if do not have the same teacher, is not their own stall, they haven't used all their votes, they haven't liked it before, and they are a team user).
Backend implements GET for /can_like
which returns based on criteria. GET, POST, and DELETE for the /marketplace_like
which returns if liked, creates a like (if can based on criteria), and delete/un like (if it exists).
Relies on:
- core-fe PR: https://stgit.dcs.gla.ac.uk/team-project-h/2021/cs11/ybc-core-fe/-/merge_requests/21
- core-be PR: https://stgit.dcs.gla.ac.uk/team-project-h/2021/csp4/yes_project_core_be/-/merge_requests/12 (may break deployment) (once merged, ci must be updated)
Demo
Screen_Recording_2022-03-04_at_19.44.43
Manual Testing TBC
-
Can like marketplace stalls from different teachers -
Cannot like marketplace stalls from the same teacher -
Can unlike marketplace stalls -
The Like button does not show for Teacher, Judge or Admin users -
Can like and unlike infinitely
Edited by YE Scotland Admin