Added actor profile revisions.
This commit is contained in:
@@ -14,6 +14,7 @@ import { curateMedia } from './media.js';
|
||||
import escape from '../utils/escape-manticore.js';
|
||||
import promiseProps from '../utils/promise-props.js';
|
||||
import initLogger from './logger.js';
|
||||
import { curateRevision } from './revisions.js';
|
||||
|
||||
const logger = initLogger();
|
||||
const mj = new MerkleJson();
|
||||
@@ -58,8 +59,6 @@ function curateScene(rawScene, assets) {
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log(assets.chapters);
|
||||
|
||||
const curatedScene = {
|
||||
id: rawScene.id,
|
||||
title: rawScene.title,
|
||||
@@ -634,30 +633,6 @@ export async function fetchScenes(filters, rawOptions, reqUser) {
|
||||
};
|
||||
}
|
||||
|
||||
function curateRevision(revision) {
|
||||
return {
|
||||
id: revision.id,
|
||||
sceneId: revision.scene_id,
|
||||
base: revision.base,
|
||||
deltas: revision.deltas,
|
||||
hash: revision.hash,
|
||||
comment: revision.comment,
|
||||
user: revision.user_id && {
|
||||
id: revision.user_id,
|
||||
username: revision.username,
|
||||
},
|
||||
review: typeof revision.approved === 'boolean' ? {
|
||||
isApproved: revision.approved,
|
||||
userId: revision.reviewed_by,
|
||||
username: revision.reviewer_username,
|
||||
reviewedAt: revision.reviewed_at,
|
||||
} : null,
|
||||
appliedAt: revision.applied_at,
|
||||
failed: revision.failed,
|
||||
createdAt: revision.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
|
||||
const limit = filters.limit || 50;
|
||||
const page = filters.page || 1;
|
||||
@@ -727,6 +702,9 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
|
||||
|
||||
const keyMap = {
|
||||
productionDate: 'production_date',
|
||||
productionLocation: 'production_location',
|
||||
productionCity: 'production_city',
|
||||
productionState: 'production_state',
|
||||
};
|
||||
|
||||
async function applySceneValueDelta(sceneId, delta, trx) {
|
||||
@@ -952,6 +930,7 @@ export async function createSceneRevision(sceneId, { edits, comment, apply }, re
|
||||
.returning('id');
|
||||
|
||||
if (['admin', 'editor'].includes(reqUser.role) && apply) {
|
||||
await reviewSceneRevision(revisionEntry.id, true, {}, reqUser);
|
||||
// don't keep the editor waiting for the revision to apply
|
||||
reviewSceneRevision(revisionEntry.id, true, {}, reqUser);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user