@@ -345,9 +345,9 @@ interface IRundownHeaderProps {
345345 rundownIds : RundownId [ ]
346346 firstRundown : Rundown | undefined
347347 onActivate ?: ( isRehearsal : boolean ) => void
348- studioMode : boolean
349348 inActiveRundownView ?: boolean
350349 layout : RundownLayoutRundownHeader | undefined
350+ userPermissions : Readonly < UserLevel >
351351}
352352
353353interface IRundownHeaderState {
@@ -439,7 +439,7 @@ const RundownHeader = withTranslation()(
439439 disableNextPiece = ( e : any ) => {
440440 const { t } = this . props
441441
442- if ( this . props . studioMode ) {
442+ if ( this . props . userPermissions . studio ) {
443443 doUserAction (
444444 t ,
445445 e ,
@@ -453,7 +453,7 @@ const RundownHeader = withTranslation()(
453453 disableNextPieceUndo = ( e : any ) => {
454454 const { t } = this . props
455455
456- if ( this . props . studioMode ) {
456+ if ( this . props . userPermissions . studio ) {
457457 doUserAction (
458458 t ,
459459 e ,
@@ -466,7 +466,7 @@ const RundownHeader = withTranslation()(
466466
467467 take = ( e : any ) => {
468468 const { t } = this . props
469- if ( this . props . studioMode ) {
469+ if ( this . props . userPermissions . studio ) {
470470 if ( ! this . props . playlist . activationId ) {
471471 const onSuccess = ( ) => {
472472 if ( typeof this . props . onActivate === 'function' ) this . props . onActivate ( false )
@@ -537,7 +537,7 @@ const RundownHeader = withTranslation()(
537537
538538 hold = ( e : any ) => {
539539 const { t } = this . props
540- if ( this . props . studioMode && this . props . playlist . activationId ) {
540+ if ( this . props . userPermissions . studio && this . props . playlist . activationId ) {
541541 doUserAction ( t , e , UserAction . ACTIVATE_HOLD , ( e , ts ) =>
542542 MeteorCall . userAction . activateHold ( e , ts , this . props . playlist . _id , false )
543543 )
@@ -547,7 +547,7 @@ const RundownHeader = withTranslation()(
547547 holdUndo = ( e : any ) => {
548548 const { t } = this . props
549549 if (
550- this . props . studioMode &&
550+ this . props . userPermissions . studio &&
551551 this . props . playlist . activationId &&
552552 this . props . playlist . holdState === RundownHoldState . PENDING
553553 ) {
@@ -644,7 +644,7 @@ const RundownHeader = withTranslation()(
644644 if ( e . persist ) e . persist ( )
645645
646646 if (
647- this . props . studioMode &&
647+ this . props . userPermissions . studio &&
648648 ( ! this . props . playlist . activationId || ( this . props . playlist . activationId && this . props . playlist . rehearsal ) )
649649 ) {
650650 const onSuccess = ( ) => {
@@ -718,7 +718,7 @@ const RundownHeader = withTranslation()(
718718 if ( e . persist ) e . persist ( )
719719
720720 if (
721- this . props . studioMode &&
721+ this . props . userPermissions . studio &&
722722 ( ! this . props . playlist . activationId || ( this . props . playlist . activationId && ! this . props . playlist . rehearsal ) )
723723 ) {
724724 const onSuccess = ( ) => {
@@ -798,7 +798,7 @@ const RundownHeader = withTranslation()(
798798 const { t } = this . props
799799 if ( e . persist ) e . persist ( )
800800
801- if ( this . props . studioMode && this . props . playlist . activationId ) {
801+ if ( this . props . userPermissions . studio && this . props . playlist . activationId ) {
802802 if ( this . rundownShouldHaveStarted ( ) ) {
803803 if ( this . props . playlist . rehearsal ) {
804804 // We're in rehearsal mode
@@ -830,7 +830,7 @@ const RundownHeader = withTranslation()(
830830 if ( e . persist ) e . persist ( )
831831
832832 if (
833- this . props . studioMode &&
833+ this . props . userPermissions . studio &&
834834 this . props . studio . settings . allowAdlibTestingSegment &&
835835 this . props . playlist . activationId &&
836836 this . props . currentRundown
@@ -880,15 +880,15 @@ const RundownHeader = withTranslation()(
880880
881881 reloadRundownPlaylist = ( e : any ) => {
882882 const { t } = this . props
883- if ( this . props . studioMode ) {
883+ if ( this . props . userPermissions . studio ) {
884884 doUserAction (
885885 t ,
886886 e ,
887887 UserAction . RELOAD_RUNDOWN_PLAYLIST_DATA ,
888888 ( e , ts ) => MeteorCall . userAction . resyncRundownPlaylist ( e , ts , this . props . playlist . _id ) ,
889889 ( err , reloadResponse ) => {
890890 if ( ! err && reloadResponse ) {
891- if ( ! handleRundownPlaylistReloadResponse ( t , reloadResponse ) ) {
891+ if ( ! handleRundownPlaylistReloadResponse ( t , this . props . userPermissions , reloadResponse ) ) {
892892 if ( this . props . playlist && this . props . playlist . nextPartInfo ) {
893893 scrollToPartInstance ( this . props . playlist . nextPartInfo . partInstanceId ) . catch ( ( error ) => {
894894 if ( ! error . toString ( ) . match ( / a n o t h e r s c r o l l / ) ) console . warn ( error )
@@ -903,7 +903,7 @@ const RundownHeader = withTranslation()(
903903
904904 takeRundownSnapshot = ( e : any ) => {
905905 const { t } = this . props
906- if ( this . props . studioMode ) {
906+ if ( this . props . userPermissions . studio ) {
907907 const doneMessage = t ( 'A snapshot of the current Running\xa0Order has been created for troubleshooting.' )
908908 doUserAction (
909909 t ,
@@ -946,7 +946,7 @@ const RundownHeader = withTranslation()(
946946
947947 resetAndActivateRundown = ( e : any ) => {
948948 // Called from the ModalDialog, 1 minute before broadcast starts
949- if ( this . props . studioMode ) {
949+ if ( this . props . userPermissions . studio ) {
950950 const { t } = this . props
951951 this . rewindSegments ( ) // Do a rewind right away
952952
@@ -998,7 +998,7 @@ const RundownHeader = withTranslation()(
998998 < Escape to = "document" >
999999 < ContextMenu id = "rundown-context-menu" >
10001000 < div className = "react-contextmenu-label" > { this . props . playlist && this . props . playlist . name } </ div >
1001- { this . props . studioMode ? (
1001+ { this . props . userPermissions . studio ? (
10021002 < React . Fragment >
10031003 { ! ( this . props . playlist . activationId && this . props . playlist . rehearsal ) ? (
10041004 ! this . rundownShouldHaveStarted ( ) && ! this . props . playlist . activationId ? (
@@ -1062,7 +1062,7 @@ const RundownHeader = withTranslation()(
10621062 holdToDisplay = { contextMenuHoldToDisplayTime ( ) }
10631063 >
10641064 < WarningDisplay
1065- studioMode = { this . props . studioMode }
1065+ studioMode = { this . props . userPermissions . studio }
10661066 inActiveRundownView = { this . props . inActiveRundownView }
10671067 playlist = { this . props . playlist }
10681068 oneMinuteBeforeAction = { this . resetAndActivateRundown }
@@ -1072,7 +1072,7 @@ const RundownHeader = withTranslation()(
10721072 < div className = "badge mod" >
10731073 < Tooltip
10741074 overlay = { t ( 'Add ?studio=1 to the URL to enter studio mode' ) }
1075- visible = { getHelpMode ( ) && ! getAllowStudio ( ) }
1075+ visible = { getHelpMode ( ) && ! this . props . userPermissions . studio }
10761076 placement = "bottom"
10771077 >
10781078 < div className = "media-elem mrs sofie-logo" />
@@ -1089,7 +1089,7 @@ const RundownHeader = withTranslation()(
10891089 showStyleBase = { this . props . showStyleBase }
10901090 showStyleVariant = { this . props . showStyleVariant }
10911091 studio = { this . props . studio }
1092- studioMode = { this . props . studioMode }
1092+ studioMode = { this . props . userPermissions . studio }
10931093 shouldQueue = { this . state . shouldQueue }
10941094 onChangeQueueAdLib = { this . changeQueueAdLib }
10951095 selectedPiece = { this . state . selectedPiece }
@@ -2966,7 +2966,7 @@ const RundownViewContent = translateWithTracker<IPropsWithReady, IState, ITracke
29662966 rundownIds = { this . props . rundowns . map ( ( r ) => r . _id ) }
29672967 firstRundown = { this . props . rundowns [ 0 ] }
29682968 onActivate = { this . onActivate }
2969- studioMode = { this . props . userPermissions . studio }
2969+ userPermissions = { this . props . userPermissions }
29702970 inActiveRundownView = { this . props . inActiveRundownView }
29712971 currentRundown = { this . state . currentRundown || this . props . rundowns [ 0 ] }
29722972 layout = { this . state . rundownHeaderLayout }
@@ -3298,7 +3298,11 @@ const RundownViewContent = translateWithTracker<IPropsWithReady, IState, ITracke
32983298 }
32993299)
33003300
3301- function handleRundownPlaylistReloadResponse ( t : i18next . TFunction , result : ReloadRundownPlaylistResponse ) : boolean {
3301+ function handleRundownPlaylistReloadResponse (
3302+ t : i18next . TFunction ,
3303+ userPermissions : Readonly < UserLevel > ,
3304+ result : ReloadRundownPlaylistResponse
3305+ ) : boolean {
33023306 const rundownsInNeedOfHandling = result . rundownsResponses . filter (
33033307 ( r ) => r . response === TriggerReloadDataResponse . MISSING
33043308 )
@@ -3334,7 +3338,7 @@ function handleRundownPlaylistReloadResponse(t: i18next.TFunction, result: Reloa
33343338 }
33353339
33363340 const handled = rundownsInNeedOfHandling . map ( ( r ) =>
3337- handleRundownReloadResponse ( t , r . rundownId , r . response , onActionTaken )
3341+ handleRundownReloadResponse ( t , userPermissions , r . rundownId , r . response , onActionTaken )
33383342 )
33393343 return handled . reduce ( ( previousValue , value ) => previousValue || value , false )
33403344}
@@ -3343,6 +3347,7 @@ type RundownReloadResponseUserAction = 'removed' | 'unsynced' | 'error'
33433347
33443348export function handleRundownReloadResponse (
33453349 t : i18next . TFunction ,
3350+ userPermissions : Readonly < UserLevel > ,
33463351 rundownId : RundownId ,
33473352 result : TriggerReloadDataResponse ,
33483353 clb ?: ( action : RundownReloadResponseUserAction ) => void
0 commit comments