1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-27 06:18:51 +09:00

enhance(frontend): 「単なるラッキー」の調整 (#14807)

* enhance(frontend): 「単なるラッキー」の調整

* refactor

* comment

* Update Changelog

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
かっこかり 2024-10-23 14:23:29 +09:00 committed by GitHub
parent 48d1539f3b
commit 15ae1605ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 3 deletions

View File

@ -7,7 +7,8 @@
### Client
- Enhance: Bull DashboardでRelationship Queueの状態も確認できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/751)
- Enhance: ドライブでソートができるように
- Enhance: ドライブでソートができるように
- Enhance: 「単なるラッキー」の取得条件を変更
- Enhance: 投稿フォームでEscキーを押したときIME入力中ならフォームを閉じないように #10866
- Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正
- Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正

View File

@ -231,11 +231,41 @@ export async function mainBoot() {
}
if (!claimedAchievements.includes('justPlainLucky')) {
window.setInterval(() => {
let justPlainLuckyTimer: number | null = null;
let lastVisibilityChangedAt = Date.now();
function claimPlainLucky() {
if (document.visibilityState !== 'visible') {
if (justPlainLuckyTimer != null) window.clearTimeout(justPlainLuckyTimer);
return;
}
if (Math.floor(Math.random() * 20000) === 0) {
claimAchievement('justPlainLucky');
} else {
justPlainLuckyTimer = window.setTimeout(claimPlainLucky, 1000 * 10);
}
}, 1000 * 10);
}
window.addEventListener('visibilitychange', () => {
const now = Date.now();
if (document.visibilityState === 'visible') {
// タブを高速で切り替えたら取得処理が何度も走るのを防ぐ
if ((now - lastVisibilityChangedAt) < 1000 * 10) {
justPlainLuckyTimer = window.setTimeout(claimPlainLucky, 1000 * 10);
} else {
claimPlainLucky();
}
} else if (justPlainLuckyTimer != null) {
window.clearTimeout(justPlainLuckyTimer);
justPlainLuckyTimer = null;
}
lastVisibilityChangedAt = now;
}, { passive: true });
claimPlainLucky();
}
if (!claimedAchievements.includes('client30min')) {