mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
copy changes to SkNoteSub.vue
This commit is contained in:
parent
7549f24702
commit
66f4976c5e
1 changed files with 39 additions and 66 deletions
|
@ -96,17 +96,18 @@ import { computed, ref, shallowRef, watch } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { computeMergedCw } from '@@/js/compute-merged-cw.js';
|
import { computeMergedCw } from '@@/js/compute-merged-cw.js';
|
||||||
import { host } from '@@/js/config.js';
|
import { host } from '@@/js/config.js';
|
||||||
import type { OpenOnRemoteOptions } from '@/utility/please-login.js';
|
|
||||||
import type { Visibility } from '@/utility/boost-quote.js';
|
import type { Visibility } from '@/utility/boost-quote.js';
|
||||||
|
import type { OpenOnRemoteOptions } from '@/utility/please-login.js';
|
||||||
import SkNoteHeader from '@/components/SkNoteHeader.vue';
|
import SkNoteHeader from '@/components/SkNoteHeader.vue';
|
||||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||||
import MkCwButton from '@/components/MkCwButton.vue';
|
import MkCwButton from '@/components/MkCwButton.vue';
|
||||||
import { notePage } from '@/filters/note.js';
|
import { notePage } from '@/filters/note.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
|
||||||
import * as sound from '@/utility/sound.js';
|
import * as sound from '@/utility/sound.js';
|
||||||
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import { $i } from '@/i.js';
|
||||||
import { userPage } from '@/filters/user.js';
|
import { userPage } from '@/filters/user.js';
|
||||||
import { checkWordMute } from '@/utility/check-word-mute.js';
|
import { checkWordMute } from '@/utility/check-word-mute.js';
|
||||||
import { pleaseLogin } from '@/utility/please-login.js';
|
import { pleaseLogin } from '@/utility/please-login.js';
|
||||||
|
@ -115,14 +116,10 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||||
import { reactionPicker } from '@/utility/reaction-picker.js';
|
import { reactionPicker } from '@/utility/reaction-picker.js';
|
||||||
import { claimAchievement } from '@/utility/achievements.js';
|
import { claimAchievement } from '@/utility/achievements.js';
|
||||||
import { getNoteMenu } from '@/utility/get-note-menu.js';
|
import { getNoteMenu } from '@/utility/get-note-menu.js';
|
||||||
import { useNoteCapture } from '@/use/use-note-capture.js';
|
|
||||||
import { boostMenuItems, computeRenoteTooltip } from '@/utility/boost-quote.js';
|
import { boostMenuItems, computeRenoteTooltip } from '@/utility/boost-quote.js';
|
||||||
import { prefer } from '@/preferences';
|
import { prefer } from '@/preferences.js';
|
||||||
import { store } from '@/store';
|
import { useNoteCapture } from '@/use/use-note-capture.js';
|
||||||
import { $i } from '@/i.js';
|
import { store } from '@/store.js';
|
||||||
|
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
|
||||||
const hideLine = computed(() => props.detail);
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -139,8 +136,12 @@ const props = withDefaults(defineProps<{
|
||||||
depth: 1,
|
depth: 1,
|
||||||
isReply: false,
|
isReply: false,
|
||||||
detailed: false,
|
detailed: false,
|
||||||
|
onDeleteCallback: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i?.id);
|
||||||
|
const hideLine = computed(() => props.detail);
|
||||||
|
|
||||||
const el = shallowRef<HTMLElement>();
|
const el = shallowRef<HTMLElement>();
|
||||||
const muted = ref($i ? checkWordMute(props.note, $i, $i.mutedWords) : false);
|
const muted = ref($i ? checkWordMute(props.note, $i, $i.mutedWords) : false);
|
||||||
const translation = ref<any>(null);
|
const translation = ref<any>(null);
|
||||||
|
@ -206,22 +207,21 @@ if ($i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function focus() {
|
function focus() {
|
||||||
el.value.focus();
|
el.value?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reply(viaKeyboard = false): void {
|
async function reply(viaKeyboard = false): Promise<void> {
|
||||||
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
os.post({
|
await os.post({
|
||||||
reply: props.note,
|
reply: props.note,
|
||||||
channel: props.note.channel,
|
channel: props.note.channel ?? undefined,
|
||||||
animation: !viaKeyboard,
|
animation: !viaKeyboard,
|
||||||
}, () => {
|
|
||||||
focus();
|
|
||||||
});
|
});
|
||||||
|
focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function react(viaKeyboard = false): void {
|
function react(): void {
|
||||||
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
sound.playMisskeySfx('reaction');
|
sound.playMisskeySfx('reaction');
|
||||||
|
@ -363,24 +363,23 @@ function quote() {
|
||||||
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
if (appearNote.value.channel) {
|
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel ?? undefined,
|
||||||
}).then((cancelled) => {
|
}).then((cancelled) => {
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: $i?.id,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
quote: true,
|
quote: true,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (!(res.length > 0)) return;
|
if (!(res.length > 0)) return;
|
||||||
const el = quoteButton.value as HTMLElement | null | undefined;
|
const popupEl = quoteButton.value as HTMLElement | null | undefined;
|
||||||
if (el && res.length > 0) {
|
if (popupEl && res.length > 0) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = popupEl.getBoundingClientRect();
|
||||||
const x = rect.left + (el.offsetWidth / 2);
|
const x = rect.left + (popupEl.offsetWidth / 2);
|
||||||
const y = rect.top + (el.offsetHeight / 2);
|
const y = rect.top + (popupEl.offsetHeight / 2);
|
||||||
const { dispose } = os.popup(MkRippleEffect, { x, y }, {
|
const { dispose } = os.popup(MkRippleEffect, { x, y }, {
|
||||||
end: () => dispose(),
|
end: () => dispose(),
|
||||||
});
|
});
|
||||||
|
@ -389,32 +388,6 @@ function quote() {
|
||||||
os.toast(i18n.ts.quoted);
|
os.toast(i18n.ts.quoted);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
os.post({
|
|
||||||
renote: appearNote.value,
|
|
||||||
}).then((cancelled) => {
|
|
||||||
if (cancelled) return;
|
|
||||||
misskeyApi('notes/renotes', {
|
|
||||||
noteId: props.note.id,
|
|
||||||
userId: $i.id,
|
|
||||||
limit: 1,
|
|
||||||
quote: true,
|
|
||||||
}).then((res) => {
|
|
||||||
if (!(res.length > 0)) return;
|
|
||||||
const el = quoteButton.value as HTMLElement | null | undefined;
|
|
||||||
if (el && res.length > 0) {
|
|
||||||
const rect = el.getBoundingClientRect();
|
|
||||||
const x = rect.left + (el.offsetWidth / 2);
|
|
||||||
const y = rect.top + (el.offsetHeight / 2);
|
|
||||||
const { dispose } = os.popup(MkRippleEffect, { x, y }, {
|
|
||||||
end: () => dispose(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
os.toast(i18n.ts.quoted);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function menu(): void {
|
function menu(): void {
|
||||||
|
|
Loading…
Add table
Reference in a new issue