mirror of
https://github.com/kokonect-link/cherrypick
synced 2025-01-19 08:13:14 +09:00
lint
This commit is contained in:
parent
c5b7fe9dda
commit
648490d632
@ -4,8 +4,10 @@
|
||||
*/
|
||||
|
||||
import { setImmediate } from 'node:timers/promises';
|
||||
import util from 'util';
|
||||
import { In, DataSource } from 'typeorm';
|
||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import * as mfm from 'cherrypick-mfm-js';
|
||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import type { NotesRepository, UsersRepository } from '@/models/_.js';
|
||||
@ -20,14 +22,12 @@ import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerServ
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { DB_MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { SearchService } from '@/core/SearchService.js';
|
||||
import { normalizeForSearch } from "@/misc/normalize-for-search.js";
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { MiDriveFile } from '@/models/_.js';
|
||||
import { MiPoll, IPoll } from '@/models/Poll.js';
|
||||
import * as mfm from "cherrypick-mfm-js";
|
||||
import { concat } from "@/misc/prelude/array.js";
|
||||
import { extractHashtags } from "@/misc/extract-hashtags.js";
|
||||
import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js";
|
||||
import util from 'util';
|
||||
import { concat } from '@/misc/prelude/array.js';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||
|
||||
type MinimumUser = {
|
||||
id: MiUser['id'];
|
||||
@ -187,10 +187,10 @@ export class NoteUpdateService implements OnApplicationShutdown {
|
||||
} else if (note.hasPoll && !values.hasPoll) {
|
||||
// Start transaction
|
||||
await this.db.transaction(async transactionalEntityManager => {
|
||||
await transactionalEntityManager.update(MiNote, {id: note.id}, values);
|
||||
await transactionalEntityManager.update(MiNote, { id: note.id }, values);
|
||||
|
||||
if (!values.hasPoll) {
|
||||
await transactionalEntityManager.delete(MiPoll, {noteId: note.id});
|
||||
await transactionalEntityManager.delete(MiPoll, { noteId: note.id });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -824,7 +824,7 @@ export class ApInboxService {
|
||||
const unlock = await this.appLockService.getApLock(uri);
|
||||
|
||||
try {
|
||||
const target = await this.notesRepository.findOneBy({uri: uri});
|
||||
const target = await this.notesRepository.findOneBy({ uri: uri });
|
||||
if (!target) return `skip: target note not located: ${uri}`;
|
||||
await this.apNoteService.updateNote(note, target, resolver, silent);
|
||||
return 'ok';
|
||||
|
@ -25,12 +25,11 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { MessagingService } from '@/core/MessagingService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { checkHttps } from '@/misc/check-https.js';
|
||||
import type { IObject, IPost } from '../type.js';
|
||||
import { NoteUpdateService } from '@/core/NoteUpdateService.js';
|
||||
import { getApId, getApType, getOneApHrefNullable, getOneApId, isEmoji, validPost } from '../type.js';
|
||||
import { ApLoggerService } from '../ApLoggerService.js';
|
||||
import { ApMfmService } from '../ApMfmService.js';
|
||||
import { ApDbResolverService } from '../ApDbResolverService.js';
|
||||
import type { Resolver } from '../ApResolverService.js';
|
||||
import { ApResolverService } from '../ApResolverService.js';
|
||||
import { ApAudienceService } from '../ApAudienceService.js';
|
||||
import { ApPersonService } from './ApPersonService.js';
|
||||
@ -39,7 +38,8 @@ import { ApMentionService } from './ApMentionService.js';
|
||||
import { ApQuestionService } from './ApQuestionService.js';
|
||||
import { ApEventService } from './ApEventService.js';
|
||||
import { ApImageService } from './ApImageService.js';
|
||||
import { NoteUpdateService } from '@/core/NoteUpdateService.js';
|
||||
import type { Resolver } from '../ApResolverService.js';
|
||||
import type { IObject, IPost } from '../type.js';
|
||||
|
||||
@Injectable()
|
||||
export class ApNoteService {
|
||||
|
@ -224,7 +224,7 @@ const props = withDefaults(defineProps<{
|
||||
mock?: boolean;
|
||||
notification?: boolean;
|
||||
}>(), {
|
||||
mock: false,
|
||||
mock: false,
|
||||
notification: false,
|
||||
});
|
||||
|
||||
@ -306,16 +306,16 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
if (props.mock) {
|
||||
watch(() => props.note, (to) => {
|
||||
note = deepClone(to);
|
||||
}, { deep: true });
|
||||
watch(() => props.note, (to) => {
|
||||
note = deepClone(to);
|
||||
}, { deep: true });
|
||||
} else {
|
||||
useNoteCapture({
|
||||
rootEl: el,
|
||||
note: $$(appearNote),
|
||||
pureNote: $$(note),
|
||||
isDeletedRef: isDeleted,
|
||||
});
|
||||
useNoteCapture({
|
||||
rootEl: el,
|
||||
note: $$(appearNote),
|
||||
pureNote: $$(note),
|
||||
isDeletedRef: isDeleted,
|
||||
});
|
||||
}
|
||||
|
||||
if (!props.mock) {
|
||||
@ -352,14 +352,14 @@ async function renoteOnly() {
|
||||
pleaseLogin();
|
||||
showMovedDialog();
|
||||
|
||||
getRenoteOnlyMenu({ note: note, renoteButton, mock: props.mock });
|
||||
getRenoteOnlyMenu({ note: note, renoteButton, mock: props.mock });
|
||||
}
|
||||
|
||||
function quote(viaKeyboard = false): void {
|
||||
pleaseLogin();
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
if (appearNote.channel) {
|
||||
os.post({
|
||||
renote: appearNote,
|
||||
@ -411,10 +411,10 @@ function react(viaKeyboard = false): void {
|
||||
} else {
|
||||
blur();
|
||||
reactionPicker.show(reactButton.value, reaction => {
|
||||
if (props.mock) {
|
||||
emit('reaction', reaction);
|
||||
return;
|
||||
}
|
||||
if (props.mock) {
|
||||
emit('reaction', reaction);
|
||||
return;
|
||||
}
|
||||
toggleReaction(reaction);
|
||||
}, () => {
|
||||
focus();
|
||||
@ -456,9 +456,9 @@ function heartReact(): void {
|
||||
pleaseLogin();
|
||||
showMovedDialog();
|
||||
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
|
||||
os.api('notes/reactions/create', {
|
||||
noteId: appearNote.id,
|
||||
@ -538,9 +538,9 @@ async function translate(): Promise<void> {
|
||||
if (translation.value != null) return;
|
||||
translating.value = true;
|
||||
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
if (props.mock) {
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await os.api('notes/translate', {
|
||||
noteId: appearNote.id,
|
||||
|
@ -7,9 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<header :class="$style.root">
|
||||
<div :class="$style.section">
|
||||
<div style="display: flex;">
|
||||
<div v-if="mock" :class="$style.name">
|
||||
<MkUserName :user="note.user"/>
|
||||
</div>
|
||||
<div v-if="mock" :class="$style.name">
|
||||
<MkUserName :user="note.user"/>
|
||||
</div>
|
||||
<MkA v-else v-user-preview="note.user.id" :class="$style.name" :to="userPage(note.user)">
|
||||
<MkUserName :user="note.user"/>
|
||||
</MkA>
|
||||
@ -36,9 +36,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</span>
|
||||
<span v-if="note.localOnly" style="margin-right: 0.5em;"><i v-tooltip="i18n.ts._visibility['disableFederation']" class="ti ti-rocket-off"></i></span>
|
||||
<span v-if="note.channel" style="margin-right: 0.5em;"><i v-tooltip="note.channel.name" class="ti ti-device-tv"></i></span>
|
||||
<div v-if="mock">
|
||||
<MkTime :time="note.createdAt" colored/>
|
||||
</div>
|
||||
<div v-if="mock">
|
||||
<MkTime :time="note.createdAt" colored/>
|
||||
</div>
|
||||
<MkA v-else :class="$style.time" :to="notePage(note)">
|
||||
<MkTime v-if="defaultStore.state.enableAbsoluteTime" :time="note.createdAt" mode="absolute" colored/>
|
||||
<MkTime v-else-if="!defaultStore.state.enableAbsoluteTime" :time="note.createdAt" mode="relative" colored/>
|
||||
|
@ -176,7 +176,7 @@ const props = withDefaults(defineProps<{
|
||||
}>(), {
|
||||
initialVisibleUsers: () => [],
|
||||
autofocus: false,
|
||||
mock: false,
|
||||
mock: false,
|
||||
});
|
||||
|
||||
provide('mock', props.mock);
|
||||
@ -345,7 +345,7 @@ if (props.reply && props.reply.text != null) {
|
||||
}
|
||||
|
||||
if ($i?.isSilenced && visibility === 'public') {
|
||||
visibility = 'home';
|
||||
visibility = 'home';
|
||||
}
|
||||
|
||||
if (props.channel) {
|
||||
@ -467,7 +467,7 @@ function focus() {
|
||||
}
|
||||
|
||||
function chooseFileFrom(ev) {
|
||||
if (props.mock) return;
|
||||
if (props.mock) return;
|
||||
|
||||
selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(files_ => {
|
||||
for (const file of files_) {
|
||||
@ -481,9 +481,9 @@ function detachFile(id) {
|
||||
}
|
||||
|
||||
function updateFileSensitive(file, sensitive) {
|
||||
if (props.mock) {
|
||||
emit('fileChangeSensitive', file.id, sensitive);
|
||||
}
|
||||
if (props.mock) {
|
||||
emit('fileChangeSensitive', file.id, sensitive);
|
||||
}
|
||||
files[files.findIndex(x => x.id === file.id)].isSensitive = sensitive;
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ function replaceFile(file: Misskey.entities.DriveFile, newFile: Misskey.entities
|
||||
}
|
||||
|
||||
function upload(file: File, name?: string): void {
|
||||
if (props.mock) return;
|
||||
if (props.mock) return;
|
||||
|
||||
uploadFile(file, defaultStore.state.uploadFolder, name).then(res => {
|
||||
files.push(res);
|
||||
@ -512,7 +512,7 @@ function setVisibility() {
|
||||
|
||||
os.popup(defineAsyncComponent(() => import('@/components/MkVisibilityPicker.vue')), {
|
||||
currentVisibility: visibility,
|
||||
isSilenced: $i?.isSilenced,
|
||||
isSilenced: $i?.isSilenced,
|
||||
localOnly: localOnly,
|
||||
src: visibilityButton,
|
||||
}, {
|
||||
@ -638,7 +638,7 @@ function onCompositionEnd(ev: CompositionEvent) {
|
||||
}
|
||||
|
||||
async function onPaste(ev: ClipboardEvent) {
|
||||
if (props.mock) return;
|
||||
if (props.mock) return;
|
||||
|
||||
for (const { item, i } of Array.from(ev.clipboardData.items, (item, i) => ({ item, i }))) {
|
||||
if (item.kind === 'file') {
|
||||
@ -755,13 +755,13 @@ function deleteDraft() {
|
||||
}
|
||||
|
||||
async function post(ev?: MouseEvent) {
|
||||
if (useCw && (cw == null || cw.trim() === '')) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.cwNotationRequired,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (useCw && (cw == null || cw.trim() === '')) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.cwNotationRequired,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev) {
|
||||
const el = ev.currentTarget ?? ev.target;
|
||||
@ -771,7 +771,7 @@ async function post(ev?: MouseEvent) {
|
||||
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
||||
}
|
||||
|
||||
if (props.mock) return;
|
||||
if (props.mock) return;
|
||||
|
||||
const annoying =
|
||||
text.includes('$[x2') ||
|
||||
|
@ -10,9 +10,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<div class="_gaps_s">
|
||||
<div><i class="ti ti-arrow-back-up"></i> <b>{{ i18n.ts.reply }}</b> … {{ i18n.ts._initialTutorial._note.reply }}</div>
|
||||
<div><i class="ti ti-repeat"></i> <b>{{ i18n.ts.renote }}</b> … {{ i18n.ts._initialTutorial._note.renote }}</div>
|
||||
<div><i class="ti ti-heart"></i> <b>{{ i18n.ts.like }}</b> … {{ i18n.ts._initialTutorial._note.like }}</div>
|
||||
<div><i class="ti ti-heart"></i> <b>{{ i18n.ts.like }}</b> … {{ i18n.ts._initialTutorial._note.like }}</div>
|
||||
<div><i class="ti ti-mood-plus"></i> <b>{{ i18n.ts.reaction }}</b> … {{ i18n.ts._initialTutorial._note.reaction }}</div>
|
||||
<div><i class="ti ti-quote"></i> <b>{{ i18n.ts.quote }}</b> … {{ i18n.ts._initialTutorial._note.quote }}</div>
|
||||
<div><i class="ti ti-quote"></i> <b>{{ i18n.ts.quote }}</b> … {{ i18n.ts._initialTutorial._note.quote }}</div>
|
||||
<div><i class="ti ti-dots"></i> <b>{{ i18n.ts.menu }}</b> … {{ i18n.ts._initialTutorial._note.menu }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,7 +22,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<a href="https://misskey-hub.net/docs/features/timeline.html" target="_blank" class="_link">{{ i18n.ts.help }}</a>
|
||||
</template>
|
||||
</I18n>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -52,7 +52,7 @@ let meta = $ref<Misskey.entities.Instance>();
|
||||
let instances = $ref<any[]>();
|
||||
|
||||
function getInstanceIcon(instance): string {
|
||||
return getProxiedImageUrl(instance.iconUrl, 'preview');
|
||||
return getProxiedImageUrl(instance.iconUrl, 'preview');
|
||||
}
|
||||
|
||||
os.api('meta', { detail: true }).then(_meta => {
|
||||
|
@ -532,7 +532,7 @@ export function getRenoteMenu(props: {
|
||||
}]);
|
||||
}
|
||||
|
||||
if (!appearNote.channel || appearNote.channel?.allowRenoteToExternal) {
|
||||
if (!appearNote.channel || appearNote.channel.allowRenoteToExternal) {
|
||||
normalRenoteItems.push(...[{
|
||||
text: i18n.ts.renote,
|
||||
icon: 'ti ti-repeat',
|
||||
@ -629,7 +629,7 @@ export function getRenoteOnlyMenu(props: {
|
||||
}
|
||||
}
|
||||
|
||||
if (!appearNote.channel || appearNote.channel?.allowRenoteToExternal) {
|
||||
if (!appearNote.channel || appearNote.channel.allowRenoteToExternal) {
|
||||
const el = props.renoteButton.value as HTMLElement | null | undefined;
|
||||
if (el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
|
Loading…
Reference in New Issue
Block a user