diff --git a/fe_calckey/frontend/calckey-js/src/entities.ts b/fe_calckey/frontend/calckey-js/src/entities.ts index 2bf6324..19e9fa3 100644 --- a/fe_calckey/frontend/calckey-js/src/entities.ts +++ b/fe_calckey/frontend/calckey-js/src/entities.ts @@ -163,6 +163,7 @@ export type Note = { url?: string; updatedAt?: DateString; isHidden?: boolean; + hasRenotedBefore?: boolean; }; export type NoteReaction = { diff --git a/fe_calckey/frontend/client/src/components/MkRenoteButton.vue b/fe_calckey/frontend/client/src/components/MkRenoteButton.vue index f0303d5..eb2fcb2 100644 --- a/fe_calckey/frontend/client/src/components/MkRenoteButton.vue +++ b/fe_calckey/frontend/client/src/components/MkRenoteButton.vue @@ -36,6 +36,8 @@ const props = defineProps<{ const buttonRef = ref(); +const hasRenotedBefore = ref(props.note.hasRenotedBefore ?? false); + const canRenote = computed( () => ["public", "home"].includes(props.note.visibility) || @@ -68,14 +70,6 @@ useTooltip(buttonRef, async (showing) => { const renote = async (viaKeyboard = false, ev?: MouseEvent) => { pleaseLogin(); - const renotes = await os.api("notes/renotes", { - noteId: props.note.id, - userId: $i.id, - limit: 1, - }); - - const hasRenotedBefore = renotes.length > 0; - let buttonActions: Array = []; if (props.note.visibility === "public") { @@ -88,7 +82,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { renoteId: props.note.id, visibility: "public", }); - hasRenotedBefore = true; + hasRenotedBefore.value = true; const el = ev && ((ev.currentTarget ?? ev.target) as @@ -115,7 +109,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { renoteId: props.note.id, visibility: "home", }); - hasRenotedBefore = true; + hasRenotedBefore.value = true; const el = ev && ((ev.currentTarget ?? ev.target) as @@ -143,7 +137,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { visibility: "specified", visibleUserIds: props.note.visibleUserIds, }); - hasRenotedBefore = true; + hasRenotedBefore.value = true; const el = ev && ((ev.currentTarget ?? ev.target) as @@ -168,7 +162,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { renoteId: props.note.id, visibility: "followers", }); - hasRenotedBefore = true; + hasRenotedBefore.value = true; const el = ev && ((ev.currentTarget ?? ev.target) as @@ -206,7 +200,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { localOnly: true, } ); - hasRenotedBefore = true; + hasRenotedBefore.value = true; const el = ev && ((ev.currentTarget ?? ev.target) as @@ -245,7 +239,7 @@ const renote = async (viaKeyboard = false, ev?: MouseEvent) => { os.api("notes/unrenote", { noteId: props.note.id, }); - hasRenotedBefore = false; + hasRenotedBefore.value = false; }, }); }