fix(frontend): ログインダイアログが表示されたあとの処理がおかしくなる問題を修正

This commit is contained in:
kakkokari-gtyih 2025-12-26 16:13:50 +09:00
parent bc78bb9b8e
commit e446075871
8 changed files with 63 additions and 32 deletions

View File

@ -81,7 +81,13 @@ function onFollowChange(user: Misskey.entities.UserDetailed) {
}
async function onClick() {
pleaseLogin({ openOnRemote: { type: 'web', path: `/@${props.user.username}@${props.user.host ?? host}` } });
const isLoggedIn = await pleaseLogin({
openOnRemote: {
type: 'web',
path: `/@${props.user.username}@${props.user.host ?? host}`,
},
});
if (!isLoggedIn) return;
wait.value = true;

View File

@ -468,8 +468,12 @@ if (!props.mock) {
}
}
function renote() {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
async function renote() {
if (props.mock) return;
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
showMovedDialog();
const { menu } = getRenoteMenu({ note: note, renoteButton, mock: props.mock });
@ -478,11 +482,12 @@ function renote() {
subscribeManuallyToNoteCapture();
}
function reply(): void {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (props.mock) {
return;
}
async function reply() {
if (props.mock) return;
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
os.post({
reply: appearNote,
channel: appearNote.channel,
@ -491,8 +496,10 @@ function reply(): void {
});
}
function react(): void {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
async function react() {
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
showMovedDialog();
if (appearNote.reactionAcceptance === 'likeOnly') {
sound.playMisskeySfx('reaction');
@ -621,10 +628,12 @@ async function clip(): Promise<void> {
os.popupMenu(await getNoteClipMenu({ note: note, currentClip: currentClip?.value }), clipButton.value).then(focus);
}
function showRenoteMenu(): void {
async function showRenoteMenu() {
if (props.mock) {
return;
}
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
function getUnrenote(): MenuItem {
return {
@ -649,7 +658,6 @@ function showRenoteMenu(): void {
};
if (isMyRenote) {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
os.popupMenu([
renoteDetailsMenu,
getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote),

View File

@ -448,8 +448,10 @@ if (appearNote.reactionAcceptance === 'likeOnly') {
});
}
function renote() {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
async function renote() {
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
showMovedDialog();
const { menu } = getRenoteMenu({ note: note, renoteButton });
@ -459,8 +461,10 @@ function renote() {
subscribeManuallyToNoteCapture();
}
function reply(): void {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
async function reply() {
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
showMovedDialog();
os.post({
reply: appearNote,
@ -470,8 +474,10 @@ function reply(): void {
});
}
function react(): void {
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
async function react() {
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
showMovedDialog();
if (appearNote.reactionAcceptance === 'likeOnly') {
sound.playMisskeySfx('reaction');
@ -569,9 +575,12 @@ async function clip(): Promise<void> {
os.popupMenu(await getNoteClipMenu({ note: note }), clipButton.value).then(focus);
}
function showRenoteMenu(): void {
async function showRenoteMenu() {
if (!isMyRenote) return;
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
os.popupMenu([{
text: i18n.ts.unrenote,
icon: 'ti ti-trash',

View File

@ -90,7 +90,8 @@ const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
const vote = async (id: number) => {
if (props.readOnly || closed.value || isVoted.value) return;
pleaseLogin({ openOnRemote: pleaseLoginContext.value });
const isLoggedIn = await pleaseLogin({ openOnRemote: pleaseLoginContext.value });
if (!isLoggedIn) return;
const { canceled } = await os.confirm({
type: 'question',

View File

@ -709,8 +709,8 @@ export function contextMenu(items: MenuItem[], ev: MouseEvent): Promise<void> {
}));
}
export function post(props: PostFormProps = {}): Promise<void> {
pleaseLogin({
export async function post(props: PostFormProps = {}): Promise<void> {
const isLoggedIn = await pleaseLogin({
openOnRemote: (props.initialText || props.initialNote ? {
type: 'share',
params: {
@ -720,6 +720,7 @@ export function post(props: PostFormProps = {}): Promise<void> {
},
} : undefined),
});
if (!isLoggedIn) return;
showMovedDialog();
return new Promise(resolve => {

View File

@ -151,9 +151,11 @@ function shareWithNote() {
});
}
function like() {
async function like() {
if (!flash.value) return;
pleaseLogin();
const isLoggedIn = await pleaseLogin();
if (!isLoggedIn) return;
os.apiWithDialog('flash/like', {
flashId: flash.value.id,
@ -165,7 +167,9 @@ function like() {
async function unlike() {
if (!flash.value) return;
pleaseLogin();
const isLoggedIn = await pleaseLogin();
if (!isLoggedIn) return;
const confirm = await os.confirm({
type: 'warning',

View File

@ -197,7 +197,8 @@ async function matchHeatbeat() {
}
async function matchUser() {
pleaseLogin();
const isLoggedIn = await pleaseLogin();
if (!isLoggedIn) return;
const user = await os.selectUser({ includeSelf: false, localOnly: true });
if (user == null) return;
@ -207,8 +208,9 @@ async function matchUser() {
matchHeatbeat();
}
function matchAny(ev: MouseEvent) {
pleaseLogin();
async function matchAny(ev: MouseEvent) {
const isLoggedIn = await pleaseLogin();
if (!isLoggedIn) return;
os.popupMenu([{
text: i18n.ts._reversi.allowIrregularRules,

View File

@ -48,8 +48,8 @@ export async function pleaseLogin(opts: {
path?: string;
message?: string;
openOnRemote?: OpenOnRemoteOptions;
} = {}) {
if ($i) return;
} = {}): Promise<boolean> {
if ($i != null) return true;
let _openOnRemote: OpenOnRemoteOptions | undefined = undefined;
@ -71,5 +71,5 @@ export async function pleaseLogin(opts: {
closed: () => dispose(),
});
throw new Error('signin required');
return false;
}