Frontend: Fixed renote button
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
ci/woodpecker/push/ociImagePush Pipeline was successful
Details
This commit is contained in:
parent
2ffb82895c
commit
dde74dd56b
|
@ -163,6 +163,7 @@ export type Note = {
|
|||
url?: string;
|
||||
updatedAt?: DateString;
|
||||
isHidden?: boolean;
|
||||
hasRenotedBefore?: boolean;
|
||||
};
|
||||
|
||||
export type NoteReaction = {
|
||||
|
|
|
@ -36,6 +36,8 @@ const props = defineProps<{
|
|||
|
||||
const buttonRef = ref<HTMLElement>();
|
||||
|
||||
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<MenuItem> = [];
|
||||
|
||||
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;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue