flarum / issue-archive

0 stars 0 forks source link

Mentions showing as deleted/unknown on deleted posts #76

Open SychO9 opened 3 years ago

SychO9 commented 3 years ago

Bug Report

Current Behavior When you delete a post that contains mentions to posts or users, those mentions for some reason show as deleted/unknown.

Steps to Reproduce

  1. Make a post with some mentions
  2. Delete the post
  3. Show the post as an admin
  4. See invalid mentions

Expected Behavior There is no reason for the mentions not to be valid, they should be rendering correctly.

Environment

Possible Solution It seems like the post mentions relationships are deleted when the post is deleted, we should refrain from doing so and instead delete those relationships when the post is actually hard deleted (forever).

dsevillamartin commented 3 years ago

flarum/framework#2902 is related. Issue is that we check for CommentPost relationship and don't fall back to retrieving by user ID from DB.

SychO9 commented 3 years ago

Not quite, we shouldn't fallback, we currently retrieve using the relationship because it's efficient, we can eager load the related mentions (which we do) then grab from the collection, but if we fallback, it'll result in multiple queries to the database, and it would also be inconsistent.

dsevillamartin commented 3 years ago

Whatever our solution is, that's the current situation - don't necessarily need fallback for fix.

askvortsov1 commented 3 years ago

It seems like the post mentions relationships are deleted when the post is deleted, we should refrain from doing so and instead delete those relationships when the post is actually hard deleted (forever).

This proposal makes sense to me

askvortsov1 commented 2 years ago

Actually, we do want to hide these on soft delete, because otherwise hidden posts will show up in the "mentionedBy" section of the footer.

davwheat commented 2 years ago

Wouldn’t it make sense to have a isHidden column on the relationship (if that makes sense) which we set to true if the post is soft deleted?

askvortsov1 commented 2 years ago

Wouldn’t it make sense to have a isHidden column on the relationship (if that makes sense) which we set to true if the post is soft deleted?

That would probably be best. We might also want to do https://github.com/flarum/mentions/pull/42 before this.