flarum / issue-archive

0 stars 0 forks source link

[Tags] Event posts reference [Deleted] tag #44

Open jordanjay29 opened 3 years ago

jordanjay29 commented 3 years ago

Bug Report

Current Behavior When nested secondary tags are removed from a discussion, the event posts can no longer reference them and [Deleted] appears instead.

Steps to Reproduce

  1. Create new discussion
  2. Add to a nested secondary tag
  3. Remove nested secondary tag
  4. Tag event posts now reference [Deleted]

Expected Behavior Nested secondary tags should have their proper names and links displayed just like Primary and Secondary tags do.

Screenshots image

Environment

SychO9 commented 3 years ago

I'm assuming that it's because not all tags are in the JS store now, so some tags will show as deleted in event posts.

dsevillamartin commented 3 years ago

@SychO9 Exactly.

What might help here is have some store method to fetch a model if it hasn't already be loaded - as a helper, by ID. Then we could just put that in oninit for the Tag component (or whatever it's called) and add a loading state 🤔 Though one would have to account for ones that don't exist anymore and actually have been deleted... that'd be more complicated. I'm just rambling.

SychO9 commented 3 years ago

yeah, we might also be able to take care of it in the backend side, when posts are requested, I imagine we might be able filter out tag event posts and get all tag ids from those event posts then have those models included in the response.

dsevillamartin commented 3 years ago

I think implementing both would make sense 🤔 but yeah you're probably right.

askvortsov1 commented 3 years ago

yeah, we might also be able to take care of it in the backend side, when posts are requested, I imagine we might be able filter out tag event posts and get all tag ids from those event posts then have those models included in the response.

I think I would prefer lazy loading from the frontend, as that feels a bit simpler. Including from the backend might be challenging, as we don't request tags in the JSON:API includes for posts, and adding that technically would be in violation of the spec.