fix(frontend): 노트의 일부 버튼을 누르면 노트 상세 페이지가 표시됨

This commit is contained in:
NoriDev 2023-12-15 01:02:34 +09:00
parent a9a7c8093d
commit 46c9b3c50a
12 changed files with 43 additions and 31 deletions

View file

@ -14,7 +14,8 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf
import { extractHashtags } from '@/misc/extract-hashtags.js';
import type { IMentionedRemoteUsers } from '@/models/Note.js';
import { MiNote } from '@/models/Note.js';
import { MiEvent, IEvent } from '@/models/Event.js';
import { MiEvent } from '@/models/Event.js';
import type { IEvent } from '@/models/Event.js';
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
import type { MiDriveFile } from '@/models/DriveFile.js';
import type { MiApp } from '@/models/App.js';

View file

@ -140,6 +140,10 @@ export const packedNoteSchema = {
type: 'object',
optional: true, nullable: true,
},
event: {
type: 'object',
optional: true, nullable: true,
},
channelId: {
type: 'string',
optional: true, nullable: true,

View file

@ -32,6 +32,7 @@ export const paramDef = {
renote: { type: 'boolean' },
withFiles: { type: 'boolean' },
poll: { type: 'boolean' },
event: { type: 'boolean' },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
@ -78,6 +79,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere(ps.poll ? 'note.hasPoll = TRUE' : 'note.hasPoll = FALSE');
}
if (ps.event !== undefined) {
query.andWhere(ps.event ? 'note.hasEvent = TRUE' : 'note.hasEvent = FALSE');
}
// TODO
//if (bot != undefined) {
// query.isBot = bot;

View file

@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.362Z
* generatedAt: 2023-12-14T16:00:54.542Z
*/
import type { SwitchCaseResponseType } from '../api.js';

View file

@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.360Z
* generatedAt: 2023-12-14T16:00:54.540Z
*/
import type {

View file

@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.359Z
* generatedAt: 2023-12-14T16:00:54.539Z
*/
import { operations } from './types.js';

View file

@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.358Z
* generatedAt: 2023-12-14T16:00:54.537Z
*/
import { components } from './types.js';

View file

@ -4,7 +4,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.281Z
* generatedAt: 2023-12-14T16:00:54.457Z
*/
/**
@ -4096,6 +4096,7 @@ export type components = {
files?: components['schemas']['DriveFile'][];
tags?: string[];
poll?: Record<string, unknown> | null;
event?: Record<string, unknown> | null;
/**
* Format: id
* @example xxxxxxxxxx
@ -20334,6 +20335,7 @@ export type operations = {
renote?: boolean;
withFiles?: boolean;
poll?: boolean;
event?: boolean;
/** @default 10 */
limit?: number;
/** Format: misskey:id */

View file

@ -86,8 +86,8 @@ SPDX-License-Identifier: AGPL-3.0-only
:enableEmojiMenuReaction="true"
/>
<div v-if="defaultStore.state.showTranslateButtonInNote && instance.translatorAvailable && $i && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @mousedown="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @mousedown="translation = null">{{ i18n.ts.close }}</button>
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click.stop="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @click.stop="translation = null">{{ i18n.ts.close }}</button>
</div>
<div v-if="translating || translation" :class="$style.translation">
<MkLoading v-if="translating" mini/>
@ -103,7 +103,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="viewTextSource">
<hr style="margin: 10px 0;">
<pre style="margin: initial;"><small>{{ appearNote.text }}</small></pre>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @mousedown="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @click.stop="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
</div>
</div>
<div v-if="appearNote.files.length > 0">
@ -154,10 +154,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-else :class="$style.footerButton" class="_button" disabled>
<i class="ti ti-ban"></i>
</button>
<button v-if="appearNote.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.footerButton" class="_button" @mousedown.stop="heartReact()">
<button v-if="appearNote.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.footerButton" class="_button" @click.stop="heartReact()">
<i class="ti ti-heart"></i>
</button>
<button v-if="appearNote.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.footerButton" class="_button" @mousedown.stop="react()">
<button v-if="appearNote.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.footerButton" class="_button" @click.stop="react()">
<i v-if="appearNote.myReaction == null" v-tooltip="i18n.ts.reaction" class="ti ti-mood-plus"></i>
<i v-else v-tooltip="i18n.ts.editReaction" class="ti ti-mood-edit"></i>
</button>
@ -167,13 +167,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="canRenote && defaultStore.state.renoteQuoteButtonSeparation" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.quote" class="_button" :class="$style.footerButton" @click.stop="quote()">
<i class="ti ti-quote"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" :class="$style.footerButton" class="_button" @mousedown.stop="clip()">
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" :class="$style.footerButton" class="_button" @click.stop="clip()">
<i class="ti ti-paperclip"></i>
</button>
<MkA v-if="defaultStore.state.infoButtonForNoteActionsEnabled && defaultStore.state.showNoteActionsOnlyHover" v-tooltip="i18n.ts.details" :to="notePage(note)" :class="$style.footerButton" style="text-decoration: none;" class="_button">
<i class="ti ti-info-circle"></i>
</MkA>
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" :class="$style.footerButton" class="_button" @mousedown.stop="menu()">
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" :class="$style.footerButton" class="_button" @click.stop="menu()">
<i class="ti ti-dots"></i>
</button>
</footer>

View file

@ -106,8 +106,8 @@ SPDX-License-Identifier: AGPL-3.0-only
/>
<a v-if="appearNote.renote != null" :class="$style.rn">RN:</a>
<div v-if="defaultStore.state.showTranslateButtonInNote && instance.translatorAvailable && $i && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @mousedown="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @mousedown="translation = null">{{ i18n.ts.close }}</button>
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @click="translation = null">{{ i18n.ts.close }}</button>
</div>
<div v-if="translating || translation" :class="$style.translation">
<MkLoading v-if="translating" mini/>
@ -123,7 +123,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="viewTextSource">
<hr style="margin: 10px 0;">
<pre style="margin: initial;"><small>{{ appearNote.text }}</small></pre>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @mousedown="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @click="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
</div>
<div v-if="appearNote.files.length > 0">
<MkMediaList v-if="appearNote.disableRightClick" :mediaList="appearNote.files" @contextmenu.prevent/>
@ -159,7 +159,7 @@ SPDX-License-Identifier: AGPL-3.0-only
v-tooltip="i18n.ts.renote"
class="_button"
:class="$style.noteFooterButton"
@mousedown="defaultStore.state.renoteQuoteButtonSeparation ? renoteOnly() : renote()"
@click="defaultStore.state.renoteQuoteButtonSeparation ? renoteOnly() : renote()"
>
<i class="ti ti-repeat"></i>
<p v-if="appearNote.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ appearNote.renoteCount }}</p>
@ -167,10 +167,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-else class="_button" :class="$style.noteFooterButton" disabled>
<i class="ti ti-ban"></i>
</button>
<button v-if="appearNote.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.noteFooterButton" class="_button" @mousedown="heartReact()">
<button v-if="appearNote.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.noteFooterButton" class="_button" @click="heartReact()">
<i class="ti ti-heart"></i>
</button>
<button v-if="appearNote.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.noteFooterButton" class="_button" @mousedown="react()">
<button v-if="appearNote.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.noteFooterButton" class="_button" @click="react()">
<i v-if="appearNote.myReaction == null" v-tooltip="i18n.ts.reaction" class="ti ti-mood-plus"></i>
<i v-else v-tooltip="i18n.ts.editReaction" class="ti ti-mood-edit"></i>
</button>
@ -180,10 +180,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="canRenote && defaultStore.state.renoteQuoteButtonSeparation" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.quote" class="_button" :class="$style.noteFooterButton" @click="quote()">
<i class="ti ti-quote"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" class="_button" :class="$style.noteFooterButton" @mousedown="clip()">
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" class="_button" :class="$style.noteFooterButton" @click="clip()">
<i class="ti ti-paperclip"></i>
</button>
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" class="_button" :class="$style.noteFooterButton" @mousedown="menu()">
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" class="_button" :class="$style.noteFooterButton" @click="menu()">
<i class="ti ti-dots"></i>
</button>
</footer>

View file

@ -10,9 +10,9 @@ SPDX-License-Identifier: AGPL-3.0-only
v-vibrate="defaultStore.state.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()"
@click="toggleReaction"
>
<MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/>
<MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]" @click="toggleReaction"/>
<span :class="$style.count">{{ count }}</span>
</button>
</template>
@ -56,7 +56,7 @@ const alternative: ComputedRef<string | null> = computed(() => defaultStore.stat
const canToggle = computed(() => !props.reaction.match(/@\w/) && $i);
async function toggleReaction(ev) {
async function toggleReaction(ev: MouseEvent) {
if (!canToggle.value) {
chooseAlternative(ev);
return;

View file

@ -21,8 +21,8 @@ SPDX-License-Identifier: AGPL-3.0-only
/>
<MkA v-if="note.renoteId" :class="$style.rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
<div v-if="defaultStore.state.showTranslateButtonInNote && instance.translatorAvailable && $i && note.text && isForeignLanguage" style="padding-top: 5px; color: var(--accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @mousedown="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @mousedown="translation = null">{{ i18n.ts.close }}</button>
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click.stop="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @click.stop="translation = null">{{ i18n.ts.close }}</button>
</div>
<div v-if="translating || translation" :class="$style.translation">
<MkLoading v-if="translating" mini/>
@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="viewTextSource">
<hr style="margin: 10px 0;">
<pre style="margin: initial;"><small>{{ note.text }}</small></pre>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @mousedown="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
<button class="_button" style="padding-top: 5px; color: var(--accent);" @click.stop="viewTextSource = false"><small>{{ i18n.ts.close }}</small></button>
</div>
<div v-show="showContent">
<div v-if="note.files.length > 0">
@ -88,10 +88,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-else :class="$style.footerButton" class="_button" disabled>
<i class="ti ti-ban"></i>
</button>
<button v-if="note.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.footerButton" class="_button" @mousedown.stop="heartReact()">
<button v-if="note.myReaction == null" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.footerButton" class="_button" @click.stop="heartReact()">
<i class="ti ti-heart"></i>
</button>
<button v-if="note.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.footerButton" class="_button" @mousedown.stop="react()">
<button v-if="note.reactionAcceptance !== 'likeOnly'" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" :class="$style.footerButton" class="_button" @click.stop="react()">
<i v-if="note.myReaction == null" v-tooltip="i18n.ts.reaction" class="ti ti-mood-plus"></i>
<i v-else v-tooltip="i18n.ts.editReaction" class="ti ti-mood-edit"></i>
</button>
@ -101,13 +101,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="canRenote && defaultStore.state.renoteQuoteButtonSeparation" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.quote" class="_button" :class="$style.footerButton" @click.stop="quote()">
<i class="ti ti-quote"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" :class="$style.footerButton" class="_button" @mousedown.stop="clip()">
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.clip" :class="$style.footerButton" class="_button" @click.stop="clip()">
<i class="ti ti-paperclip"></i>
</button>
<MkA v-if="defaultStore.state.infoButtonForNoteActionsEnabled && defaultStore.state.showNoteActionsOnlyHover" v-tooltip="i18n.ts.details" :to="notePage(note)" :class="$style.footerButton" style="text-decoration: none;" class="_button">
<i class="ti ti-info-circle"></i>
</MkA>
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" :class="$style.footerButton" class="_button" @mousedown.stop="menu()">
<button ref="menuButton" v-vibrate="defaultStore.state.vibrateSystem ? 5 : []" v-tooltip="i18n.ts.more" :class="$style.footerButton" class="_button" @click.stop="menu()">
<i class="ti ti-dots"></i>
</button>
</footer>