summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkNoteSub.vue
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-13 21:53:38 +0200
committerMar0xy <marie@kaifa.ch>2023-10-13 21:53:38 +0200
commit363df5b2560f7bf1ddb08f3a129e96fdf93d1442 (patch)
tree9d1f3b9c8a907321172e66eaf523745094983956 /packages/frontend/src/components/MkNoteSub.vue
parentfix rocket-launcher (diff)
downloadsharkey-363df5b2560f7bf1ddb08f3a129e96fdf93d1442.tar.gz
sharkey-363df5b2560f7bf1ddb08f3a129e96fdf93d1442.tar.bz2
sharkey-363df5b2560f7bf1ddb08f3a129e96fdf93d1442.zip
upd: add renote limit to other note components
Diffstat (limited to 'packages/frontend/src/components/MkNoteSub.vue')
-rw-r--r--packages/frontend/src/components/MkNoteSub.vue38
1 files changed, 30 insertions, 8 deletions
diff --git a/packages/frontend/src/components/MkNoteSub.vue b/packages/frontend/src/components/MkNoteSub.vue
index 57604cc94b..eef06d15e0 100644
--- a/packages/frontend/src/components/MkNoteSub.vue
+++ b/packages/frontend/src/components/MkNoteSub.vue
@@ -26,13 +26,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="note.repliesCount > 0" :class="$style.noteFooterButtonCount">{{ note.repliesCount }}</p>
</button>
<button
- v-if="canRenote"
- ref="renoteButton"
- class="_button"
- :class="$style.noteFooterButton"
- @mousedown="renote()"
+ v-if="canRenote"
+ ref="renoteButton"
+ class="_button"
+ :class="$style.noteFooterButton"
+ :style="renoted ? 'color: var(--accent) !important;' : ''"
+ @mousedown="renoted ? undoRenote() : renote()"
>
- <i class="ph-repeat ph-bold ph-lg"></i>
+ <i class="ph-rocket-launch ph-bold ph-lg"></i>
<p v-if="note.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ note.renoteCount }}</p>
</button>
<button v-else class="_button" :class="$style.noteFooterButton" disabled>
@@ -112,6 +113,7 @@ const muted = ref($i ? checkWordMute(props.note, $i, $i.mutedWords) : false);
const translation = ref(null);
const translating = ref(false);
const isDeleted = ref(false);
+const renoted = ref(false);
const reactButton = shallowRef<HTMLElement>();
const renoteButton = shallowRef<HTMLElement>();
const menuButton = shallowRef<HTMLElement>();
@@ -132,6 +134,16 @@ useNoteCapture({
isDeletedRef: isDeleted,
});
+if ($i) {
+ os.api("notes/renotes", {
+ noteId: appearNote.id,
+ userId: $i.id,
+ limit: 1,
+ }).then((res) => {
+ renoted.value = res.length > 0;
+ });
+}
+
function focus() {
el.value.focus();
}
@@ -203,6 +215,14 @@ function undoReact(note): void {
});
}
+function undoRenote() : void {
+ if (!renoted) return;
+ os.api("notes/unrenote", {
+ noteId: appearNote.id,
+ });
+ renoted.value = false;
+}
+
let showContent = $ref(false);
let replies: Misskey.entities.Note[] = $ref([]);
@@ -215,7 +235,7 @@ function renote(viaKeyboard = false) {
if (props.note.channel) {
items = items.concat([{
text: i18n.ts.inChannelRenote,
- icon: 'ph-repeat ph-bold ph-lg',
+ icon: 'ph-rocket-launch ph-bold ph-lg',
action: () => {
const el = renoteButton.value as HTMLElement | null | undefined;
if (el) {
@@ -230,6 +250,7 @@ function renote(viaKeyboard = false) {
channelId: props.note.channelId,
}).then(() => {
os.toast(i18n.ts.renoted);
+ renoted.value = true;
});
},
}, {
@@ -246,7 +267,7 @@ function renote(viaKeyboard = false) {
items = items.concat([{
text: i18n.ts.renote,
- icon: 'ph-repeat ph-bold ph-lg',
+ icon: 'ph-rocket-launch ph-bold ph-lg',
action: () => {
const el = renoteButton.value as HTMLElement | null | undefined;
if (el) {
@@ -260,6 +281,7 @@ function renote(viaKeyboard = false) {
renoteId: props.note.id,
}).then(() => {
os.toast(i18n.ts.renoted);
+ renoted.value = true;
});
},
}, {