Skip to content

Commit

Permalink
fix(frontend): クライアント上での時間ベースの実績獲得動作が実績獲得後も発動している問題を修正 (misskey-dev#1…
Browse files Browse the repository at this point in the history
…4717)

* Check if time-based achievements are unlocked before initializing them in main-boot

(cherry picked from commit c0702fd92f70782005517c0065048ececa1ef287)

* Update Changelog

---------

Co-authored-by: Evan Paterakis <[email protected]>
  • Loading branch information
kakkokari-gtyih and GeopJr authored Oct 7, 2024
1 parent a594d9f commit d2f1d45
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
### Client
- Enhance: デザインの調整
- Enhance: ログイン画面の認証フローを改善
- Fix: クライアント上での時間ベースの実績獲得動作が実績獲得後も発動していた問題を修正
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/657)

### Server
- Enhance: セキュリティ向上のため、ログイン時にメール通知を行うように
Expand Down
28 changes: 17 additions & 11 deletions packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,25 @@ export async function mainBoot() {
claimAchievement('collectAchievements30');
}

window.setInterval(() => {
if (Math.floor(Math.random() * 20000) === 0) {
claimAchievement('justPlainLucky');
}
}, 1000 * 10);
if (!claimedAchievements.includes('justPlainLucky')) {
window.setInterval(() => {
if (Math.floor(Math.random() * 20000) === 0) {
claimAchievement('justPlainLucky');
}
}, 1000 * 10);
}

window.setTimeout(() => {
claimAchievement('client30min');
}, 1000 * 60 * 30);
if (!claimedAchievements.includes('client30min')) {
window.setTimeout(() => {
claimAchievement('client30min');
}, 1000 * 60 * 30);
}

window.setTimeout(() => {
claimAchievement('client60min');
}, 1000 * 60 * 60);
if (!claimedAchievements.includes('client60min')) {
window.setTimeout(() => {
claimAchievement('client60min');
}, 1000 * 60 * 60);
}

// 邪魔
//const lastUsed = miLocalStorage.getItem('lastUsed');
Expand Down

0 comments on commit d2f1d45

Please sign in to comment.