mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 04:23:09 +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>
|
||||||
<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.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.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>
|
</div>
|
||||||
<div v-if="renoteCollapsed" :class="$style.collapsedRenoteTarget">
|
<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 === 'followers'" class="ti ti-lock"></i>
|
||||||
<i v-else-if="appearNote.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
<i v-else-if="appearNote.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
||||||
</span>
|
</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>
|
<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>
|
||||||
</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 === 'followers'" class="ti ti-lock"></i>
|
||||||
<i v-else-if="note.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
<i v-else-if="note.visibility === 'specified'" ref="specified" class="ti ti-mail"></i>
|
||||||
</span>
|
</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.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.channel" style="margin-left: 0.5em;" :title="note.channel.name"><i class="ti ti-device-tv"></i></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -143,6 +143,7 @@ const props = withDefaults(defineProps<{
|
||||||
fixed?: boolean;
|
fixed?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
freezeAfterPosted?: boolean;
|
freezeAfterPosted?: boolean;
|
||||||
|
editId?: Misskey.entities.Note["id"];
|
||||||
}>(), {
|
}>(), {
|
||||||
initialVisibleUsers: () => [],
|
initialVisibleUsers: () => [],
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -709,6 +710,7 @@ async function post(ev?: MouseEvent) {
|
||||||
visibility: visibility,
|
visibility: visibility,
|
||||||
visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined,
|
visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined,
|
||||||
reactionAcceptance,
|
reactionAcceptance,
|
||||||
|
editId: props.editId ? props.editId : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (withHashtags && hashtags && hashtags.trim() !== '') {
|
if (withHashtags && hashtags && hashtags.trim() !== '') {
|
||||||
|
@ -731,7 +733,7 @@ async function post(ev?: MouseEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
posting = true;
|
posting = true;
|
||||||
os.api('notes/create', postData, token).then(() => {
|
os.api(postData.editId ? "notes/edit" : "notes/create", postData, token).then(() => {
|
||||||
if (props.freezeAfterPosted) {
|
if (props.freezeAfterPosted) {
|
||||||
posted = true;
|
posted = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -755,7 +757,7 @@ async function post(ev?: MouseEvent) {
|
||||||
|
|
||||||
const text = postData.text ?? '';
|
const text = postData.text ?? '';
|
||||||
const lowerCase = text.toLowerCase();
|
const lowerCase = text.toLowerCase();
|
||||||
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('misskey')) {
|
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('sharkey')) {
|
||||||
claimAchievement('iLoveMisskey');
|
claimAchievement('iLoveMisskey');
|
||||||
}
|
}
|
||||||
if ([
|
if ([
|
||||||
|
|
|
@ -30,6 +30,7 @@ const props = defineProps<{
|
||||||
instant?: boolean;
|
instant?: boolean;
|
||||||
fixed?: boolean;
|
fixed?: boolean;
|
||||||
autofocus?: boolean;
|
autofocus?: boolean;
|
||||||
|
editId?: Misskey.entities.Note["id"];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
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 {
|
function toggleFavorite(favorite: boolean): void {
|
||||||
claimAchievement('noteFavorited1');
|
claimAchievement('noteFavorited1');
|
||||||
|
@ -353,10 +365,17 @@ export function getNoteMenu(props: {
|
||||||
...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [
|
...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [
|
||||||
null,
|
null,
|
||||||
appearNote.userId === $i.id ? {
|
appearNote.userId === $i.id ? {
|
||||||
|
icon: 'ti ti-pencil',
|
||||||
|
text: i18n.ts.edit,
|
||||||
|
danger: true,
|
||||||
|
action: edit,
|
||||||
|
}: undefined,
|
||||||
|
{
|
||||||
icon: 'ti ti-edit',
|
icon: 'ti ti-edit',
|
||||||
text: i18n.ts.deleteAndEdit,
|
text: i18n.ts.deleteAndEdit,
|
||||||
|
danger: true,
|
||||||
action: delEdit,
|
action: delEdit,
|
||||||
} : undefined,
|
},
|
||||||
{
|
{
|
||||||
icon: 'ti ti-trash',
|
icon: 'ti ti-trash',
|
||||||
text: i18n.ts.delete,
|
text: i18n.ts.delete,
|
||||||
|
|
|
@ -508,6 +508,24 @@ export type Endpoints = {
|
||||||
};
|
};
|
||||||
}; res: { createdNote: Note }; };
|
}; res: { createdNote: Note }; };
|
||||||
'notes/delete': { req: { noteId: Note['id']; }; res: null; };
|
'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/create': { req: { noteId: Note['id']; }; res: null; };
|
||||||
'notes/favorites/delete': { req: { noteId: Note['id']; }; res: null; };
|
'notes/favorites/delete': { req: { noteId: Note['id']; }; res: null; };
|
||||||
'notes/featured': { req: TODO; res: Note[]; };
|
'notes/featured': { req: TODO; res: Note[]; };
|
||||||
|
|
Loading…
Reference in a new issue