code100x / cms

https://app.100xdevs.com/
660 stars 867 forks source link

bug: Search results redirection for same video across courses breaks #499

Open nk4456542 opened 2 months ago

nk4456542 commented 2 months ago

Describe the bug The redirection for search results for "some" videos on https://app.100xdevs.com/ does NOT work.

Upon digging a little further on why this is happening for "some" videos and not all:

  1. I found this issue appears for videos where the search API returns results that have multiple courses in them and the UI only picks the results for the first course from the search result.
  2. The Backend also returns search results across courses and NOT just the results the user has purchased courses for, which I feel is also an issue if the courses are restricted for a user.

To Reproduce Steps to reproduce the behavior: The user should only have access to cohort-2 courses for this to reproducable

  1. Go to https://app.100xdevs.com/
  2. Search for cookie
  3. Click on the search result item named: 16.2.1 | Auth using cookies
  4. The redirection stays on the homepage and does NOT take the user to 16.2.1 | Auth using cookies lecture.

Expected behavior The redirection of search results should work for all videos.

Screenshots or GIFs search_results_redirection_bug

Info (please complete the following information):

nk4456542 commented 2 months ago

@hkirat or anyone who helps with admin stuff - might need your opinion here:

  1. The current search results do not account for the user being subscribed to a course, meaning the search results are returned for all the courses that exist in the DB and NOT just the videos of courses the current user has subscribed to.
  2. There is a global cache for the content - which dumps all the course contents into memory and the search results are directly fetched from this cache and returned - NO user-level filter.

The questions to you are:

  1. How is the website supposed to function? Currently when I try to access https://app.100xdevs.com/courses/1, directly from the URL - a course that I have NOT purchased, I get redirected to the home page - Expected but I would prefer a message " does not have access to Course ". Is there even a /courses/1, I am assuming it is the first cohort?
  2. Should the search results be filtered at a user-purchased course level?

I could be totally wrong and all this would be moot if we don't want to filter for courses at a user level 😅 .