Redacting is now displayed for moderators in groups (#1324)

* basic implementation

* sdk update

* format

* changelog
This commit is contained in:
Mauro
2023-07-18 15:51:27 +02:00
committed by GitHub
parent 55892eb05b
commit 19ecf906e3
5 changed files with 62 additions and 3 deletions
@@ -55,6 +55,10 @@ class RoomProxy: RoomProxyProtocol {
innerTimelineProvider
}
var ownUserID: String {
room.ownUserId()
}
deinit {
roomTimelineObservationToken?.cancel()
backPaginationStateObservationToken?.cancel()
@@ -647,6 +651,15 @@ class RoomProxy: RoomProxyProtocol {
}
}
func canUserRedact(userID: String) async -> Result<Bool, RoomProxyError> {
do {
return try await .success(room.canUserRedact(userId: userID))
} catch {
MXLog.error("Failed checking if the user can redact with error: \(error)")
return .failure(.failedCheckingPermission)
}
}
// MARK: - Private
/// Force the timeline to load member details so it can populate sender profiles whenever we add a timeline listener
@@ -41,6 +41,7 @@ enum RoomProxyError: Error, Equatable {
case failedSettingRoomTopic
case failedRemovingAvatar
case failedUploadingAvatar
case failedCheckingPermission
}
// sourcery: AutoMockable
@@ -54,6 +55,7 @@ protocol RoomProxyProtocol {
var canonicalAlias: String? { get }
var alternativeAliases: [String] { get }
var hasUnreadNotifications: Bool { get }
var ownUserID: String { get }
var name: String? { get }
var displayName: String? { get }
@@ -159,6 +161,8 @@ protocol RoomProxyProtocol {
func removeAvatar() async -> Result<Void, RoomProxyError>
func uploadAvatar(media: MediaInfo) async -> Result<Void, RoomProxyError>
func canUserRedact(userID: String) async -> Result<Bool, RoomProxyError>
}
extension RoomProxyProtocol {