mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Redact and event ID, not an item ID.
This commit is contained in:
parent
f19240d2f6
commit
91795a0d19
@ -150,7 +150,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
displayError(.alert(ElementL10n.roomTimelinePermalinkCreationFailure))
|
||||
}
|
||||
case .redact:
|
||||
redactItem(itemId)
|
||||
redact(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,9 +163,9 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
}
|
||||
}
|
||||
|
||||
private func redactItem(_ itemID: String) {
|
||||
private func redact(_ eventID: String) {
|
||||
Task {
|
||||
await timelineController.redactItem(itemID)
|
||||
await timelineController.redact(eventID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ struct MockRoomProxy: RoomProxyProtocol {
|
||||
.failure(.failedSendingMessage)
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomProxyError> {
|
||||
.failure(.failedRedactingEvent)
|
||||
}
|
||||
}
|
||||
|
@ -194,14 +194,14 @@ class RoomProxy: RoomProxyProtocol {
|
||||
.value
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
|
||||
func redactItem(_ eventID: String) async -> Result<Void, RoomProxyError> {
|
||||
#warning("Redactions to be enabled on next SDK release.")
|
||||
return .failure(.failedRedactingEvent)
|
||||
// let transactionID = genTransactionId()
|
||||
//
|
||||
// return await Task {
|
||||
// do {
|
||||
// try room.redact(eventId: itemId, reason: nil, txnId: transactionID)
|
||||
// try room.redact(eventId: eventID, reason: nil, txnId: transactionID)
|
||||
// return .success(())
|
||||
// } catch {
|
||||
// return .failure(.failedRedactingEvent)
|
||||
|
@ -57,7 +57,7 @@ protocol RoomProxyProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError>
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomProxyError>
|
||||
|
||||
var callbacks: PassthroughSubject<RoomProxyCallback, Never> { get }
|
||||
}
|
||||
|
@ -66,5 +66,5 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async { }
|
||||
|
||||
func redactItem(_ itemId: String) async { }
|
||||
func redact(_ eventID: String) async { }
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func redactItem(_ itemId: String) async {
|
||||
switch await timelineProvider.redactItem(itemId) {
|
||||
func redact(_ eventID: String) async {
|
||||
switch await timelineProvider.redact(eventID) {
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -41,5 +41,5 @@ protocol RoomTimelineControllerProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async
|
||||
|
||||
func redactItem(_ itemId: String) async
|
||||
func redact(_ eventID: String) async
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func redactItem(_ itemID: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.redactItem(itemID) {
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.redact(eventID) {
|
||||
case .success:
|
||||
return .success(())
|
||||
case .failure:
|
||||
|
@ -37,5 +37,5 @@ protocol RoomTimelineProviderProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func redactItem(_ itemID: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user