mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 06:53:09 +02:00
upd: only allow one renote
This commit is contained in:
parent
67f5caa61a
commit
a37da15eaf
1 changed files with 26 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue