fix(frontend): 周年の実績が閏年を考慮するように (#13525)
* fix(frontend): 周年の実績が閏年を考慮するように * まちがえた * Update Changelog * 変数の定義回数を減らす
This commit is contained in:
parent
c680e35aa0
commit
f4a5740412
@ -9,6 +9,7 @@
|
||||
- Enhance: リアクション・いいねの総数を表示するように
|
||||
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
|
||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||
|
||||
### Server
|
||||
-
|
||||
|
@ -187,14 +187,26 @@ export async function mainBoot() {
|
||||
if ($i.followersCount >= 500) claimAchievement('followers500');
|
||||
if ($i.followersCount >= 1000) claimAchievement('followers1000');
|
||||
|
||||
if (Date.now() - new Date($i.createdAt).getTime() > 1000 * 60 * 60 * 24 * 365) {
|
||||
claimAchievement('passedSinceAccountCreated1');
|
||||
}
|
||||
if (Date.now() - new Date($i.createdAt).getTime() > 1000 * 60 * 60 * 24 * 365 * 2) {
|
||||
claimAchievement('passedSinceAccountCreated2');
|
||||
}
|
||||
if (Date.now() - new Date($i.createdAt).getTime() > 1000 * 60 * 60 * 24 * 365 * 3) {
|
||||
const createdAt = new Date($i.createdAt);
|
||||
const createdAtThreeYearsLater = new Date($i.createdAt);
|
||||
createdAtThreeYearsLater.setFullYear(createdAtThreeYearsLater.getFullYear() + 3);
|
||||
if (now >= createdAtThreeYearsLater) {
|
||||
claimAchievement('passedSinceAccountCreated3');
|
||||
claimAchievement('passedSinceAccountCreated2');
|
||||
claimAchievement('passedSinceAccountCreated1');
|
||||
} else {
|
||||
const createdAtTwoYearsLater = new Date($i.createdAt);
|
||||
createdAtTwoYearsLater.setFullYear(createdAtTwoYearsLater.getFullYear() + 2);
|
||||
if (now >= createdAtTwoYearsLater) {
|
||||
claimAchievement('passedSinceAccountCreated2');
|
||||
claimAchievement('passedSinceAccountCreated1');
|
||||
} else {
|
||||
const createdAtOneYearLater = new Date($i.createdAt);
|
||||
createdAtOneYearLater.setFullYear(createdAtOneYearLater.getFullYear() + 1);
|
||||
if (now >= createdAtOneYearLater) {
|
||||
claimAchievement('passedSinceAccountCreated1');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (claimedAchievements.length >= 30) {
|
||||
@ -229,7 +241,7 @@ export async function mainBoot() {
|
||||
|
||||
const latestDonationInfoShownAt = miLocalStorage.getItem('latestDonationInfoShownAt');
|
||||
const neverShowDonationInfo = miLocalStorage.getItem('neverShowDonationInfo');
|
||||
if (neverShowDonationInfo !== 'true' && (new Date($i.createdAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3))) && !location.pathname.startsWith('/miauth')) {
|
||||
if (neverShowDonationInfo !== 'true' && (createdAt.getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 3))) && !location.pathname.startsWith('/miauth')) {
|
||||
if (latestDonationInfoShownAt == null || (new Date(latestDonationInfoShownAt).getTime() < (Date.now() - (1000 * 60 * 60 * 24 * 30)))) {
|
||||
popup(defineAsyncComponent(() => import('@/components/MkDonation.vue')), {}, {}, 'closed');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user