mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-11 14:05:14 +01: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,
|
currentConversation,
|
||||||
chatMessage,
|
chatMessage,
|
||||||
conversationUser,
|
conversationUser,
|
||||||
|
hasChatPermission,
|
||||||
ncApi!!
|
ncApi!!
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
@ -2519,6 +2520,7 @@ class ChatController(args: Bundle) :
|
|||||||
conversationUser,
|
conversationUser,
|
||||||
currentConversation,
|
currentConversation,
|
||||||
isShowMessageDeletionButton(message),
|
isShowMessageDeletionButton(message),
|
||||||
|
hasChatPermission,
|
||||||
ncApi!!
|
ncApi!!
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ class MessageActionsDialog(
|
|||||||
private val user: UserEntity?,
|
private val user: UserEntity?,
|
||||||
private val currentConversation: Conversation?,
|
private val currentConversation: Conversation?,
|
||||||
private val showMessageDeletionButton: Boolean,
|
private val showMessageDeletionButton: Boolean,
|
||||||
|
private val hasChatPermission: Boolean,
|
||||||
private val ncApi: NcApi
|
private val ncApi: NcApi
|
||||||
) : BottomSheetDialog(chatController.activity!!, R.style.BottomSheetDialogThemeNoFloating) {
|
) : BottomSheetDialog(chatController.activity!!, R.style.BottomSheetDialogThemeNoFloating) {
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ class MessageActionsDialog(
|
|||||||
setContentView(dialogMessageActionsBinding.root)
|
setContentView(dialogMessageActionsBinding.root)
|
||||||
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
|
|
||||||
initEmojiBar()
|
initEmojiBar(hasChatPermission)
|
||||||
initMenuItemCopy(!message.isDeleted)
|
initMenuItemCopy(!message.isDeleted)
|
||||||
initMenuReplyToMessage(message.replyable)
|
initMenuReplyToMessage(message.replyable)
|
||||||
initMenuReplyPrivately(
|
initMenuReplyPrivately(
|
||||||
@ -160,8 +161,9 @@ class MessageActionsDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initEmojiBar() {
|
private fun initEmojiBar(hasChatPermission: Boolean) {
|
||||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions") &&
|
if (hasChatPermission &&
|
||||||
|
CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions") &&
|
||||||
Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY !=
|
Conversation.ConversationReadOnlyState.CONVERSATION_READ_ONLY !=
|
||||||
currentConversation?.conversationReadOnlyState &&
|
currentConversation?.conversationReadOnlyState &&
|
||||||
isReactableMessageType(message)
|
isReactableMessageType(message)
|
||||||
|
@ -63,6 +63,7 @@ class ShowReactionsDialog(
|
|||||||
private val currentConversation: Conversation?,
|
private val currentConversation: Conversation?,
|
||||||
private val chatMessage: ChatMessage,
|
private val chatMessage: ChatMessage,
|
||||||
private val userEntity: UserEntity?,
|
private val userEntity: UserEntity?,
|
||||||
|
private val hasChatPermission: Boolean,
|
||||||
private val ncApi: NcApi
|
private val ncApi: NcApi
|
||||||
) : BottomSheetDialog(activity), ReactionItemClickListener {
|
) : BottomSheetDialog(activity), ReactionItemClickListener {
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ class ShowReactionsDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(reactionItem: ReactionItem) {
|
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!!)
|
deleteReaction(chatMessage, reactionItem.reaction!!)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user