Fix ReplyView when its content has been redacted. (#2606)

This commit is contained in:
Doug
2024-03-27 10:16:26 +00:00
committed by GitHub
parent be9cf8713e
commit bb725db6bb
13 changed files with 33 additions and 18 deletions
@@ -81,6 +81,11 @@ struct TimelineReplyView: View {
plainBody: question,
formattedBody: nil,
icon: .init(kind: .icon(\.polls), cornerRadii: iconCornerRadii))
case .redacted:
ReplyView(sender: sender,
plainBody: L10n.commonMessageRemoved,
formattedBody: nil,
icon: .init(kind: .icon(\.delete), cornerRadii: iconCornerRadii))
}
default:
LoadingReplyView()
@@ -295,7 +300,11 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
eventContent: .message(.notice(.init(body: "", formattedBody: attributedStringWithAtRoomMention))))),
TimelineReplyView(placement: .timeline,
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Bob"),
eventContent: .poll(question: "Do you like polls?")))
eventContent: .poll(question: "Do you like polls?"))),
TimelineReplyView(placement: .timeline,
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Bob"),
eventContent: .redacted))
]
}
@@ -305,7 +314,9 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
previewItems[index]
}
}
.padding()
.environmentObject(viewModel.context)
.snapshot(delay: 0.2) // Allow member names to load.
.previewLayout(.sizeThatFits)
}
}
@@ -22,7 +22,7 @@ struct RedactedRoomTimelineView: View {
var body: some View {
TimelineStyler(timelineItem: timelineItem) {
Label(timelineItem.body, systemImage: "trash")
Label(timelineItem.body, icon: \.delete, iconSize: .small, relativeTo: .compound.bodyLG)
.labelStyle(RoomTimelineViewLabelStyle())
.imageScale(.small) // Smaller icon so that the bubble remains rounded on the outside.
}