@@ -65,7 +65,7 @@ export default class PublicStreamSidePanel extends Component<Args> {
65
65
'lightcoral' , 'lightsalmon' , 'lightseagreen' , 'limegreen' ,
66
66
'maroon' , 'mediumorchid' , 'mediumpurple' , 'mediumspringgreen' ] ;
67
67
68
- async fetchTranslationChannels ( streamId : string ) : Promise < void > {
68
+ async fetchTranslationChannels ( streamId : string ) : Promise < any [ ] | undefined > {
69
69
const response = await this . loader . load ( `/video-streams/${ streamId } /translation_channels` ) ;
70
70
if ( response . data !== undefined && response . data . length > 0 ) {
71
71
const newChannels = response . data . map ( ( channel : ChannelData ) => ( {
@@ -74,9 +74,10 @@ export default class PublicStreamSidePanel extends Component<Args> {
74
74
url : channel . attributes . url
75
75
} ) ) ;
76
76
// Append newChannels to the existing translationChannels list
77
- this . translationChannels = [ ...this . translationChannels , ...newChannels ] ;
78
- // eslint-disable-next-line no-mixed-spaces-and-tabs
77
+ const res = [ ...this . translationChannels , ...newChannels ] ;
78
+ return res ;
79
79
}
80
+ return undefined ;
80
81
}
81
82
82
83
async checkSpeakers ( ) : Promise < void > {
@@ -113,9 +114,6 @@ export default class PublicStreamSidePanel extends Component<Args> {
113
114
114
115
@action
115
116
async setup ( ) : Promise < void > {
116
- if ( this . args . videoStream ) {
117
- this . fetchTranslationChannels ( this . args . videoStream . id ) ;
118
- }
119
117
this . shown = this . args . shown || Boolean ( new URLSearchParams ( location . search ) . get ( 'side_panel' ) ) ;
120
118
this . addStream ( this . args . event . belongsTo ( 'videoStream' ) . value ( ) ) ;
121
119
@@ -138,7 +136,9 @@ export default class PublicStreamSidePanel extends Component<Args> {
138
136
chatRoomName : rooms . data . filter ( ( room : any ) => room . relationships [ 'video-stream' ] . data ? room . relationships [ 'video-stream' ] . data . id === stream . id : null ) . map ( ( room : any ) => room . attributes [ 'chat-room-name' ] ) [ 0 ] ,
139
137
microlocationId : rooms . data . filter ( ( room : any ) => room . relationships [ 'video-stream' ] . data ? room . relationships [ 'video-stream' ] . data . id === stream . id : null ) . map ( ( room : any ) => room . id ) [ 0 ] ,
140
138
hash : stringHashCode ( stream . attributes . name + stream . id )
141
- } ) ) . forEach ( ( stream : any ) => {
139
+ } ) ) . forEach ( async ( stream : any ) => {
140
+ const res = await this . fetchTranslationChannels ( stream . id )
141
+ stream . translations = res
142
142
this . addStream ( stream )
143
143
} ) ;
144
144
} catch ( e ) {
0 commit comments