fix: copy visibility for renotes
This commit is contained in:
parent
ef2ec5035b
commit
7ad306831d
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<button
|
<button v-if="canRenote"
|
||||||
v-if="canRenote"
|
|
||||||
ref="buttonRef"
|
ref="buttonRef"
|
||||||
class="eddddedb _button canRenote"
|
class="eddddedb _button canRenote"
|
||||||
@click="renote()"
|
@click="renote()"
|
||||||
|
@ -13,9 +12,8 @@
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import { computed, defineComponent, ref } from 'vue';
|
||||||
import * as misskey from 'misskey-js';
|
|
||||||
import XDetails from '@/components/users-tooltip.vue';
|
import XDetails from '@/components/users-tooltip.vue';
|
||||||
import { pleaseLogin } from '@/scripts/please-login';
|
import { pleaseLogin } from '@/scripts/please-login';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
@ -23,11 +21,19 @@ import { $i } from '@/account';
|
||||||
import { useTooltip } from '@/scripts/use-tooltip';
|
import { useTooltip } from '@/scripts/use-tooltip';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
const props = defineProps<{
|
export default defineComponent({
|
||||||
note: misskey.entities.Note;
|
props: {
|
||||||
count: number;
|
count: {
|
||||||
}>();
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props) {
|
||||||
const buttonRef = ref<HTMLElement>();
|
const buttonRef = ref<HTMLElement>();
|
||||||
|
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
||||||
|
@ -35,7 +41,7 @@ const canRenote = computed(() => ['public', 'home'].includes(props.note.visibili
|
||||||
useTooltip(buttonRef, async (showing) => {
|
useTooltip(buttonRef, async (showing) => {
|
||||||
const renotes = await os.api('notes/renotes', {
|
const renotes = await os.api('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
limit: 11,
|
limit: 11
|
||||||
});
|
});
|
||||||
|
|
||||||
const users = renotes.map(x => x.user);
|
const users = renotes.map(x => x.user);
|
||||||
|
@ -46,7 +52,7 @@ useTooltip(buttonRef, async (showing) => {
|
||||||
showing,
|
showing,
|
||||||
users,
|
users,
|
||||||
count: props.count,
|
count: props.count,
|
||||||
targetElement: buttonRef.value,
|
targetElement: buttonRef.value
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,8 +64,9 @@ const renote = (viaKeyboard = false) => {
|
||||||
action: () => {
|
action: () => {
|
||||||
os.api('notes/create', {
|
os.api('notes/create', {
|
||||||
renoteId: props.note.id,
|
renoteId: props.note.id,
|
||||||
|
visibility: props.note.visibility,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
}, {
|
}, {
|
||||||
text: i18n.ts.quote,
|
text: i18n.ts.quote,
|
||||||
icon: 'fas fa-quote-right',
|
icon: 'fas fa-quote-right',
|
||||||
|
@ -67,11 +74,19 @@ const renote = (viaKeyboard = false) => {
|
||||||
os.post({
|
os.post({
|
||||||
renote: props.note,
|
renote: props.note,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
}], buttonRef.value, {
|
}], buttonRef.value, {
|
||||||
viaKeyboard,
|
viaKeyboard
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
buttonRef,
|
||||||
|
canRenote,
|
||||||
|
renote,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in New Issue