mirror of
https://github.com/nextcloud/talk-android
synced 2025-02-02 20:53:09 +00:00
don't allow to post/delete reaction without permission
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
bae65ebbe9
commit
36383dfcc6
@ -2492,6 +2492,7 @@ class ChatController(args: Bundle) :
|
||||
currentConversation,
|
||||
chatMessage,
|
||||
conversationUser,
|
||||
hasChatPermission,
|
||||
ncApi!!
|
||||
).show()
|
||||
}
|
||||
@ -2519,6 +2520,7 @@ class ChatController(args: Bundle) :
|
||||
conversationUser,
|
||||
currentConversation,
|
||||
isShowMessageDeletionButton(message),
|
||||
hasChatPermission,
|
||||
ncApi!!
|
||||
).show()
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ class MessageActionsDialog(
|
||||
private val user: UserEntity?,
|
||||
private val currentConversation: Conversation?,
|
||||
private val showMessageDeletionButton: Boolean,
|
||||
private val hasChatPermission: Boolean,
|
||||
private val ncApi: NcApi
|
||||
) : BottomSheetDialog(chatController.activity!!, R.style.BottomSheetDialogThemeNoFloating) {
|
||||
|
||||
@ -71,7 +72,7 @@ class MessageActionsDialog(
|
||||
setContentView(dialogMessageActionsBinding.root)
|
||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
|
||||
initEmojiBar()
|
||||
initEmojiBar(hasChatPermission)
|
||||
initMenuItemCopy(!message.isDeleted)
|
||||
initMenuReplyToMessage(message.replyable)
|
||||
initMenuReplyPrivately(
|
||||
@ -160,8 +161,9 @@ class MessageActionsDialog(
|
||||
}
|
||||
}
|
||||
|
||||
private fun initEmojiBar() {
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions") &&
|
||||
private fun initEmojiBar(hasChatPermission: Boolean) {
|
||||
if (hasChatPermission &&
|
||||
CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions") &&
|
||||
Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY !=
|
||||
currentConversation?.conversationReadOnlyState &&
|
||||
isReactableMessageType(message)
|
||||
|
@ -63,6 +63,7 @@ class ShowReactionsDialog(
|
||||
private val currentConversation: Conversation?,
|
||||
private val chatMessage: ChatMessage,
|
||||
private val userEntity: UserEntity?,
|
||||
private val hasChatPermission: Boolean,
|
||||
private val ncApi: NcApi
|
||||
) : BottomSheetDialog(activity), ReactionItemClickListener {
|
||||
|
||||
@ -183,7 +184,7 @@ class ShowReactionsDialog(
|
||||
}
|
||||
|
||||
override fun onClick(reactionItem: ReactionItem) {
|
||||
if (reactionItem.reactionVoter.actorId?.equals(userEntity?.userId) == true) {
|
||||
if (hasChatPermission && reactionItem.reactionVoter.actorId?.equals(userEntity?.userId) == true) {
|
||||
deleteReaction(chatMessage, reactionItem.reaction!!)
|
||||
dismiss()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user