Skip to content

Commit

Permalink
Fix flair assertion failure (#1572)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Jan 5, 2025
1 parent 31e9a22 commit e7af56a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Mlem/App/Views/Shared/Labels/FullyQualifiedLabelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,22 @@ struct FullyQualifiedLabelView: View {
var flairs: [PersonFlair] {
guard let person = entity as? any Person else { return [] }
return person.flairs(
interactableContext: (commentContext as? any Comment2Providing) ?? (postContext as? any Post2Providing),
interactableContext: interactableContext,
communityContext: communityContext
)
}

var interactableContext: (any Interactable2Providing)? {
guard let person = entity as? any Person else { return nil }
if let commentContext2 = commentContext as? any Comment2Providing, commentContext2.creator.actorId == person.actorId {
return commentContext2
}
if let postContext2 = postContext as? any Post2Providing, postContext2.creator.actorId == person.actorId {
return postContext2
}
return nil
}

var accessibilityLabel: String {
guard let entity, let fullName = entity.fullName else { return String(localized: "Loading...") }
let flairs = flairs
Expand Down

0 comments on commit e7af56a

Please sign in to comment.