Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(frontend): ノートのリンクをリモートのサーバーのURLとしてコピーできるように #13566

Closed
wants to merge 7 commits into from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Enhance: サーバー情報ページ・お問い合わせページを改善
(Cherry-picked from https://github.com/taiyme/misskey/pull/238)
- Enhance: AiScriptを0.19.0にアップデート
- Enhance: リモートのノートのリンクをコピーできるように
- Fix: `/about#federation` ページなどで各インスタンスのチャートが表示されなくなっていた問題を修正
- Fix: ユーザーページの追加情報のラベルを投稿者のサーバーの絵文字で表示する (#13968)
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
Expand Down
29 changes: 16 additions & 13 deletions packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ export function getNoteMenu(props: {
os.success();
}

function copyLink(): void {
copyToClipboard(`${url}/notes/${appearNote.id}`);
os.success();
}

function togglePin(pin: boolean): void {
os.apiWithDialog(pin ? 'i/pin' : 'i/unpin', {
noteId: appearNote.id,
Expand Down Expand Up @@ -301,7 +296,7 @@ export function getNoteMenu(props: {
text: i18n.ts.unclip,
danger: true,
action: unclip,
}, { type: 'divider' }] : []
}, { type: 'divider' as const }] : []
), {
icon: 'ti ti-info-circle',
text: i18n.ts.details,
Expand All @@ -310,14 +305,22 @@ export function getNoteMenu(props: {
icon: 'ti ti-copy',
text: i18n.ts.copyContent,
action: copyContent,
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)
, (appearNote.url || appearNote.uri) ? {
},
getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink),
...((appearNote.url != null || appearNote.uri != null) ? [{
icon: 'ti ti-link',
text: `${i18n.ts.copyLink} (${i18n.ts.remote})`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

別のローカライズ作るのとどっちがいいだろうか

リンクをコピー(リモート)よりリモートのリンクをコピーのほうが良いと思ったけど

action: () => {
copyToClipboard(appearNote.url ?? appearNote.uri);
os.success();
},
}, {
icon: 'ti ti-external-link',
text: i18n.ts.showOnRemote,
action: () => {
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
},
} : undefined,
}] : []),
...(isSupportShare() ? [{
icon: 'ti ti-share',
text: i18n.ts.share,
Expand All @@ -328,7 +331,7 @@ export function getNoteMenu(props: {
text: i18n.ts.translate,
action: translate,
} : undefined,
{ type: 'divider' },
{ type: 'divider' as const },
statePromise.then(state => state.isFavorited ? {
icon: 'ti ti-star-off',
text: i18n.ts.unfavorite,
Expand Down Expand Up @@ -384,13 +387,13 @@ export function getNoteMenu(props: {
: []
),*/
...(appearNote.userId !== $i.id ? [
{ type: 'divider' },
{ type: 'divider' as const },
appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined,
]
: []
),
...(appearNote.channel && (appearNote.channel.userId === $i.id || $i.isModerator || $i.isAdmin) ? [
{ type: 'divider' },
{ type: 'divider' as const },
{
type: 'parent' as const,
icon: 'ti ti-device-tv',
Expand Down Expand Up @@ -426,7 +429,7 @@ export function getNoteMenu(props: {
: []
),
...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [
{ type: 'divider' },
{ type: 'divider' as const },
appearNote.userId === $i.id ? {
icon: 'ti ti-edit',
text: i18n.ts.deleteAndEdit,
Expand Down
Loading