fix pleaseLogin on *NoteSub

we really need to factor these things out
This commit is contained in:
dakkar 2024-12-12 10:04:54 +00:00
parent c9f588276c
commit 0ebdf91b28
2 changed files with 24 additions and 12 deletions

View file

@ -98,7 +98,8 @@ import { $i } from '@/account.js';
import { userPage } from '@/filters/user.js';
import { checkWordMute } from '@/scripts/check-word-mute.js';
import { defaultStore } from '@/store.js';
import { pleaseLogin } from '@/scripts/please-login.js';
import { host } from '@@/js/config.js';
import { pleaseLogin, type OpenOnRemoteOptions } from '@/scripts/please-login.js';
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { reactionPicker } from '@/scripts/reaction-picker.js';
@ -145,6 +146,11 @@ const isRenote = (
props.note.poll == null
);
const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
type: 'lookup',
url: `https://${host}/notes/${appearNote.value.id}`,
}));
async function addReplyTo(replyNote: Misskey.entities.Note) {
replies.value.unshift(replyNote);
appearNote.value.repliesCount += 1;
@ -182,7 +188,7 @@ function focus() {
}
function reply(viaKeyboard = false): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
os.post({
reply: props.note,
@ -194,7 +200,7 @@ function reply(viaKeyboard = false): void {
}
function react(viaKeyboard = false): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
sound.playMisskeySfx('reaction');
if (props.note.reactionAcceptance === 'likeOnly') {
@ -228,7 +234,7 @@ function react(viaKeyboard = false): void {
}
function like(): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
sound.playMisskeySfx('reaction');
misskeyApi('notes/like', {
@ -288,7 +294,7 @@ function boostVisibility() {
}
function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
if (appearNote.value.channel) {
@ -332,7 +338,7 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
}
function quote() {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
if (appearNote.value.channel) {

View file

@ -106,7 +106,8 @@ import { $i } from '@/account.js';
import { userPage } from '@/filters/user.js';
import { checkWordMute } from '@/scripts/check-word-mute.js';
import { defaultStore } from '@/store.js';
import { pleaseLogin } from '@/scripts/please-login.js';
import { host } from '@@/js/config.js';
import { pleaseLogin, type OpenOnRemoteOptions } from '@/scripts/please-login.js';
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { reactionPicker } from '@/scripts/reaction-picker.js';
@ -159,6 +160,11 @@ const isRenote = (
props.note.poll == null
);
const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
type: 'lookup',
url: `https://${host}/notes/${appearNote.value.id}`,
}));
async function addReplyTo(replyNote: Misskey.entities.Note) {
replies.value.unshift(replyNote);
appearNote.value.repliesCount += 1;
@ -196,7 +202,7 @@ function focus() {
}
function reply(viaKeyboard = false): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
os.post({
reply: props.note,
@ -208,7 +214,7 @@ function reply(viaKeyboard = false): void {
}
function react(viaKeyboard = false): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
sound.playMisskeySfx('reaction');
if (props.note.reactionAcceptance === 'likeOnly') {
@ -242,7 +248,7 @@ function react(viaKeyboard = false): void {
}
function like(): void {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
sound.playMisskeySfx('reaction');
misskeyApi('notes/like', {
@ -302,7 +308,7 @@ function boostVisibility() {
}
function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
if (appearNote.value.channel) {
@ -346,7 +352,7 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
}
function quote() {
pleaseLogin();
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
showMovedDialog();
if (appearNote.value.channel) {