mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
App now prevents redacting own messages if there is no permission (#2368)
This commit is contained in:
@@ -52,6 +52,7 @@ class RoomScreenInteractionHandler {
|
||||
|
||||
private var voiceMessageRecorderObserver: AnyCancellable?
|
||||
private var canCurrentUserRedactOthers = false
|
||||
private var canCurrentUserRedactSelf = false
|
||||
private var resumeVoiceMessagePlaybackAfterScrubbing = false
|
||||
|
||||
init(roomProxy: RoomProxyProtocol,
|
||||
@@ -86,6 +87,12 @@ class RoomScreenInteractionHandler {
|
||||
} else {
|
||||
canCurrentUserRedactOthers = false
|
||||
}
|
||||
|
||||
if case let .success(value) = await roomProxy.canUserRedactOwn(userID: roomProxy.ownUserID) {
|
||||
canCurrentUserRedactSelf = value
|
||||
} else {
|
||||
canCurrentUserRedactSelf = false
|
||||
}
|
||||
|
||||
guard let timelineItem = timelineController.timelineItems.firstUsingStableID(itemID),
|
||||
let eventTimelineItem = timelineItem as? EventBasedTimelineItemProtocol else {
|
||||
@@ -604,7 +611,7 @@ class RoomScreenInteractionHandler {
|
||||
// MARK: - Private
|
||||
|
||||
private func canRedactItem(_ item: EventBasedTimelineItemProtocol) -> Bool {
|
||||
item.isOutgoing || (canCurrentUserRedactOthers && !roomProxy.isDirect)
|
||||
item.isOutgoing ? canCurrentUserRedactSelf : canCurrentUserRedactOthers && !roomProxy.isDirect
|
||||
}
|
||||
|
||||
private func buildReplyInfo(for item: EventBasedTimelineItemProtocol) -> ReplyInfo {
|
||||
|
||||
Reference in New Issue
Block a user