File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,19 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
398
398
this . _channelURL ( ) ,
399
399
update ,
400
400
) ;
401
+
402
+ const areCapabilitiesChanged =
403
+ [ ...( data . channel . own_capabilities || [ ] ) ] . sort ( ) . join ( ) !==
404
+ [ ...( Array . isArray ( this . data ?. own_capabilities ) ? ( this . data ?. own_capabilities as string [ ] ) : [ ] ) ] . sort ( ) . join ( ) ;
401
405
this . data = data . channel ;
406
+ // If the capabiltities are changed, we trigger the `capabilities.changed` event.
407
+ if ( areCapabilitiesChanged ) {
408
+ this . getClient ( ) . dispatchEvent ( {
409
+ type : 'capabilities.changed' ,
410
+ cid : this . cid ,
411
+ own_capabilities : data . channel . own_capabilities ,
412
+ } ) ;
413
+ }
402
414
return data ;
403
415
}
404
416
You can’t perform that action at this time.
0 commit comments