mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-05 16:33:07 +02:00
upd: add support in frontend
This commit is contained in:
parent
feec3c302b
commit
dc10579950
7 changed files with 47 additions and 3 deletions
|
@ -39,6 +39,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</span>
|
||||
<span v-if="note.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ti ti-rocket-off"></i></span>
|
||||
<span v-if="note.channel" style="margin-left: 0.5em;" :title="note.channel.name"><i class="ti ti-device-tv"></i></span>
|
||||
<span v-if="note.updatedAt" style="margin-left: 0.5em;" :title="'edited'"><i class="ti ti-pencil"></i></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="renoteCollapsed" :class="$style.collapsedRenoteTarget">
|
||||
|
|
|
@ -58,6 +58,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<i v-else-if="appearNote.visibility === 'followers'" class="ti ti-lock"></i>
|
||||
<i v-else-if="appearNote.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
||||
</span>
|
||||
<span v-if="appearNote.updatedAt" style="margin-left: 0.5em;" :title="'Edited'"><i class="ti ti-pencil"></i></span>
|
||||
<span v-if="appearNote.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ti ti-rocket-off"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<i v-else-if="note.visibility === 'followers'" class="ti ti-lock"></i>
|
||||
<i v-else-if="note.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
||||
</span>
|
||||
<span v-if="note.updatedAt" style="margin-left: 0.5em;" :title="'Edited'"><i class="ti ti-pencil"></i></span>
|
||||
<span v-if="note.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ti ti-rocket-off"></i></span>
|
||||
<span v-if="note.channel" style="margin-left: 0.5em;" :title="note.channel.name"><i class="ti ti-device-tv"></i></span>
|
||||
</div>
|
||||
|
|
|
@ -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 ([
|
||||
|
|
|
@ -30,6 +30,7 @@ const props = defineProps<{
|
|||
instant?: boolean;
|
||||
fixed?: boolean;
|
||||
autofocus?: boolean;
|
||||
editId?: Misskey.entities.Note["id"];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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[]; };
|
||||
|
|
Loading…
Reference in a new issue