forked from FoundKeyGang/FoundKey
Merge branch 'refactor/use-null-coalesce-etc'
Reviewed-on: FoundKeyGang/FoundKey#195
This commit is contained in:
commit
13a3581817
7 changed files with 7 additions and 7 deletions
|
@ -56,7 +56,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
id: genId(),
|
id: genId(),
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
parentId: parent !== null ? parent.id : null,
|
parentId: parent?.id,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
}).then(x => DriveFolders.findOneByOrFail(x.identifiers[0]));
|
}).then(x => DriveFolders.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
|
|
|
@ -425,7 +425,7 @@ export async function addFile({
|
||||||
file.createdAt = new Date();
|
file.createdAt = new Date();
|
||||||
file.userId = user ? user.id : null;
|
file.userId = user ? user.id : null;
|
||||||
file.userHost = user ? user.host : null;
|
file.userHost = user ? user.host : null;
|
||||||
file.folderId = folder !== null ? folder.id : null;
|
file.folderId = folder?.id;
|
||||||
file.comment = comment;
|
file.comment = comment;
|
||||||
file.properties = properties;
|
file.properties = properties;
|
||||||
file.blurhash = info.blurhash || null;
|
file.blurhash = info.blurhash || null;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
@drop.stop="onDrop"
|
@drop.stop="onDrop"
|
||||||
>
|
>
|
||||||
<i v-if="folder == null" class="fas fa-cloud"></i>
|
<i v-if="folder == null" class="fas fa-cloud"></i>
|
||||||
<span>{{ folder == null ? i18n.ts.drive : folder.name }}</span>
|
<span>{{ folder?.name ?? i18n.ts.drive }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ const modal = $ref<InstanceType<typeof MkModal>>();
|
||||||
|
|
||||||
const menu = defaultStore.state.menu;
|
const menu = defaultStore.state.menu;
|
||||||
|
|
||||||
const items = Object.keys(menuDef).filter(k => !menu.includes(k)).map(k => menuDef[k]).filter(def => def.show == null ? true : def.show).map(def => ({
|
const items = Object.keys(menuDef).filter(k => !menu.includes(k)).map(k => menuDef[k]).filter(def => def.show ?? true).map(def => ({
|
||||||
type: def.to ? 'link' : 'button',
|
type: def.to ? 'link' : 'button',
|
||||||
text: i18n.ts[def.title],
|
text: i18n.ts[def.title],
|
||||||
icon: def.icon,
|
icon: def.icon,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export default n => n == null ? 'N/A' : n.toLocaleString();
|
export default n => n?.toLocaleString() ?? 'N/A';
|
||||||
|
|
|
@ -85,7 +85,7 @@ async function edit(type) {
|
||||||
type: 'enum',
|
type: 'enum',
|
||||||
enum: soundsTypes.map(x => ({
|
enum: soundsTypes.map(x => ({
|
||||||
value: x,
|
value: x,
|
||||||
label: x == null ? i18n.ts.none : x,
|
label: x ?? i18n.ts.none,
|
||||||
})),
|
})),
|
||||||
label: i18n.ts.sound,
|
label: i18n.ts.sound,
|
||||||
default: sounds.value[type].type,
|
default: sounds.value[type].type,
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function getScrollContainer(el: HTMLElement | null): HTMLElement | null {
|
||||||
|
|
||||||
export function getScrollPosition(el: Element | null): number {
|
export function getScrollPosition(el: Element | null): number {
|
||||||
const container = getScrollContainer(el);
|
const container = getScrollContainer(el);
|
||||||
return container == null ? window.scrollY : container.scrollTop;
|
return container?.scrollTop ?? window.scrollY;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isTopVisible(el: Element | null): boolean {
|
export function isTopVisible(el: Element | null): boolean {
|
||||||
|
|
Loading…
Reference in a new issue