Skip to content

Commit 0b7b59f

Browse files
enhance(frontend): チャンネル指定リノートでリノート先のチャンネルに移動できるように (#17280)
* enhance(frontend): チャンネル指定リノートでリノート先のチャンネルに移動できるように * Update Changelog * fix condition * refactor
1 parent 8169c57 commit 0b7b59f

7 files changed

Lines changed: 59 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-
55

66
### Client
7-
-
7+
- Enhance: チャンネル指定リノートでリノート先のチャンネルに移動できるように
88

99
### Server
1010
- Fix: `/api-doc` にアクセスできない問題を修正

locales/ja-JP.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,7 @@ frame: "フレーム"
14081408
presets: "プリセット"
14091409
zeroPadding: "ゼロ埋め"
14101410
nothingToConfigure: "設定項目はありません"
1411+
viewRenotedChannel: "リノート先のチャンネルを見る"
14111412

14121413
_imageEditing:
14131414
_vars:

packages/frontend/src/components/MkNote.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ const emit = defineEmits<{
263263
264264
const inTimeline = inject<boolean>('inTimeline', false);
265265
const tl_withSensitive = inject<Ref<boolean>>('tl_withSensitive', ref(true));
266-
const inChannel = inject('inChannel', null);
266+
const inChannel = inject(DI.inChannel, null);
267267
const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null);
268268
269269
let note = deepClone(props.note);
@@ -650,23 +650,35 @@ async function showRenoteMenu() {
650650
};
651651
}
652652
653-
const renoteDetailsMenu: MenuItem = {
653+
const renoteDetailsMenu: MenuItem[] = [{
654654
type: 'link',
655655
text: i18n.ts.renoteDetails,
656656
icon: 'ti ti-info-circle',
657657
to: notePage(note),
658-
};
658+
}];
659+
660+
if (
661+
props.note.channelId != null &&
662+
(inChannel == null || props.note.channelId !== inChannel.value)
663+
) {
664+
renoteDetailsMenu.push({
665+
type: 'link',
666+
text: i18n.ts.viewRenotedChannel,
667+
icon: 'ti ti-device-tv',
668+
to: `/channels/${props.note.channelId}`,
669+
});
670+
}
659671
660672
if (isMyRenote) {
661673
os.popupMenu([
662-
renoteDetailsMenu,
674+
...renoteDetailsMenu,
663675
getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote),
664676
{ type: 'divider' },
665677
getUnrenote(),
666678
], renoteTime.value);
667679
} else {
668680
os.popupMenu([
669-
renoteDetailsMenu,
681+
...renoteDetailsMenu,
670682
getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote),
671683
{ type: 'divider' },
672684
getAbuseNoteMenu(note, i18n.ts.reportAbuseRenote),

packages/frontend/src/components/MkNoteDetailed.vue

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ import { isLink } from '@@/js/is-link.js';
238238
import { host } from '@@/js/config.js';
239239
import type { OpenOnRemoteOptions } from '@/utility/please-login.js';
240240
import type { Keymap } from '@/utility/hotkey.js';
241+
import type { MenuItem } from '@/types/menu.js';
241242
import MkNoteSub from '@/components/MkNoteSub.vue';
242243
import MkNoteSimple from '@/components/MkNoteSimple.vue';
243244
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
@@ -286,7 +287,7 @@ const props = withDefaults(defineProps<{
286287
initialTab: 'replies',
287288
});
288289
289-
const inChannel = inject('inChannel', null);
290+
const inChannel = inject(DI.inChannel, null);
290291
291292
let note = deepClone(props.note);
292293
@@ -581,18 +582,36 @@ async function showRenoteMenu() {
581582
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
582583
if (!isLoggedIn) return;
583584
584-
os.popupMenu([{
585-
text: i18n.ts.unrenote,
586-
icon: 'ti ti-trash',
587-
danger: true,
588-
action: () => {
589-
misskeyApi('notes/delete', {
590-
noteId: note.id,
591-
}).then(() => {
592-
globalEvents.emit('noteDeleted', note.id);
593-
});
594-
},
595-
}], renoteTime.value);
585+
const menu: MenuItem[] = [];
586+
587+
if (isMyRenote) {
588+
menu.push({
589+
text: i18n.ts.unrenote,
590+
icon: 'ti ti-trash',
591+
danger: true,
592+
action: () => {
593+
misskeyApi('notes/delete', {
594+
noteId: note.id,
595+
}).then(() => {
596+
globalEvents.emit('noteDeleted', note.id);
597+
});
598+
},
599+
});
600+
}
601+
602+
if (
603+
props.note.channelId != null &&
604+
(inChannel == null || props.note.channelId !== inChannel.value)
605+
) {
606+
menu.push({
607+
type: 'link',
608+
text: i18n.ts.viewRenotedChannel,
609+
icon: 'ti ti-device-tv',
610+
to: `/channels/${props.note.channelId}`,
611+
});
612+
}
613+
614+
os.popupMenu(menu, renoteTime.value);
596615
}
597616
598617
function focus() {

packages/frontend/src/components/MkStreamingNotesTimeline.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import { store } from '@/store.js';
7474
import MkNote from '@/components/MkNote.vue';
7575
import MkButton from '@/components/MkButton.vue';
7676
import { i18n } from '@/i18n.js';
77+
import { DI } from '@/di.js';
7778
import { globalEvents, useGlobalEvent } from '@/events.js';
7879
import { isSeparatorNeeded, getSeparatorInfo } from '@/utility/timeline-date-separate.js';
7980
import { Paginator } from '@/utility/paginator.js';
@@ -101,7 +102,7 @@ const props = withDefaults(defineProps<{
101102
102103
provide('inTimeline', true);
103104
provide('tl_withSensitive', computed(() => props.withSensitive));
104-
provide('inChannel', computed(() => props.src === 'channel'));
105+
provide(DI.inChannel, computed(() => props.src === 'channel' ? props.channel ?? null : null));
105106
106107
let paginator: IPaginator<Misskey.entities.Note>;
107108

packages/frontend/src/di.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-only
44
*/
55

6-
import type { InjectionKey, Ref } from 'vue';
6+
import type { InjectionKey, Ref, ComputedRef } from 'vue';
77
import type { PageMetadata } from '@/page.js';
88
import type { Router } from '@/router.js';
99

@@ -18,4 +18,5 @@ export const DI = {
1818
mfmEmojiReactCallback: Symbol() as InjectionKey<(emoji: string) => void>,
1919
inModal: Symbol() as InjectionKey<boolean>,
2020
inAppSearchMarkerId: Symbol() as InjectionKey<Ref<string | null>>,
21+
inChannel: Symbol() as InjectionKey<ComputedRef<string | null> | null>, // 現在開いているチャンネルのID
2122
};

packages/i18n/src/autogen/locale.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5647,6 +5647,10 @@ export interface Locale extends ILocale {
56475647
* 設定項目はありません
56485648
*/
56495649
"nothingToConfigure": string;
5650+
/**
5651+
* リノート先のチャンネルを見る
5652+
*/
5653+
"viewRenotedChannel": string;
56505654
"_imageEditing": {
56515655
"_vars": {
56525656
/**

0 commit comments

Comments
 (0)