Azuriom / Plugin-Support

A support plugin that allows users to create a ticket when they need help.
https://market.azuriom.com/resources/3
MIT License
2 stars 9 forks source link

Attempt to read property "author" on null #30

Closed Javdu10 closed 8 months ago

Javdu10 commented 9 months ago
Controller Action | Azuriom\Plugin\Support\Controllers\Admin\TicketController@index
Path              | /plugins/support/src/Models/Ticket.php:88
86     public function userReplied(): bool
87     {
88         return $this->comment->author->is($this->author);
89     }

Could be a soft deleted author ?

MrMicky-FR commented 9 months ago

This seems to occur because a ticket has no comment, which should never occurs as a ticket is created with an initial comment that shouldn’t be possible to delete

Javdu10 commented 9 months ago

This is from AzuriomCloud telescope logs, which means there is a way to delete the first comment via the UI somehow (no database/ftp access)

Unfortunatly I don't have the "HOW" only that the admin tried to access the admin portal to see the tickets and faced this error

A cacaded contraint somewhere that would delete the comments of that user ? The admin himself deleting the first comment ?

MrMicky-FR commented 9 months ago

It would be interesting to see how to reproduce, about the cascade constraint I don’t know how it could be used to cascade only if it’s the last relation that is deleted (a single deleted comment shouldn’t delete the ticket if there are other comments)

MrMicky-FR commented 8 months ago

Fixed in d9c9661404ca554a439753ab2bf10ba4f26c0069, and now released in v1.1.1 of the support plugin. Current tickets with no comments should be deleted, and the issues shouldn't occurs anymore 🙂