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 {
248
248
} ;
249
249
250
250
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!( [ {
252
252
"name" : stream_name,
253
- "description" : ""
254
- } ) ) ?;
253
+ } ] ) ) ?;
255
254
let add_ids = serialize_as_array ( add_ids) ;
256
255
submit ( reqwest:: Method :: POST , subscriptions, add_ids) ?;
257
256
}
258
257
259
258
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
+ } ] ) ) ?;
261
262
let remove_ids = serialize_as_array ( remove_ids) ;
262
263
submit ( reqwest:: Method :: DELETE , subscriptions, remove_ids) ?;
263
264
}
@@ -286,12 +287,7 @@ impl ZulipApi {
286
287
287
288
/// Serialize a slice of numbers as a JSON array
288
289
fn 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" )
295
291
}
296
292
297
293
/// A collection of Zulip users
You can’t perform that action at this time.
0 commit comments