feat(quest): add support for private images in answers

This commit is contained in:
2026-07-31 02:14:34 +02:00
parent de0eaee521
commit 45865d3122
9 changed files with 53 additions and 14 deletions
@@ -72,6 +72,11 @@ useHead({
const answer = ref(data.value?.answer?.text);
const final = ref(data.value?.answer?.final || false);
const privateImage = ref(data.value?.answer?.picture?.private ?? false);
const privateChanged = computed(
() => (data.value?.answer?.picture?.private ?? false) !== privateImage.value
);
const textType = {
TEXT: 'text',
@@ -114,6 +119,7 @@ async function submit() {
if (final.value) {
body.set('final', 'true');
}
body.set('private', privateImage.value ? 'true' : 'false');
if (newImage.value) {
uploadingImage.value = true;
compressing.value = true;
@@ -141,6 +147,7 @@ async function submit() {
await refresh();
answer.value = data.value?.answer?.text;
privateImage.value = data.value?.answer?.picture?.private ?? false;
newImage.value = undefined;
} catch (e) {
if (xhr.status === 418) {
@@ -325,6 +332,13 @@ async function submit() {
type="single"
file-types="jpg,png,jpeg"
/>
<VaCheckbox
v-if="newImageURL || data.answer?.picture"
v-model="privateImage"
:disabled="uploading || data.answer?.final"
:label="t('page.quest.private_image')"
:messages="t('page.quest.private_image_explain')"
/>
<p v-if="data.answer?.updatedAt">
{{
t('page.quest.last_update', {
@@ -352,7 +366,8 @@ async function submit() {
!(
newImage ||
data.answer?.text !== answer ||
data.answer?.final !== final
data.answer?.final !== final ||
privateChanged
) || uploading
"
:loading="uploading"