1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-28 06:48:36 +09:00
This commit is contained in:
NoriDev 2023-10-12 20:29:45 +09:00
parent 691f6078f5
commit cb0bccadb6
25 changed files with 63 additions and 56 deletions

View File

@ -150,7 +150,7 @@ export class RedisSingleCache<T> {
const cached = await this.redisClient.get(`singlecache:${this.name}`);
if (cached == null) return undefined;
const parsed = this.fromRedisConverter(cached);
if (parsed == null) return undefined;
if (parsed == null) return undefined;
this.memoryCache.set(parsed);
return parsed;
}

View File

@ -82,9 +82,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere('message.groupId NOT IN (:...found)', { found: found });
}
} else {
query.where(new Brackets(qb => { qb
.where('message.userId = :userId', { userId: me.id })
.orWhere('message.recipientId = :userId', { userId: me.id });
query.where(new Brackets(qb => {
qb
.where('message.userId = :userId', { userId: me.id })
.orWhere('message.recipientId = :userId', { userId: me.id });
}));
query.andWhere('message.groupId IS NULL');

View File

@ -96,15 +96,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
});
const query = this.queryService.makePaginationQuery(this.messagingMessagesRepository.createQueryBuilder('message'), ps.sinceId, ps.untilId)
.andWhere(new Brackets(qb => { qb
.where(new Brackets(qb => { qb
.where('message.userId = :meId')
.andWhere('message.recipientId = :recipientId');
}))
.orWhere(new Brackets(qb => { qb
.where('message.userId = :recipientId')
.andWhere('message.recipientId = :meId');
}));
.andWhere(new Brackets(qb => {
qb
.where(new Brackets(qb => {
qb
.where('message.userId = :meId')
.andWhere('message.recipientId = :recipientId');
}))
.orWhere(new Brackets(qb => {
qb
.where('message.userId = :recipientId')
.andWhere('message.recipientId = :meId');
}));
}))
.setParameter('meId', me.id)
.setParameter('recipientId', recipient.id);

View File

@ -116,8 +116,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
translator: translatorServices,
};
} else if (instance.translatorType === 'ctav3') {
if (instance.ctav3SaKey == null) { return 204; } else if (instance.ctav3ProjectId == null) { return 204; }
else if (instance.ctav3Location == null) { return 204; }
if (instance.ctav3SaKey == null) return 204;
else if (instance.ctav3ProjectId == null) return 204;
else if (instance.ctav3Location == null) return 204;
translationResult = await this.apiCloudTranslationAdvanced(
(note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
);

View File

@ -110,8 +110,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
translator: translatorServices,
};
} else if (instance.translatorType === 'ctav3') {
if (instance.ctav3SaKey == null) { return 204; } else if (instance.ctav3ProjectId == null) { return 204; }
else if (instance.ctav3Location == null) { return 204; }
if (instance.ctav3SaKey == null) return 204;
else if (instance.ctav3ProjectId == null) return 204;
else if (instance.ctav3Location == null) return 204;
translationResult = await this.apiCloudTranslationAdvanced(
target.description, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
);

View File

@ -55,7 +55,8 @@ describe('FetchInstanceMetadataService', () => {
return { fetch: jest.fn() };
} else if (token === DI.redis) {
return mockRedis;
}})
}
})
.compile();
app.enableShutdownHooks();

View File

@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { nextTick, onMounted } from 'vue';
import { vibrate } from '@/scripts/vibrate.js';
import {ColdDeviceStorage} from "@/store.js";
import { ColdDeviceStorage } from '@/store.js';
const props = defineProps<{
type?: 'button' | 'submit' | 'reset';

View File

@ -40,7 +40,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{

View File

@ -107,7 +107,7 @@ import * as os from '@/os.js';
import { isTouchUsing } from '@/scripts/touch.js';
import { deviceKind } from '@/scripts/device-kind.js';
import { i18n } from '@/i18n.js';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { customEmojiCategories, customEmojis, customEmojisMap } from '@/custom-emojis.js';
import { $i } from '@/account.js';

View File

@ -52,7 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { nextTick, onMounted } from 'vue';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
const props = withDefaults(defineProps<{
defaultOpen?: boolean;

View File

@ -47,7 +47,7 @@ import { $i } from '@/account.js';
import { userName } from '@/filters/user.js';
import { globalEvents } from '@/events.js';
import { vibrate } from '@/scripts/vibrate.js';
import {ColdDeviceStorage} from "@/store.js";
import { ColdDeviceStorage } from '@/store.js';
let showFollowButton = $ref(false);

View File

@ -74,7 +74,7 @@ const childrenCache = new WeakMap<MenuParent, MenuItem[]>();
</script>
<script lang="ts" setup>
import {ColdDeviceStorage} from "@/store.js";
import { ColdDeviceStorage } from '@/store.js';
const XChild = defineAsyncComponent(() => import('./MkMenu.child.vue'));
const props = defineProps<{

View File

@ -194,7 +194,7 @@ import { focusPrev, focusNext } from '@/scripts/focus.js';
import { checkWordMute } from '@/scripts/check-word-mute.js';
import { userPage } from '@/filters/user.js';
import * as os from '@/os.js';
import {ColdDeviceStorage, defaultStore, noteViewInterruptors} from '@/store.js';
import { ColdDeviceStorage, defaultStore, noteViewInterruptors } from '@/store.js';
import { reactionPicker } from '@/scripts/reaction-picker.js';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
import { $i } from '@/account.js';

View File

@ -139,7 +139,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button
v-if="canRenote"
ref="renoteButton"
v-vibrate="ColdDeviceStorage.get('vibrateSystem') ? [30, 30, 60] : ''"
v-vibrate="ColdDeviceStorage.get('vibrateSystem') ? [30, 30, 60] : ''"
v-tooltip="i18n.ts.renote"
class="_button"
:class="$style.noteFooterButton"

View File

@ -119,7 +119,7 @@ import { formatTimeString } from '@/scripts/format-time-string.js';
import { Autocomplete } from '@/scripts/autocomplete.js';
import * as os from '@/os.js';
import { selectFiles } from '@/scripts/select-file.js';
import {ColdDeviceStorage, defaultStore, notePostInterruptors, postFormActions} from '@/store.js';
import { ColdDeviceStorage, defaultStore, notePostInterruptors, postFormActions } from '@/store.js';
import MkInfo from '@/components/MkInfo.vue';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';

View File

@ -139,7 +139,7 @@ import { formatTimeString } from '@/scripts/format-time-string.js';
import { Autocomplete } from '@/scripts/autocomplete.js';
import * as os from '@/os.js';
import { selectFiles } from '@/scripts/select-file.js';
import {ColdDeviceStorage, defaultStore, notePostInterruptors, postFormActions} from '@/store.js';
import { ColdDeviceStorage, defaultStore, notePostInterruptors, postFormActions } from '@/store.js';
import MkInfo from '@/components/MkInfo.vue';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';

View File

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, watch, shallowRef } from 'vue';
import * as os from '@/os.js';
import { vibrate } from '@/scripts/vibrate.js';
import {ColdDeviceStorage} from "@/store.js";
import { ColdDeviceStorage } from '@/store.js';
const props = withDefaults(defineProps<{
modelValue: number;

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button
ref="buttonEl"
v-ripple="canToggle"
v-vibrate="ColdDeviceStorage.get('vibrateSystem') ? [10, 30, 40] : ''"
v-vibrate="ColdDeviceStorage.get('vibrateSystem') ? [10, 30, 40] : ''"
class="_button"
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: (canToggle || alternative), [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]"
@click="toggleReaction()"

View File

@ -96,7 +96,7 @@ const tosPrivacyPolicyLabel = computed(() => {
} else if (availablePrivacyPolicy) {
return i18n.ts.privacyPolicy;
} else {
return "";
return '';
}
});

View File

@ -18,7 +18,7 @@ import { useStream } from '@/stream.js';
import * as sound from '@/scripts/sound.js';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import { vibrate } from '@/scripts/vibrate.js';
@ -64,7 +64,7 @@ const prepend = note => {
if (props.sound) {
sound.play($i && (note.userId === $i.id) ? 'noteMy' : 'note');
vibrate($i && (note.userId === $i.id) ? '' : ColdDeviceStorage.get('vibrateNote') ? [30, 20] : '');
vibrate($i && (note.userId === $i.id) ? '' : ColdDeviceStorage.get('vibrateNote') ? [30, 20] : '');
}
};

View File

@ -69,7 +69,7 @@ import { useStream } from '@/stream.js';
import * as sound from '@/scripts/sound.js';
import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { vibrate } from '@/scripts/vibrate.js';
import { miLocalStorage } from '@/local-storage.js';

View File

@ -128,11 +128,11 @@ const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
'syncDeviceDarkMode',
'plugins',
'vibrate',
'vibrateNote',
'vibrateNotification',
'vibrateChat',
'vibrateChatBg',
'vibrateSystem',
'vibrateNote',
'vibrateNotification',
'vibrateChat',
'vibrateChatBg',
'vibrateSystem',
'sound_masterVolume',
'sound_note',
'sound_noteMy',

View File

@ -7,9 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_m">
<FormSection first>
<template #label>{{ i18n.ts.sounds }}</template>
<MkRange v-model="masterVolume" style="margin-bottom: 25px;" :min="0" :max="1" :step="0.05" :textConverter="(v) => `${Math.floor(v * 100)}%`">
<template #label>{{ i18n.ts.masterVolume }}</template>
</MkRange>
<MkRange v-model="masterVolume" style="margin-bottom: 25px;" :min="0" :max="1" :step="0.05" :textConverter="(v) => `${Math.floor(v * 100)}%`">
<template #label>{{ i18n.ts.masterVolume }}</template>
</MkRange>
<div class="_gaps_s">
<MkFolder v-for="type in soundsKeys" :key="type">
@ -31,16 +31,16 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-if="vibrate" v-model="vibrateNotification">{{ i18n.ts._vibrations.notification }}</MkSwitch>
<MkSwitch v-if="vibrate" v-model="vibrateChat">{{ i18n.ts._vibrations.chat }}</MkSwitch>
<MkSwitch v-if="vibrate" v-model="vibrateChatBg">{{ i18n.ts._vibrations.chatBg }}</MkSwitch>
<MkSwitch v-if="vibrate" v-model="vibrateSystem" style="margin-top: 10px;">{{ i18n.ts._vibrations.system }}</MkSwitch>
<MkSwitch v-if="vibrate" v-model="vibrateSystem" style="margin-top: 10px;">{{ i18n.ts._vibrations.system }}</MkSwitch>
</div>
</FormSection>
</div>
</template>
<script lang="ts" setup>
import {Ref, computed, ref, watch} from 'vue';
import * as os from "@/os.js";
import { Ref, computed, ref, watch } from 'vue';
import XSound from './sounds.sound.vue';
import * as os from '@/os.js';
import MkRange from '@/components/MkRange.vue';
import MkButton from '@/components/MkButton.vue';
import FormSection from '@/components/form/section.vue';
@ -50,7 +50,7 @@ import { soundConfigStore } from '@/scripts/sound.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { ColdDeviceStorage } from '@/store.js';
import {unisonReload} from "@/scripts/unison-reload.js";
import { unisonReload } from '@/scripts/unison-reload.js';
const masterVolume = computed(soundConfigStore.makeGetterSetter('sound_masterVolume'));
@ -74,13 +74,13 @@ const vibrateChatBg = computed(ColdDeviceStorage.makeGetterSetter('vibrateChatBg
const vibrateSystem = computed(ColdDeviceStorage.makeGetterSetter('vibrateSystem'));
async function reloadAsk() {
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.reloadToApplySetting,
});
if (canceled) return;
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.reloadToApplySetting,
});
if (canceled) return;
unisonReload();
unisonReload();
}
async function updated(type: keyof typeof sounds.value, sound) {
@ -106,9 +106,9 @@ function demoVibrate() {
}
watch([
vibrateSystem,
vibrateSystem,
], async () => {
await reloadAsk();
await reloadAsk();
});
const headerActions = $computed(() => []);

View File

@ -55,7 +55,7 @@ import * as sound from '@/scripts/sound.js';
import { $i } from '@/account.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { globalEvents } from '@/events.js';
import { vibrate } from '@/scripts/vibrate.js';

View File

@ -113,7 +113,7 @@ import XCommon from '@/ui/_common_/common.vue';
import { instanceName } from '@/config.js';
import XDrawerMenu from '@/ui/friendly/navbar-for-mobile.vue';
import * as os from '@/os.js';
import {ColdDeviceStorage, defaultStore} from '@/store.js';
import { ColdDeviceStorage, defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
import { mainRouter } from '@/router.js';