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

[FIX] Message actions not taking into account room roles #2139

Merged
merged 1 commit into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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