Fixed false not accepted as actor edit value.

This commit is contained in:
DebaucheryLibrarian 2024-10-23 22:14:12 +02:00
parent fabd57bbef
commit eb4234e978
3 changed files with 6 additions and 9 deletions

View File

@ -657,7 +657,7 @@ const fields = computed(() => [
key: 'gender',
type: 'select',
value: actor.value.gender,
options: ['female', 'male', 'transsexual', 'other', null],
options: [null, 'female', 'male', 'transsexual', 'other'],
inline: true,
},
{

View File

@ -752,7 +752,7 @@ export async function createActorRevision(actorId, {
throw new HttpError(`No actor with ID ${actorId} found to update`, 404);
}
if (openRevisions.length >= config.revisions.unapprovedLimit) {
if (openRevisions.length >= config.revisions.unapprovedLimit && reqUser.role !== 'admin') {
throw new HttpError(`You have ${config.revisions.unapprovedLimit} unapproved revisions, please wait for approval before submitting another revision.`, 429);
}
@ -788,7 +788,7 @@ export async function createActorRevision(actorId, {
}).filter(Boolean));
const deltas = Object.entries(edits).map(([key, value]) => {
if (baseActor[key] === value) {
if (baseActor[key] === value || typeof value === 'undefined') {
return null;
}
@ -817,10 +817,7 @@ export async function createActorRevision(actorId, {
};
}
return {
key,
value: value || null,
};
return { key, value };
}).filter(Boolean);
const deltaComments = deltas.map((delta) => delta.comment);

View File

@ -862,7 +862,7 @@ export async function createSceneRevision(sceneId, { edits, comment, apply }, re
throw new HttpError(`No scene with ID ${sceneId} found to update`, 404);
}
if (openRevisions.length >= config.revisions.unapprovedLimit) {
if (openRevisions.length >= config.revisions.unapprovedLimit && reqUser.role !== 'admin') {
throw new HttpError(`You have ${config.revisions.unapprovedLimit} unapproved revisions, please wait for approval before submitting another revision.`, 429);
}
@ -893,7 +893,7 @@ export async function createSceneRevision(sceneId, { edits, comment, apply }, re
}).filter(Boolean));
const deltas = Object.entries(edits).map(([key, value]) => {
if (baseScene[key] === value) {
if (baseScene[key] === value || typeof value === 'undefined') {
return null;
}