import { ChangeDetectionStrategy , ChangeDetectorRef , Component , } from '@angular/core' ; import { MessengerConversationDockpanesService } from '../../../messenger/dockpanes/dockpanes.service' ; import { MessengerConversationBuilderService } from '../../../messenger/dockpanes/conversation-builder.service' ; import { ChannelsV2Service } from '../channels-v2.service' ; import { FeaturesService } from '../../../../services/features.service' ; import { ApiService } from '../../../../common/api/api.service' ; import { ConfigsService } from '../../../../common/services/configs.service' ; /**
 * Message button (non-owner)
 */ @ Component ( { selector : 'm-channelActions__message' , changeDetection : ChangeDetectionStrategy . OnPush , templateUrl : 'message.component.html' , } ) export class ChannelActionsMessageComponent { inProgress = false ; param service param dockpanes param conversationBuilder constructor ( public service , protected dockpanes , protected conversationBuilder , protected api , protected configs , protected features , protected cd ) { } /**
     * Opens conversation pane
     */ async message ( ) { if ( this . features . has ( 'matrix' ) ) { this . inProgress = true ; try { const response = await this . api . put ( 'api/v3/matrix/room/' + this . service . channel$ . getValue ( ) . guid ) . toPromise ( ) ; this . inProgress = false ; this . detectChanges ( ) ; const roomId = response ?. room ?. id ; window . open ( this . configs . get ( 'matrix' ) ?. chat_url + '/#/room/' + roomId , 'chat' ) ; } catch { } finally { this . inProgress = false ; this . detectChanges ( ) ; } return ; } this . dockpanes . open ( this . conversationBuilder . buildConversation ( this . service . channel$ . getValue ( ) ) ) ; } detectChanges ( ) { this . cd . markForCheck ( ) ; this . cd . detectChanges ( ) ; } }