Skip to content

fix: Resolve author name via Manager and handle deleted authors - #122

Merged
luisdalmolin merged 1 commit into
mainfrom
fix/121-author-name
Sep 12, 2026
Merged

luisdalmolin merged 1 commit into
mainfrom
fix/121-author-name

Conversation

@luisdalmolin

Copy link
Copy Markdown
Member

Closes #121.

Problem

Comment::getAuthorName() read $this->author->name directly. That:

  • fatals when the author has been deleted ($this->author is null)
  • ignores the documented getCommenterName() / Filament HasName customizations, so the displayed name can disagree with mentions and avatars (which already go through Manager::getName())

getAuthorAvatar() had the same null-author crash via Manager::getName($this->author).

Fix

  • Resolve the display name through Manager::getName(), with a translated deleted_user fallback when the author is missing or unnamed
  • Skip the avatar provider when there is no author, and generate initials from getAuthorName()

Tests

  • tests/CommentAuthorNameTest.php: default name, getCommenterName(), HasName, deleted author name + avatar
  • Livewire render of a comment whose author was deleted

Full suite: 175 passed. Pint clean. PHPStan unchanged — the 7 pre-existing errors in tests/Livewire/CommentReactionTest.php are also present on main.

getAuthorName() read $this->author->name directly, which fatals when the
author is missing and ignores getCommenterName()/HasName. Route through
Manager::getName() and fall back to a translated label; guard avatar
generation the same way.
@luisdalmolin
luisdalmolin merged commit 8dcece8 into main Sep 12, 2026
20 checks passed
@luisdalmolin
luisdalmolin deleted the fix/121-author-name branch September 12, 2026 10:37
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.

Author Name error?

1 participant