Added compact revision overview, formatting duration. Preventing rejected revisions from being reviewed again.
This commit is contained in:
@@ -114,6 +114,7 @@ function curateScene(rawScene, assets) {
|
||||
priority: tag.priority,
|
||||
})),
|
||||
qualities: rawScene.qualities?.sort((qualityA, qualityB) => qualityB - qualityA) || [],
|
||||
photoCount: rawScene.photo_count,
|
||||
movies: assets.movies.map((movie) => ({
|
||||
id: movie.id,
|
||||
slug: movie.slug,
|
||||
@@ -814,9 +815,9 @@ export async function reviewSceneRevision(revisionId, isApproved, { feedback },
|
||||
throw new HttpError('You must either approve or reject the revision', 400);
|
||||
}
|
||||
|
||||
await knexOwner('scenes_revisions')
|
||||
const updated = await knexOwner('scenes_revisions')
|
||||
.where('id', revisionId)
|
||||
.whereRaw('approved is not true') // don't rerun approved and applied revision, must be forked into new revision instead
|
||||
.whereNull('approved') // don't rerun reviewed revision, must be forked into new revision instead
|
||||
.whereNull('applied_at')
|
||||
.update({
|
||||
approved: isApproved,
|
||||
@@ -825,6 +826,10 @@ export async function reviewSceneRevision(revisionId, isApproved, { feedback },
|
||||
feedback,
|
||||
});
|
||||
|
||||
if (updated === 0) {
|
||||
throw new HttpError('This revision was already reviewed', 409);
|
||||
}
|
||||
|
||||
if (isApproved) {
|
||||
await applySceneRevision([revisionId]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user