Skip to content

Commit 23d509b

Browse files
committed
fix: if submission has been reviewed do not allow cancellation
1 parent 3a3757d commit 23d509b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

functions/https/postCancelCorner.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,25 @@ export const cancelCorner = async (data, uid) => {
2020
const reference = db.collection('submissions').doc(data.key);
2121
const snapshot = await reference.get();
2222

23+
if (!snapshot.exists) {
24+
throw new https.HttpsError('not-found', 'corner submission not found');
25+
}
26+
27+
const data = snapshot.data();
28+
if (
29+
data.status?.ugrc?.reviewedAt ||
30+
data.status?.county?.reviewedAt ||
31+
data.published === true ||
32+
data.sgid.approved === true
33+
) {
34+
logger.info('skipping cancellation because of status', {
35+
status: data.status,
36+
published: data.published,
37+
});
38+
39+
return 0; // Already reviewed, cannot cancel
40+
}
41+
2342
logger.debug('cancelling submission', { key: data.key });
2443

2544
await reference.set(

0 commit comments

Comments
 (0)