@@ -48,11 +48,12 @@ class ParticipantPermissionsTest : TestCase() {
4848 }
4949
5050 @Test
51- fun test_reactPermissionSet () {
51+ fun test_reactPermissionWithReactCapability () {
5252 val spreedCapability = SpreedCapability ()
53- spreedCapability.features = listOf (" chat -permission" )
53+ spreedCapability.features = listOf (" react -permission" )
5454 val conversation = createConversation()
5555
56+ // With react-permission capability, only REACT bit matters
5657 conversation.permissions = ParticipantPermissions .REACT or
5758 ParticipantPermissions .CUSTOM
5859
@@ -70,12 +71,36 @@ class ParticipantPermissionsTest : TestCase() {
7071 }
7172
7273 @Test
73- fun test_reactPermissionFallbackToChat () {
74+ fun test_reactPermissionDeniedWithReactCapability () {
75+ val spreedCapability = SpreedCapability ()
76+ spreedCapability.features = listOf (" react-permission" )
77+ val conversation = createConversation()
78+
79+ // With react-permission capability, only CHAT but no REACT - should NOT allow reactions
80+ conversation.permissions = ParticipantPermissions .CHAT or
81+ ParticipantPermissions .CUSTOM
82+
83+ val user = User ()
84+ user.id = 1
85+
86+ val attendeePermissions =
87+ ParticipantPermissions (
88+ spreedCapability,
89+ ConversationModel .mapToConversationModel(conversation, user)
90+ )
91+
92+ assertFalse(attendeePermissions.hasReactPermission())
93+ assertTrue(attendeePermissions.hasChatPermission())
94+ }
95+
96+ @Test
97+ fun test_reactPermissionFallbackToChatOnOlderServer () {
7498 val spreedCapability = SpreedCapability ()
99+ // Older server without react-permission capability but with chat-permission
75100 spreedCapability.features = listOf (" chat-permission" )
76101 val conversation = createConversation()
77102
78- // Only CHAT permission set, no REACT - should still allow reactions for backward compatibility
103+ // Only CHAT permission set - should allow reactions as fallback for older servers
79104 conversation.permissions = ParticipantPermissions .CHAT or
80105 ParticipantPermissions .CUSTOM
81106
@@ -92,6 +117,29 @@ class ParticipantPermissionsTest : TestCase() {
92117 assertTrue(attendeePermissions.hasChatPermission())
93118 }
94119
120+ @Test
121+ fun test_reactPermissionDeniedOnOlderServerWithoutChatPermission () {
122+ val spreedCapability = SpreedCapability ()
123+ // Older server without react-permission capability but with chat-permission
124+ spreedCapability.features = listOf (" chat-permission" )
125+ val conversation = createConversation()
126+
127+ // No CHAT permission - should deny reactions on older servers
128+ conversation.permissions = ParticipantPermissions .CUSTOM
129+
130+ val user = User ()
131+ user.id = 1
132+
133+ val attendeePermissions =
134+ ParticipantPermissions (
135+ spreedCapability,
136+ ConversationModel .mapToConversationModel(conversation, user)
137+ )
138+
139+ assertFalse(attendeePermissions.hasReactPermission())
140+ assertFalse(attendeePermissions.hasChatPermission())
141+ }
142+
95143 private fun createConversation () =
96144 Conversation (
97145 token = " test" ,
0 commit comments