diff --git a/designer_v2/lib/features/study/study_controller_state.dart b/designer_v2/lib/features/study/study_controller_state.dart index bd31b0813..ddae66487 100644 --- a/designer_v2/lib/features/study/study_controller_state.dart +++ b/designer_v2/lib/features/study/study_controller_state.dart @@ -69,6 +69,9 @@ class StudyControllerState extends StudyControllerBaseState implements IStudyApp @override bool get isPublishVisible => studyWithMetadata?.model.status == StudyStatus.draft; + @override + bool get isClosedVisible => studyWithMetadata?.model.status == StudyStatus.running && studyWithMetadata!.model.canEdit(super.currentUser); + @override StudyStatus? get studyStatus => study.value?.status; diff --git a/designer_v2/lib/features/study/study_scaffold.dart b/designer_v2/lib/features/study/study_scaffold.dart index 4536e38bc..b261601f2 100644 --- a/designer_v2/lib/features/study/study_scaffold.dart +++ b/designer_v2/lib/features/study/study_scaffold.dart @@ -26,6 +26,7 @@ abstract class IStudyAppBarViewModel implements IStudyStatusBadgeViewModel, IStu bool get isSyncIndicatorVisible; bool get isStatusBadgeVisible; bool get isPublishVisible; + bool get isClosedVisible; } /// Custom scaffold shared between all pages for an individual [Study] @@ -237,7 +238,7 @@ class _StudyScaffoldState extends ConsumerState { actionButtons.add(const SizedBox(width: 12.0)); // padding } - if (state.isPublished) { + if (state.isClosedVisible) { final formViewModel = ref.watch(studyPublishValidatorProvider(widget.studyId)); final closeButton = ReactiveForm( formGroup: formViewModel.form,