mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-21 21:45:11 +00:00
merge: chore: fix type errors in useNoteCapture (!701)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/701 Approved-by: Marie <github@yuugi.dev> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
d103b76ab0
1 changed files with 8 additions and 8 deletions
|
@ -13,16 +13,16 @@ import { misskeyApi } from './misskey-api.js';
|
||||||
export function useNoteCapture(props: {
|
export function useNoteCapture(props: {
|
||||||
rootEl: ShallowRef<HTMLElement | undefined>;
|
rootEl: ShallowRef<HTMLElement | undefined>;
|
||||||
note: Ref<Misskey.entities.Note>;
|
note: Ref<Misskey.entities.Note>;
|
||||||
pureNote: Ref<Misskey.entities.Note>;
|
pureNote?: Ref<Misskey.entities.Note>;
|
||||||
isDeletedRef: Ref<boolean>;
|
isDeletedRef: Ref<boolean>;
|
||||||
onReplyCallback: (replyNote: Misskey.entities.Note) => void | undefined;
|
onReplyCallback?: (replyNote: Misskey.entities.Note) => void | Promise<void>;
|
||||||
onDeleteCallback: (id: Misskey.entities.Note['id']) => void | undefined;
|
onDeleteCallback?: (id: Misskey.entities.Note['id']) => void | Promise<void>;
|
||||||
}) {
|
}) {
|
||||||
const note = props.note;
|
const note = props.note;
|
||||||
const pureNote = props.pureNote !== undefined ? props.pureNote : props.note;
|
const pureNote = props.pureNote !== undefined ? props.pureNote : props.note;
|
||||||
const connection = $i ? useStream() : null;
|
const connection = $i ? useStream() : null;
|
||||||
|
|
||||||
async function onStreamNoteUpdated(noteData): void {
|
async function onStreamNoteUpdated(noteData): Promise<void> {
|
||||||
const { type, id, body } = noteData;
|
const { type, id, body } = noteData;
|
||||||
|
|
||||||
if ((id !== note.value.id) && (id !== pureNote.value.id)) return;
|
if ((id !== note.value.id) && (id !== pureNote.value.id)) return;
|
||||||
|
@ -39,7 +39,7 @@ export function useNoteCapture(props: {
|
||||||
|
|
||||||
await props.onReplyCallback(replyNote);
|
await props.onReplyCallback(replyNote);
|
||||||
} catch { /* empty */ }
|
} catch { /* empty */ }
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ export function useNoteCapture(props: {
|
||||||
case 'pollVoted': {
|
case 'pollVoted': {
|
||||||
const choice = body.choice;
|
const choice = body.choice;
|
||||||
|
|
||||||
const choices = [...note.value.poll.choices];
|
const choices = [...note.value.poll!.choices];
|
||||||
choices[choice] = {
|
choices[choice] = {
|
||||||
...choices[choice],
|
...choices[choice],
|
||||||
votes: choices[choice].votes + 1,
|
votes: choices[choice].votes + 1,
|
||||||
|
@ -90,7 +90,7 @@ export function useNoteCapture(props: {
|
||||||
} : {}),
|
} : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
note.value.poll.choices = choices;
|
note.value.poll!.choices = choices;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ export function useNoteCapture(props: {
|
||||||
const editedNote = await misskeyApi('notes/show', {
|
const editedNote = await misskeyApi('notes/show', {
|
||||||
noteId: id,
|
noteId: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const keys = new Set<string>();
|
const keys = new Set<string>();
|
||||||
Object.keys(editedNote)
|
Object.keys(editedNote)
|
||||||
.concat(Object.keys(note.value))
|
.concat(Object.keys(note.value))
|
||||||
|
|
Loading…
Reference in a new issue