mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Message queuing : use redactEvent on timeline instead of room.
This commit is contained in:
+3
-5
@@ -304,11 +304,9 @@ class MessagesPresenter @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun handleActionRedact(event: TimelineItem.Event) {
|
private suspend fun handleActionRedact(event: TimelineItem.Event) {
|
||||||
if (event.failedToSend) {
|
timelineController.invokeOnCurrentTimeline {
|
||||||
// If the message hasn't been sent yet, just cancel it
|
redactEvent(eventId = event.eventId, transactionId = event.transactionId, reason = null)
|
||||||
event.transactionId?.let { room.cancelSend(it) }
|
.onFailure { Timber.e(it) }
|
||||||
} else if (event.eventId != null) {
|
|
||||||
room.redactEvent(event.eventId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -68,8 +68,12 @@ class PollRepository @Inject constructor(
|
|||||||
|
|
||||||
suspend fun deletePoll(
|
suspend fun deletePoll(
|
||||||
pollStartId: EventId,
|
pollStartId: EventId,
|
||||||
): Result<Unit> =
|
): Result<Boolean> =
|
||||||
room.redactEvent(
|
timelineProvider
|
||||||
eventId = pollStartId,
|
.getActiveTimeline()
|
||||||
)
|
.redactEvent(
|
||||||
|
eventId = pollStartId,
|
||||||
|
transactionId = null,
|
||||||
|
reason = null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -130,8 +130,6 @@ interface MatrixRoom : Closeable {
|
|||||||
|
|
||||||
suspend fun sendMessage(body: String, htmlBody: String?, mentions: List<Mention>): Result<Unit>
|
suspend fun sendMessage(body: String, htmlBody: String?, mentions: List<Mention>): Result<Unit>
|
||||||
|
|
||||||
suspend fun redactEvent(eventId: EventId, reason: String? = null): Result<Unit>
|
|
||||||
|
|
||||||
suspend fun sendImage(
|
suspend fun sendImage(
|
||||||
file: File,
|
file: File,
|
||||||
thumbnailFile: File?,
|
thumbnailFile: File?,
|
||||||
|
|||||||
-6
@@ -324,12 +324,6 @@ class RustMatrixRoom(
|
|||||||
return liveTimeline.sendMessage(body, htmlBody, mentions)
|
return liveTimeline.sendMessage(body, htmlBody, mentions)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun redactEvent(eventId: EventId, reason: String?) = withContext(roomDispatcher) {
|
|
||||||
runCatching {
|
|
||||||
innerRoom.redact(eventId.value, reason)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun leave(): Result<Unit> = withContext(roomDispatcher) {
|
override suspend fun leave(): Result<Unit> = withContext(roomDispatcher) {
|
||||||
runCatching {
|
runCatching {
|
||||||
innerRoom.leave()
|
innerRoom.leave()
|
||||||
|
|||||||
+3
-11
@@ -112,7 +112,7 @@ class FakeMatrixRoom(
|
|||||||
private var updateUserRoleResult = Result.success(Unit)
|
private var updateUserRoleResult = Result.success(Unit)
|
||||||
private var toggleReactionResult = Result.success(Unit)
|
private var toggleReactionResult = Result.success(Unit)
|
||||||
private var retrySendMessageResult = Result.success(Unit)
|
private var retrySendMessageResult = Result.success(Unit)
|
||||||
private var cancelSendResult = Result.success(Unit)
|
private var cancelSendResult = Result.success(true)
|
||||||
private var forwardEventResult = Result.success(Unit)
|
private var forwardEventResult = Result.success(Unit)
|
||||||
private var reportContentResult = Result.success(Unit)
|
private var reportContentResult = Result.success(Unit)
|
||||||
private var kickUserResult = Result.success(Unit)
|
private var kickUserResult = Result.success(Unit)
|
||||||
@@ -281,7 +281,7 @@ class FakeMatrixRoom(
|
|||||||
return retrySendMessageResult
|
return retrySendMessageResult
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun cancelSend(transactionId: TransactionId): Result<Unit> {
|
override suspend fun cancelSend(transactionId: TransactionId): Result<Boolean> {
|
||||||
cancelSendCount++
|
cancelSendCount++
|
||||||
return cancelSendResult
|
return cancelSendResult
|
||||||
}
|
}
|
||||||
@@ -294,14 +294,6 @@ class FakeMatrixRoom(
|
|||||||
return eventPermalinkResult(eventId)
|
return eventPermalinkResult(eventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
var redactEventEventIdParam: EventId? = null
|
|
||||||
private set
|
|
||||||
|
|
||||||
override suspend fun redactEvent(eventId: EventId, reason: String?): Result<Unit> {
|
|
||||||
redactEventEventIdParam = eventId
|
|
||||||
return Result.success(Unit)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun leave(): Result<Unit> {
|
override suspend fun leave(): Result<Unit> {
|
||||||
return leaveRoomLambda()
|
return leaveRoomLambda()
|
||||||
}
|
}
|
||||||
@@ -626,7 +618,7 @@ class FakeMatrixRoom(
|
|||||||
retrySendMessageResult = result
|
retrySendMessageResult = result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun givenCancelSendResult(result: Result<Unit>) {
|
fun givenCancelSendResult(result: Result<Boolean>) {
|
||||||
cancelSendResult = result
|
cancelSendResult = result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user