summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-01-03 13:35:40 +0900
committerGitHub <noreply@github.com>2024-01-03 13:35:40 +0900
commita9127e3ecd0c5789ba01123b8c4bbfc22c4e70e3 (patch)
tree63864ff145adaaaff5288c17654ad9d61db6b7b2 /packages/frontend/src/scripts
parentenhance(frontend): カスタム絵文字追加画面の「タグ」の説明... (diff)
downloadsharkey-a9127e3ecd0c5789ba01123b8c4bbfc22c4e70e3.tar.gz
sharkey-a9127e3ecd0c5789ba01123b8c4bbfc22c4e70e3.tar.bz2
sharkey-a9127e3ecd0c5789ba01123b8c4bbfc22c4e70e3.zip
enhance(frontend): チャンネルノートのピン留めをノートメニューからできるように (#12887)
* enhance(frontend): チャンネルノートのピン留めをノートメニューからできるように * Update Changelog
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/get-note-menu.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts
index 7130e69279..b9224c5595 100644
--- a/packages/frontend/src/scripts/get-note-menu.ts
+++ b/packages/frontend/src/scripts/get-note-menu.ts
@@ -352,6 +352,42 @@ export function getNoteMenu(props: {
]
: []
),
+ ...(appearNote.channel && (appearNote.channel.userId === $i.id || $i.isModerator || $i.isAdmin) ? [
+ { type: 'divider' },
+ {
+ type: 'parent' as const,
+ icon: 'ti ti-device-tv',
+ text: i18n.ts.channel,
+ children: async () => {
+ const channelChildMenu = [] as MenuItem[];
+
+ const channel = await os.api('channels/show', { channelId: appearNote.channel!.id });
+
+ if (channel.pinnedNoteIds.includes(appearNote.id)) {
+ channelChildMenu.push({
+ icon: 'ti ti-pinned-off',
+ text: i18n.ts.unpin,
+ action: () => os.apiWithDialog('channels/update', {
+ channelId: appearNote.channel!.id,
+ pinnedNoteIds: channel.pinnedNoteIds.filter(id => id !== appearNote.id),
+ }),
+ });
+ } else {
+ channelChildMenu.push({
+ icon: 'ti ti-pin',
+ text: i18n.ts.pin,
+ action: () => os.apiWithDialog('channels/update', {
+ channelId: appearNote.channel!.id,
+ pinnedNoteIds: [...channel.pinnedNoteIds, appearNote.id],
+ }),
+ });
+ }
+ return channelChildMenu;
+ },
+ },
+ ]
+ : []
+ ),
...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [
{ type: 'divider' },
appearNote.userId === $i.id ? {