NamelessMC / Nameless

NamelessMC is a free, easy to use & powerful website software for your Minecraft server, which includes a large range of features.
https://namelessmc.com/
MIT License
612 stars 311 forks source link

Forum Last Post by a Deleted User Error #3425

Open AutismFather opened 1 year ago

AutismFather commented 1 year ago

Describe the issue

I deleted a user from the panel and now one of my forums is broken because the last post made in one of the threads was by that user. Now the forum returns an error because it's trying to grab their avatar and display name but the user no longer exists.

NamelessMC Version

2.1.0

To Reproduce

  1. Create a forum and a thread.
  2. Have a user create a post and be the last post in that thread.
  3. Delete user.
  4. Visit that forum.

Expected Behaviour

It should just no longer have any posts available by that deleted user, so there's no need to try to retrieve their data.

Screenshots

namelessmc_error

Additional Information

No response

samerton commented 1 year ago

The issue here is that the DeleteUserForumHook did not trigger when the user was deleted to remove their forum content - this is strange because I'm not able to reproduce the issue locally on the latest development code.

I'm not sure this is worth handling within the forum module because the hook should be triggering correctly. I can't say I know why the hook didn't trigger but I will have a think as to what might have happened.

samerton commented 1 year ago

Could maybe have a queue task which runs nightly to clear out any bad data such as this, but it'd mean there's potentially several hours when this type of error could occur

partydragen commented 1 year ago

Skjermbilde 2023-08-02 224529 Skjermbilde 2023-08-02 224600

Just to have it logged for this cause ^^ With happens if user is deleted