Skip to content

Commit 4a0edf3

Browse files
authored
fix(frontend): use logical OR for fallback of file comment (#17089)
1 parent f3aa508 commit 4a0edf3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/frontend/src/components/MkImgPreviewDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
1515
>
1616
<template #header>{{ file.name }}</template>
1717
<div :class="$style.container">
18-
<img :src="file.url" :alt="file.comment ?? file.name" :class="$style.img"/>
18+
<img :src="file.url" :alt="file.comment || file.name" :class="$style.img"/>
1919
</div>
2020
</MkModalWindow>
2121
</template>

packages/frontend/src/components/MkMediaList.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ onMounted(() => {
107107
src: media.url,
108108
w: media.properties.width,
109109
h: media.properties.height,
110-
alt: media.comment ?? media.name,
111-
comment: media.comment ?? media.name,
110+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
111+
alt: media.comment || media.name,
112+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
113+
comment: media.comment || media.name,
112114
};
113115
if (media.properties.orientation != null && media.properties.orientation >= 5) {
114116
[item.w, item.h] = [item.h, item.w];
@@ -155,8 +157,10 @@ onMounted(() => {
155157
[itemData.w, itemData.h] = [itemData.h, itemData.w];
156158
}
157159
itemData.msrc = file.thumbnailUrl ?? undefined;
158-
itemData.alt = file.comment ?? file.name;
159-
itemData.comment = file.comment ?? file.name;
160+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
161+
itemData.alt = file.comment || file.name;
162+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
163+
itemData.comment = file.comment || file.name;
160164
itemData.thumbCropped = true;
161165
162166
return itemData;

0 commit comments

Comments
 (0)