fix(frontend): remove ensureSignin from reversi game page (#17130)

This commit is contained in:
poppingmoon 2026-01-28 20:44:58 +09:00 committed by GitHub
parent ec97f49919
commit 5e2b041f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 20 deletions

View File

@ -24,6 +24,7 @@
- Fix: 2月29日を誕生日に設定している場合、閏年以外は3月1日を誕生日として扱うように修正
- Fix: `Mk:C:container``borderWidth` が正しく反映されない問題を修正
- Fix: mCaptchaが正しく動作しない問題を修正
- Fix: 非ログイン時にリバーシの対局が表示されない問題を修正
### Server
- Enhance: OAuthのクライアント情報取得Client Information Discoveryにおいて、IndieWeb Living Standard 11 July 2024で定義されているJSONドキュメント形式に対応しました

View File

@ -151,7 +151,7 @@ import MkButton from '@/components/MkButton.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { deepClone } from '@/utility/clone.js';
import { ensureSignin } from '@/i.js';
import { $i } from '@/i.js';
import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import { userPage } from '@/filters/user.js';
@ -160,8 +160,6 @@ import * as os from '@/os.js';
import { confetti } from '@/utility/confetti.js';
import { genId } from '@/utility/id.js';
const $i = ensureSignin();
const props = defineProps<{
game: Misskey.entities.ReversiGameDetailed;
connection?: Misskey.IChannelConnection<Misskey.Channels['reversiGame']> | null;
@ -182,13 +180,13 @@ const engine = shallowRef<Reversi.Game>(Reversi.Serializer.restoreGame({
}));
const iAmPlayer = computed(() => {
return game.value.user1Id === $i.id || game.value.user2Id === $i.id;
return game.value.user1Id === $i?.id || game.value.user2Id === $i?.id;
});
const myColor = computed(() => {
if (!iAmPlayer.value) return null;
if (game.value.user1Id === $i.id && game.value.black === 1) return true;
if (game.value.user2Id === $i.id && game.value.black === 2) return true;
if (game.value.user1Id === $i?.id && game.value.black === 1) return true;
if (game.value.user2Id === $i?.id && game.value.black === 2) return true;
return false;
});
@ -219,7 +217,7 @@ const isMyTurn = computed(() => {
if (!iAmPlayer.value) return false;
const u = turnUser.value;
if (u == null) return false;
return u.id === $i.id;
return u.id === $i?.id;
});
const cellsStyle = computed(() => {
@ -354,7 +352,7 @@ function onStreamEnded(x: {
}) {
game.value = deepClone(x.game);
if (game.value.winnerId === $i.id) {
if (game.value.winnerId === $i?.id) {
confetti({
duration: 1000 * 3,
});

View File

@ -116,7 +116,7 @@ import * as Misskey from 'misskey-js';
import * as Reversi from 'misskey-reversi';
import type { MenuItem } from '@/types/menu.js';
import { i18n } from '@/i18n.js';
import { ensureSignin } from '@/i.js';
import { $i } from '@/i.js';
import { deepClone } from '@/utility/clone.js';
import MkButton from '@/components/MkButton.vue';
import MkRadios from '@/components/MkRadios.vue';
@ -126,8 +126,6 @@ import * as os from '@/os.js';
import type { MkRadiosOption } from '@/components/MkRadios.vue';
import { useRouter } from '@/router.js';
const $i = ensureSignin();
const router = useRouter();
const mapCategories = Array.from(new Set(Object.values(Reversi.maps).map(x => x.category)));
@ -158,13 +156,13 @@ const mapName = computed(() => {
return found ? found.name! : '-Custom-';
});
const isReady = computed(() => {
if (game.value.user1Id === $i.id && game.value.user1Ready) return true;
if (game.value.user2Id === $i.id && game.value.user2Ready) return true;
if (game.value.user1Id === $i?.id && game.value.user1Ready) return true;
if (game.value.user2Id === $i?.id && game.value.user2Ready) return true;
return false;
});
const isOpReady = computed(() => {
if (game.value.user1Id !== $i.id && game.value.user1Ready) return true;
if (game.value.user2Id !== $i.id && game.value.user2Ready) return true;
if (game.value.user1Id !== $i?.id && game.value.user1Ready) return true;
if (game.value.user2Id !== $i?.id && game.value.user2Ready) return true;
return false;
});
@ -241,7 +239,7 @@ function updateSettings(key: typeof Misskey.reversiUpdateKeys[number]) {
}
function onUpdateSettings<K extends typeof Misskey.reversiUpdateKeys[number]>({ userId, key, value }: { userId: string; key: K; value: Misskey.entities.ReversiGameDetailed[K]; }) {
if (userId === $i.id) return;
if (userId === $i?.id) return;
if (game.value[key] === value) return;
game.value[key] = value;
if (isReady.value) {

View File

@ -17,15 +17,13 @@ import GameBoard from './game.board.vue';
import { misskeyApi } from '@/utility/misskey-api.js';
import { definePage } from '@/page.js';
import { useStream } from '@/stream.js';
import { ensureSignin } from '@/i.js';
import { $i } from '@/i.js';
import { useRouter } from '@/router.js';
import * as os from '@/os.js';
import { url } from '@@/js/config.js';
import { i18n } from '@/i18n.js';
import { useInterval } from '@@/js/use-interval.js';
const $i = ensureSignin();
const router = useRouter();
const props = defineProps<{
@ -74,7 +72,7 @@ async function fetchGame() {
connection.value.on('canceled', x => {
connection.value?.dispose();
if (x.userId !== $i.id) {
if (x.userId !== $i?.id) {
os.alert({
type: 'warning',
text: i18n.ts._reversi.gameCanceled,