HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
GNU Affero General Public License v3.0
1.94k stars 370 forks source link

[Bug] System PM doesn't show up as being sent by System in user inbox #4093

Closed crKtv closed 2 weeks ago

crKtv commented 2 weeks ago

UNIT3D Version

8.2.0

PHP & Platform

8.3.10 - Ubuntu 22.04

Laravel verion

11.21.0

Have you done this?

Expectation

Messages being sent as System to show up as sent by System inside user's inbox

Description

After I updated my custom fork to 8.2.0, I noticed that messages sent by System would show up as a blank sender in user's inbox. Thought that I messed up somewhere because of my modifications and fixed it in the frontend blade view to show up as System if a sender is not found - which isn't the best practice but couldn't find where it messes up in the backend.

Today, after Aither's mass PM, I noticed the same happened to them so I guess it is a bug. I didn't test with a fresh install as I'm with limited time and can't setup a fresh one.

Apologies in advance if you can't replicate it in a fresh install.

Stack trace & logs

None - it doesn't throw any error

Upvote & Fund

Fund with Polar

Roardom commented 2 weeks ago

I've been working through a lot of the system user stuff over time, and have migrated most of the random 1s and '1's to a User::SYSTEM_USER_ID constant. By default, UNIT3D has a system id of 1. If your system user is not 1 (if you migrated from somewhere else for example), then you will likely need to update that constant to whatever id your system user has.

Otherwise, maybe make sure your system user is in a class that is immune from soft deletion? I can't seem to reproduce this bug locally.

Roardom commented 2 weeks ago

I see the issue now. Will send PR in a few.