From d7be364d3c8810082b76e2bb1c20deb69bed75b6 Mon Sep 17 00:00:00 2001 From: ayushpanwar25 Date: Tue, 18 Jul 2023 12:08:55 +0530 Subject: [PATCH 1/2] autosave disable in view mode --- src/ui/pages/container/Label-Studio/LSF.jsx | 3 +++ src/ui/pages/container/Label-Studio/ReviewLSF.jsx | 2 ++ src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx | 1 + 3 files changed, 6 insertions(+) diff --git a/src/ui/pages/container/Label-Studio/LSF.jsx b/src/ui/pages/container/Label-Studio/LSF.jsx index 62f542de2..498e2325f 100644 --- a/src/ui/pages/container/Label-Studio/LSF.jsx +++ b/src/ui/pages/container/Label-Studio/LSF.jsx @@ -145,6 +145,9 @@ const filterAnnotations = ( } } else if([4, 5, 6].includes(user.role)) { filteredAnnotations = annotations.filter((a) => a.annotation_type === 1); + disable = true; + setDisableBtns(true); + disableSkip = true; } return [filteredAnnotations, disable, disableSkip]; }; diff --git a/src/ui/pages/container/Label-Studio/ReviewLSF.jsx b/src/ui/pages/container/Label-Studio/ReviewLSF.jsx index 873a52986..16c2e543f 100644 --- a/src/ui/pages/container/Label-Studio/ReviewLSF.jsx +++ b/src/ui/pages/container/Label-Studio/ReviewLSF.jsx @@ -190,6 +190,8 @@ const filterAnnotations = ( } } else if([4, 5, 6].includes(user.role)) { filteredAnnotations = annotations.filter((a) => a.annotation_type === 2); + disable = true; + setDisableBtns(true); disableSkip = true; } return [filteredAnnotations, disable, disableSkip]; diff --git a/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx b/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx index 88e227514..6242462d1 100644 --- a/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx +++ b/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx @@ -221,6 +221,7 @@ const LabelStudioWrapper = ({ let interfaces = []; if (predictions == null) predictions = []; const [filteredAnnotations, disableSkip] = filterAnnotations(annotations, userData); + if(disableSkip) setAutoSave(false); if (taskData.task_status === "freezed") { interfaces = [ From 7c6f84c74639bcd1bbb1a0a6ae375e4bc7ee099d Mon Sep 17 00:00:00 2001 From: ayushpanwar25 Date: Tue, 18 Jul 2023 12:14:34 +0530 Subject: [PATCH 2/2] minor fix --- src/ui/pages/container/Label-Studio/LSF.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/pages/container/Label-Studio/LSF.jsx b/src/ui/pages/container/Label-Studio/LSF.jsx index 498e2325f..f364cdd4c 100644 --- a/src/ui/pages/container/Label-Studio/LSF.jsx +++ b/src/ui/pages/container/Label-Studio/LSF.jsx @@ -324,7 +324,8 @@ const LabelStudioWrapper = ({ ]; } - if(disableLSFControls) setAutoSave(false); + if(disableLSFControls || !taskData?.annotation_users?.some( + (user) => user === userData.id)) setAutoSave(false); if (rootRef.current) { if (lsfRef.current) {