Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: LEAP-1060: Add event to allow control annotations submitting #5891

Merged
merged 9 commits into from
May 23, 2024
14 changes: 10 additions & 4 deletions web/libs/editor/src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,15 @@ export default types

if (!entity.validate()) return;

entity.sendUserGenerate();
handleSubmittingFlag(async () => {
const allowedToSave = await getEnv(self).events.invoke("beforeSaveAnnotation", self, entity);
if (allowedToSave && allowedToSave.some((x) => x === false)) return;

entity.sendUserGenerate();
await getEnv(self).events.invoke(event, self, entity);
self.incrementQueuePosition();
entity.dropDraft();
});
entity.dropDraft();
}

function updateAnnotation(extraData) {
Expand All @@ -561,11 +564,14 @@ export default types
if (!entity.validate()) return;

handleSubmittingFlag(async () => {
const allowedToSave = await getEnv(self).events.invoke("beforeSaveAnnotation", self, entity);
if (allowedToSave && allowedToSave.some((x) => x === false)) return;

await getEnv(self).events.invoke("updateAnnotation", self, entity, extraData);
self.incrementQueuePosition();
entity.dropDraft();
!entity.sentUserGenerate && entity.sendUserGenerate();
});
entity.dropDraft();
!entity.sentUserGenerate && entity.sendUserGenerate();
}

function skipTask(extraData) {
Expand Down
Loading