From e692fcef786d567a08601a1238f456603e446109 Mon Sep 17 00:00:00 2001 From: cardoso Date: Mon, 27 Aug 2018 09:49:01 -0300 Subject: [PATCH] take room roles into account when adding msg actions --- Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift | 6 +++--- Rocket.Chat/Models/Auth/AuthCanEditMessage.swift | 6 +++--- Rocket.Chat/Models/Auth/AuthCanPinMessage.swift | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift b/Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift index 1ed154b4e0..dc301fdd3a 100644 --- a/Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift +++ b/Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift @@ -23,15 +23,15 @@ extension Auth { let createdAt = message.createdAt, let user = user, let settings = settings - else { - return .unknown + else { + return .unknown } if !message.type.actionable { return .notActionable } - if user.hasPermission(.forceDeleteMessage, realm: self.realm) { + if user.hasPermission(.forceDeleteMessage, subscription: message.subscription, realm: self.realm) { return .allowed } diff --git a/Rocket.Chat/Models/Auth/AuthCanEditMessage.swift b/Rocket.Chat/Models/Auth/AuthCanEditMessage.swift index 7d80599ab1..8f499c8559 100644 --- a/Rocket.Chat/Models/Auth/AuthCanEditMessage.swift +++ b/Rocket.Chat/Models/Auth/AuthCanEditMessage.swift @@ -21,15 +21,15 @@ extension Auth { let createdAt = message.createdAt, let user = user, let settings = settings - else { - return .unknown + else { + return .unknown } if !message.type.actionable { return .notActionable } - if user.hasPermission(.editMessage, realm: self.realm) { + if user.hasPermission(.editMessage, subscription: message.subscription, realm: self.realm) { return .allowed } diff --git a/Rocket.Chat/Models/Auth/AuthCanPinMessage.swift b/Rocket.Chat/Models/Auth/AuthCanPinMessage.swift index b1d81bd6cd..0b1b2f557b 100644 --- a/Rocket.Chat/Models/Auth/AuthCanPinMessage.swift +++ b/Rocket.Chat/Models/Auth/AuthCanPinMessage.swift @@ -28,7 +28,7 @@ extension Auth { return .notActionable } - if !settings.messageAllowPinning || !user.hasPermission(.pinMessage, realm: self.realm) { + if !settings.messageAllowPinning || !user.hasPermission(.pinMessage, subscription: message.subscription, realm: self.realm) { return .notAllowed }