Skip to content

Fix saving vote for post/discussion created by deleted user#145

Merged
DavideIadeluca merged 1 commit intoFriendsOfFlarum:1.xfrom
rob006:save-vote
Mar 18, 2026
Merged

Fix saving vote for post/discussion created by deleted user#145
DavideIadeluca merged 1 commit intoFriendsOfFlarum:1.xfrom
rob006:save-vote

Conversation

@rob006
Copy link
Copy Markdown
Contributor

@rob006 rob006 commented Mar 18, 2026

This fixes an error when someone is trying to vote on discussion created by user, that was deleted.

17540542
2026-03-18 13:59:23] flarum.ERROR: TypeError: Argument 5 passed to FoF\Gamification\Listeners\SaveVotesToDatabase::vote() must be an instance of Flarum\User\User, null given, called in /home/xxx/project/forum/vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php on line 94 and defined in /home/xxx/project/forum/vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php:99
Stack trace:
#0 /home/xxx/project/forum/vendor/fof/gamification/src/Listeners/SaveVotesToDatabase.php(94): FoF\Gamification\Listeners\SaveVotesToDatabase->vote()
#1 /home/xxx/project/forum/vendor/illuminate/events/Dispatcher.php(424): FoF\Gamification\Listeners\SaveVotesToDatabase->handle()

@rob006 rob006 requested a review from a team as a code owner March 18, 2026 14:26
@DavideIadeluca DavideIadeluca merged commit 6be68f0 into FriendsOfFlarum:1.x Mar 18, 2026
36 checks passed
@rob006 rob006 deleted the save-vote branch March 18, 2026 14:30
@DavideIadeluca
Copy link
Copy Markdown
Member

Thanks @rob006. Tagged as v1.6.12. Might you be able to open a 2.x PR for this issue as well?

@rob006
Copy link
Copy Markdown
Contributor Author

rob006 commented Mar 18, 2026

I don't have an environment to test this on 2.x, but I suspect that 2.x is not affected by this bug - this param is not present in 2.x version:

public function vote(Post $post, ?string $voteValue, User $actor): void

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants