@@ -207,15 +207,14 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
207207 const isLegacyPinned = ! ! legacyPinned ?. [ widget . id ] ;
208208 const defaultContainer = WidgetType . JITSI . matches ( widget . type ) ? Container . Top : Container . Right ;
209209
210- if ( manualContainer === Container . Right ) {
211- rightWidgets . push ( widget ) ;
212- } else if ( manualContainer === Container . Top || stateContainer === Container . Top ) {
213- topWidgets . push ( widget ) ;
210+ let targetContainer = defaultContainer ;
211+ if ( ! ! manualContainer || ! ! stateContainer ) {
212+ targetContainer = ( manualContainer ) ? manualContainer : stateContainer ;
214213 } else if ( isLegacyPinned && ! stateContainer ) {
215- topWidgets . push ( widget ) ;
216- } else {
217- ( defaultContainer === Container . Top ? topWidgets : rightWidgets ) . push ( widget ) ;
214+ // Special legacy case
215+ targetContainer = Container . Top ;
218216 }
217+ ( targetContainer === Container . Top ? topWidgets : rightWidgets ) . push ( widget ) ;
219218 }
220219
221220 // Trim to MAX_PINNED
@@ -423,7 +422,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
423422
424423 public moveToContainer ( room : Room , widget : IApp , toContainer : Container ) {
425424 const allWidgets = this . getAllWidgets ( room ) ;
426- if ( ! allWidgets . some ( ( [ w ] ) => w . id === widget . id ) ) return ; // invalid
425+ if ( ! allWidgets . some ( ( [ w ] ) => w . id === widget . id ) ) return ; // invalid
427426 this . updateUserLayout ( room , {
428427 [ widget . id ] : { container : toContainer } ,
429428 } ) ;
0 commit comments