This repository was archived by the owner on Mar 31, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -248,16 +248,17 @@ impl ZulipApi {
248248 } ;
249249
250250 if !add_ids. is_empty ( ) {
251- let subscriptions = serde_json:: to_string ( & serde_json:: json!( {
251+ let subscriptions = serde_json:: to_string ( & serde_json:: json!( [ {
252252 "name" : stream_name,
253- "description" : ""
254- } ) ) ?;
253+ } ] ) ) ?;
255254 let add_ids = serialize_as_array ( add_ids) ;
256255 submit ( reqwest:: Method :: POST , subscriptions, add_ids) ?;
257256 }
258257
259258 if !remove_ids. is_empty ( ) {
260- let subscriptions = serde_json:: to_string ( & serde_json:: json!( [ stream_name] ) ) ?;
259+ let subscriptions = serde_json:: to_string ( & serde_json:: json!( [ {
260+ "name" : stream_name,
261+ } ] ) ) ?;
261262 let remove_ids = serialize_as_array ( remove_ids) ;
262263 submit ( reqwest:: Method :: DELETE , subscriptions, remove_ids) ?;
263264 }
@@ -286,12 +287,7 @@ impl ZulipApi {
286287
287288/// Serialize a slice of numbers as a JSON array
288289fn serialize_as_array ( items : & [ u64 ] ) -> String {
289- let items = items
290- . iter ( )
291- . map ( |id| id. to_string ( ) )
292- . collect :: < Vec < _ > > ( )
293- . join ( "," ) ;
294- format ! ( "[{items}]" )
290+ serde_json:: to_string ( & items) . expect ( "cannot serialize JSON array" )
295291}
296292
297293/// A collection of Zulip users
You can’t perform that action at this time.
0 commit comments