Merge pull request #3822 from nextcloud/bugfix/noid/fixCanModerate

Bugfix/noid/fix can moderate
This commit is contained in:
Sowjanya Kota 2024-04-12 14:54:19 +02:00 committed by GitHub
commit d8e6a4a135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,9 +22,7 @@ import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter
import com.nextcloud.talk.models.json.converters.EnumReadOnlyConversationConverter
import com.nextcloud.talk.models.json.converters.EnumRoomTypeConverter
import com.nextcloud.talk.models.json.participants.Participant.ParticipantType
import com.nextcloud.talk.utils.SpreedFeatures
import com.nextcloud.talk.utils.ConversationUtils
import com.nextcloud.talk.utils.CapabilitiesUtil
import kotlinx.parcelize.Parcelize
@Parcelize
@ -173,22 +171,12 @@ data class Conversation(
ParticipantType.GUEST_MODERATOR == participantType ||
ParticipantType.MODERATOR == participantType
@Deprecated("Use ConversationUtil")
private fun isLockedOneToOne(conversationUser: User): Boolean {
return type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL &&
CapabilitiesUtil.hasSpreedFeatureCapability(
conversationUser.capabilities?.spreedCapability!!,
SpreedFeatures.LOCKED_ONE_TO_ONE_ROOMS
)
}
@Deprecated("Use ConversationUtil")
fun canModerate(conversationUser: User): Boolean {
return isParticipantOwnerOrModerator &&
ConversationUtils.isLockedOneToOne(
!ConversationUtils.isLockedOneToOne(
ConversationModel.mapToConversationModel(this),
conversationUser
.capabilities?.spreedCapability!!
conversationUser.capabilities?.spreedCapability!!
) &&
type != ConversationType.FORMER_ONE_TO_ONE &&
!ConversationUtils.isNoteToSelfConversation(ConversationModel.mapToConversationModel(this))