File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ def unarchive(user_id)
222222 end
223223
224224 # Updates a member partially in the channel.
225- sig { params ( user_id : String , set : T . nilable ( StringKeyHash ) , unset : T . nilable ( StringKeyHash ) ) . returns ( StreamChat ::StreamResponse ) }
225+ sig { params ( user_id : String , set : T . nilable ( StringKeyHash ) , unset : T . nilable ( T :: Array [ String ] ) ) . returns ( StreamChat ::StreamResponse ) }
226226 def update_member_partial ( user_id , set : nil , unset : nil )
227227 raise StreamChannelException , 'user ID must not be empty' if user_id . empty?
228228 raise StreamChannelException , 'set or unset is required' if set . nil? && unset . nil?
Original file line number Diff line number Diff line change @@ -338,4 +338,17 @@ def loop_times(times)
338338 expect ( response [ 'channels' ] . length ) . to eq 1
339339 expect ( response [ 'channels' ] [ 0 ] [ 'channel' ] [ 'cid' ] ) . to eq @channel . cid
340340 end
341+
342+ it 'can update channel member partially' do
343+ @channel . add_members ( [ @random_users [ 0 ] [ :id ] ] )
344+
345+ # Test setting a field
346+ response = @channel . update_member_partial ( @random_users [ 0 ] [ :id ] , set : { 'hat' => 'blue' } )
347+ expect ( response [ 'channel_member' ] [ 'hat' ] ) . to eq 'blue'
348+
349+ # Test setting and unsetting fields
350+ response = @channel . update_member_partial ( @random_users [ 0 ] [ :id ] , set : { 'color' => 'red' } , unset : [ 'hat' ] )
351+ expect ( response [ 'channel_member' ] [ 'color' ] ) . to eq 'red'
352+ expect ( response [ 'channel_member' ] ) . not_to have_key ( 'hat' )
353+ end
341354end
You can’t perform that action at this time.
0 commit comments