@@ -370,6 +370,64 @@ def test_update_message_partial(
370370 assert response ["message" ]["text" ] == "helloworld"
371371 assert response ["message" ]["awesome" ] is True
372372
373+ def test_update_message_restricted_visibility (
374+ self , client : StreamChat , channel : Channel , random_user : Dict
375+ ):
376+ # Create test users first
377+ restricted_users = [
378+ {"id" : "amy" , "name" : "Amy" },
379+ {"id" : "paul" , "name" : "Paul" },
380+ ]
381+ client .upsert_users (restricted_users )
382+
383+ # Add users to channel
384+ channel .add_members ([u ["id" ] for u in restricted_users ])
385+
386+ # Send initial message
387+ msg_id = str (uuid .uuid4 ())
388+ response = channel .send_message (
389+ {"id" : msg_id , "text" : "hello world" }, random_user ["id" ]
390+ )
391+ assert response ["message" ]["text" ] == "hello world"
392+
393+ # Update message with restricted visibility
394+ response = client .update_message (
395+ {
396+ "id" : msg_id ,
397+ "text" : "helloworld" ,
398+ "restricted_visibility" : ["amy" , "paul" ],
399+ "user" : {"id" : response ["message" ]["user" ]["id" ]},
400+ }
401+ )
402+ assert response ["message" ]["text" ] == "helloworld"
403+ assert response ["message" ]["restricted_visibility" ] == ["amy" , "paul" ]
404+
405+ def test_update_message_partial_restricted_visibility (
406+ self , client : StreamChat , channel : Channel , random_user : Dict
407+ ):
408+ # Create test users first
409+ restricted_users = [
410+ {"id" : "amy" , "name" : "Amy" },
411+ {"id" : "paul" , "name" : "Paul" },
412+ ]
413+ client .upsert_users (restricted_users )
414+
415+ # Add users to channel
416+ channel .add_members ([u ["id" ] for u in restricted_users ])
417+
418+ msg_id = str (uuid .uuid4 ())
419+ response = channel .send_message (
420+ {"id" : msg_id , "text" : "hello world" }, random_user ["id" ]
421+ )
422+ assert response ["message" ]["text" ] == "hello world"
423+ response = client .update_message_partial (
424+ msg_id ,
425+ dict (set = dict (text = "helloworld" , restricted_visibility = ["amy" ])),
426+ random_user ["id" ],
427+ )
428+
429+ assert response ["message" ]["restricted_visibility" ] == ["amy" ]
430+
373431 def test_delete_message (self , client : StreamChat , channel , random_user : Dict ):
374432 msg_id = str (uuid .uuid4 ())
375433 channel .send_message ({"id" : msg_id , "text" : "helloworld" }, random_user ["id" ])
0 commit comments