diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift index 918d90822..cbf876159 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift @@ -107,7 +107,7 @@ final nonisolated class EventTimelineItemProxy: Sendable { } } - /// The item's own pending send or, when it has already gone out, our pending edit or redaction of it. + /// The item's own pending send or, when it has already gone out, our pending edit, redaction or failed reaction on it. var pendingSend: (target: SendTarget, state: EventSendState)? { if let state = item.localSendState { (.event, state) @@ -115,11 +115,25 @@ final nonisolated class EventTimelineItemProxy: Sendable { (.edit, state) } else if let state = item.redactionSendState { (.redaction, state) + } else if let (key, state) = failedReaction { + (.reaction(key: key), state) } else { nil } } + /// Only failed reactions are surfaced as they block the send queue, in-flight ones would flash a sending indicator on every tap. + private var failedReaction: (key: String, state: EventSendState)? { + for reaction in item.reactions { + for sender in reaction.senders { + if let state = sender.sendState, case .sendingFailed = state { + return (reaction.key, state) + } + } + } + return nil + } + var canBeRepliedTo: Bool { item.canBeRepliedTo }