summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-13 21:40:43 +0200
committerMar0xy <marie@kaifa.ch>2023-10-13 21:40:43 +0200
commita37da15eafaba7f975373f7a7aa8ec2ee903757f (patch)
treeb11c2bc6be2392ce266f7f950753beaeafebd0e5 /packages/frontend/src/components
parentfix: icons (diff)
downloadsharkey-a37da15eafaba7f975373f7a7aa8ec2ee903757f.tar.gz
sharkey-a37da15eafaba7f975373f7a7aa8ec2ee903757f.tar.bz2
sharkey-a37da15eafaba7f975373f7a7aa8ec2ee903757f.zip
upd: only allow one renote
Diffstat (limited to 'packages/frontend/src/components')
-rw-r--r--packages/frontend/src/components/MkNoteDetailed.vue30
1 files changed, 26 insertions, 4 deletions
diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue
index 0acc609221..633b12aaa5 100644
--- a/packages/frontend/src/components/MkNoteDetailed.vue
+++ b/packages/frontend/src/components/MkNoteDetailed.vue
@@ -111,9 +111,10 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="renoteButton"
class="_button"
:class="$style.noteFooterButton"
- @mousedown="renote()"
+ :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="appearNote.renoteCount > 0" :class="$style.noteFooterButtonCount">{{ appearNote.renoteCount }}</p>
</button>
<button v-else class="_button" :class="$style.noteFooterButton" disabled>
@@ -266,6 +267,7 @@ const renoteUri = appearNote.renote ? appearNote.renote.uri : null;
const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const isDeleted = ref(false);
+const renoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref(null);
const translating = ref(false);
@@ -275,6 +277,16 @@ const conversation = ref<Misskey.entities.Note[]>([]);
const replies = ref<Misskey.entities.Note[]>([]);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || appearNote.userId === $i.id);
+if ($i){
+ os.api("notes/renotes", {
+ noteId: appearNote.id,
+ userId: $i.id,
+ limit: 1,
+ }).then((res) => {
+ renoted.value = res.length > 0;
+ });
+}
+
const keymap = {
'r': () => reply(true),
'e|a|plus': () => react(true),
@@ -337,7 +349,7 @@ function renote(viaKeyboard = false) {
if (appearNote.channel) {
items = items.concat([{
text: i18n.ts.inChannelRenote,
- icon: 'ph-repeat ph-bold ph-lg',
+ icon: 'ph-rocket-launcher ph-bold ph-lg',
action: () => {
const el = renoteButton.value as HTMLElement | null | undefined;
if (el) {
@@ -352,6 +364,7 @@ function renote(viaKeyboard = false) {
channelId: appearNote.channelId,
}).then(() => {
os.toast(i18n.ts.renoted);
+ renoted.value = true;
});
},
}, {
@@ -368,7 +381,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) {
@@ -382,6 +395,7 @@ function renote(viaKeyboard = false) {
renoteId: appearNote.id,
}).then(() => {
os.toast(i18n.ts.renoted);
+ renoted.value = true;
});
},
}, {
@@ -466,6 +480,14 @@ function undoReact(note): void {
});
}
+function undoRenote() : void {
+ if (!renoted) return;
+ os.api("notes/unrenote", {
+ noteId: appearNote.id,
+ });
+ renoted.value = false;
+}
+
function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true;