diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 0bc94f5bd2..5edd175f7a 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -39,6 +39,8 @@ SPDX-License-Identifier: AGPL-3.0-only + +
diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index e8e52e00a4..56322ef089 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -58,6 +58,7 @@ SPDX-License-Identifier: AGPL-3.0-only +
diff --git a/packages/frontend/src/components/MkNoteHeader.vue b/packages/frontend/src/components/MkNoteHeader.vue index dda7238d27..a54f1e0c31 100644 --- a/packages/frontend/src/components/MkNoteHeader.vue +++ b/packages/frontend/src/components/MkNoteHeader.vue @@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only + diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 2b4dcc8ed4..9a7327eaf6 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -143,6 +143,7 @@ const props = withDefaults(defineProps<{ fixed?: boolean; autofocus?: boolean; freezeAfterPosted?: boolean; + editId?: Misskey.entities.Note["id"]; }>(), { initialVisibleUsers: () => [], autofocus: true, @@ -709,6 +710,7 @@ async function post(ev?: MouseEvent) { visibility: visibility, visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined, reactionAcceptance, + editId: props.editId ? props.editId : undefined, }; if (withHashtags && hashtags && hashtags.trim() !== '') { @@ -731,7 +733,7 @@ async function post(ev?: MouseEvent) { } posting = true; - os.api('notes/create', postData, token).then(() => { + os.api(postData.editId ? "notes/edit" : "notes/create", postData, token).then(() => { if (props.freezeAfterPosted) { posted = true; } else { @@ -755,7 +757,7 @@ async function post(ev?: MouseEvent) { const text = postData.text ?? ''; const lowerCase = text.toLowerCase(); - if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('misskey')) { + if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('sharkey')) { claimAchievement('iLoveMisskey'); } if ([ diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue index c07a166a83..25a8788a38 100644 --- a/packages/frontend/src/components/MkPostFormDialog.vue +++ b/packages/frontend/src/components/MkPostFormDialog.vue @@ -30,6 +30,7 @@ const props = defineProps<{ instant?: boolean; fixed?: boolean; autofocus?: boolean; + editId?: Misskey.entities.Note["id"]; }>(); const emit = defineEmits<{ diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 734a632039..4d3189b735 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -171,6 +171,18 @@ export function getNoteMenu(props: { } }); } + function edit(): void { + //os.api('notes/delete', { + // noteId: appearNote.id, + //}); + os.post({ + initialNote: appearNote, + renote: appearNote.renote, + reply: appearNote.reply, + channel: appearNote.channel, + editId: appearNote.id, + }); +} function toggleFavorite(favorite: boolean): void { claimAchievement('noteFavorited1'); @@ -353,10 +365,17 @@ export function getNoteMenu(props: { ...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [ null, appearNote.userId === $i.id ? { + icon: 'ti ti-pencil', + text: i18n.ts.edit, + danger: true, + action: edit, + }: undefined, + { icon: 'ti ti-edit', text: i18n.ts.deleteAndEdit, + danger: true, action: delEdit, - } : undefined, + }, { icon: 'ti ti-trash', text: i18n.ts.delete, diff --git a/packages/misskey-js/src/api.types.ts b/packages/misskey-js/src/api.types.ts index 46d790fe31..3275f0c8e6 100644 --- a/packages/misskey-js/src/api.types.ts +++ b/packages/misskey-js/src/api.types.ts @@ -508,6 +508,24 @@ export type Endpoints = { }; }; res: { createdNote: Note }; }; 'notes/delete': { req: { noteId: Note['id']; }; res: null; }; + 'notes/edit': { req: { + visibility?: 'public' | 'home' | 'followers' | 'specified', + visibleUserIds?: User['id'][]; + text?: null | string; + cw?: null | string; + viaMobile?: boolean; + localOnly?: boolean; + fileIds?: DriveFile['id'][]; + replyId?: null | Note['id']; + renoteId?: null | Note['id']; + channelId?: null | Channel['id']; + poll?: null | { + choices: string[]; + multiple?: boolean; + expiresAt?: null | number; + expiredAfter?: null | number; + }; + }; res: { createdNote: Note }; }; 'notes/favorites/create': { req: { noteId: Note['id']; }; res: null; }; 'notes/favorites/delete': { req: { noteId: Note['id']; }; res: null; }; 'notes/featured': { req: TODO; res: Note[]; };