AdmitHub / Telescope

AdmitHub's telescope implementation
0 stars 5 forks source link

Do not show responses to deleted or rejected questions on a user's profile page #13

Open AndrewMagliozzi opened 8 years ago

AndrewMagliozzi commented 8 years ago

This is particularly relevant for Dan's profile page, because he provides answers to every question, even those that he rejects / deletes...

https://college.admithub.com/users/danpeterson

yourcelf commented 8 years ago

This is a rough one to fix on our end -- we might need a PR upstream, as it's rather thickly abstracted and thus tough to monkeypatch.

The core problem here: the view tries to show 5 latest comments; but as mongo doesn't do joins, we don't know anything about the status of the post prior to making that selection. So to hide comments for rejected/deleted posts would require one of:

  1. Just showing fewer than 5 comments (possibly even 0 comments) if some of the latest 5 are from rejected/deleted posts.
  2. Changing the commentsList publication to select more comments than 5 (possibly all of them) and then slicing the first 5 that are not rejected (e.g. moving the limit param from mongo to frontend code). This has negative performance implications.
  3. Denormalize the post status onto comments. Every time a post is deleted/rejected, mark that status on the comment document and use that as a term to limit queries.

Let me know what the level of importance for this is and I'll pick one of these. I'm leaning toward option 3 as the cleanest, and would discuss with Sacha as a change to core Telescope, but also explore doing a monkeypatch of it for our purposes in the mean time.

brockmiller commented 8 years ago

@yourcelf - I stumbled on this comment while searching for an existing solution to this problem. Did you ever fix this issue in your app? If so, did you go with #3 (we were thinking of doing the same)?

AndrewMagliozzi commented 8 years ago

Hey @brockmiller it looks like this is still an outstanding issue for us. I don't think we implemented a fix yet, but #3 does seem like a good solution. You might want to search (or post an issue on) the main Telescope github repo to see if it's something they are working on as well.