mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
add check if delete message is allowed to be executed
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
cc6f582ee2
commit
7cf18923b5
@ -2513,6 +2513,15 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun deleteMessage(message: IMessage?) {
|
fun deleteMessage(message: IMessage?) {
|
||||||
|
if (!AttendeePermissionsUtil(currentConversation!!.permissions)
|
||||||
|
.canPostChatShareItemsDoReaction(conversationUser!!)
|
||||||
|
) {
|
||||||
|
Log.e(
|
||||||
|
TAG, "Deletion of message is skipped because of restrictions by permissions. " +
|
||||||
|
"This method should not have been called!"
|
||||||
|
)
|
||||||
|
Toast.makeText(context, R.string.nc_common_error_sorry, Toast.LENGTH_LONG).show()
|
||||||
|
} else {
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
// FIXME Fix API checking with guests?
|
// FIXME Fix API checking with guests?
|
||||||
if (conversationUser != null) {
|
if (conversationUser != null) {
|
||||||
@ -2558,6 +2567,7 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun replyPrivately(message: IMessage?) {
|
fun replyPrivately(message: IMessage?) {
|
||||||
val apiVersion =
|
val apiVersion =
|
||||||
|
@ -34,7 +34,7 @@ class AttendeePermissionsUtil(flag: Int) {
|
|||||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "chat-permission")) {
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "chat-permission")) {
|
||||||
return canPostChatShareItemsDoReaction
|
return canPostChatShareItemsDoReaction
|
||||||
}
|
}
|
||||||
// if capability is not available the spreed version doesn't support to restrict this
|
// if capability is not available then the spreed version doesn't support to restrict this
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user