feat(quest): add support for private images in answers
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user