Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2139 from RocketChat/fix/msg_actions_room_roles.2082
Browse files Browse the repository at this point in the history
[FIX] Message actions not taking into account room roles
  • Loading branch information
filipealva authored Aug 29, 2018
2 parents 81d1c7d + e692fce commit f3a68ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Rocket.Chat/Models/Auth/AuthCanDeleteMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions Rocket.Chat/Models/Auth/AuthCanEditMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion Rocket.Chat/Models/Auth/AuthCanPinMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f3a68ee

Please # to comment.