Fix empty displayName

This commit is contained in:
Thomas Ricouard 2023-01-03 08:17:47 +01:00
parent 41d7f4ca62
commit fb0cd6b623
2 changed files with 13 additions and 2 deletions

View File

@ -10,9 +10,20 @@ extension Account {
let value: Substring
}
public var safeDisplayName: String {
if displayName.isEmpty {
return username
}
return displayName
}
@ViewBuilder
public var displayNameWithEmojis: some View {
if displayName.isEmpty {
Text(safeDisplayName)
}
let splittedDisplayName = displayName.split(separator: ":").map{ Part(value: $0) }
return HStack(spacing: 0) {
HStack(spacing: 0) {
if displayName.isEmpty {
Text(" ")
}

View File

@ -50,7 +50,7 @@ struct NotificationRowView: View {
private func makeMainLabel(type: Models.Notification.NotificationType) -> some View {
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 0) {
Text(notification.account.displayName)
Text(notification.account.safeDisplayName)
.font(.subheadline)
.fontWeight(.semibold) +
Text(" ") +