Skip to content

feat: ログインボーナスの時刻とポイント範囲を管理画面で設定 - #60

Merged
mattyatea merged 1 commit into
developfrom
codex/login-bonus-settings
Oct 4, 2026
Merged

mattyatea merged 1 commit into
developfrom
codex/login-bonus-settings

Conversation

@mattyatea

Copy link
Copy Markdown

What

コントロールパネルの「全般」にログインボーナス設定を表示し、有効・無効、付与日の切り替え時刻(日本時間)、付与ポイントの下限・上限を保存できるようにします。初期値は日本時間00:00、1〜5ポイントで、上下限を同じ値にすると固定ポイントになります。

時刻以降の最初のアクセスで1日1回付与します。ページを開いたままの場合は再読み込みが必要です。範囲の逆転は画面とAPIで拒否し、切り替え時刻の変更で最終付与日が過去に戻ることを防ぎます。

Why

ログインボーナスが無効でも管理画面に設定項目がなく、有効化や付与条件の変更ができませんでした。サーバーのタイムゾーンに依存していた日付判定も、指定した日本時間で切り替わるようにします。

Additional info (optional)

ログインボーナス設定

flowchart LR
  A["/api/i"] --> B{"有効・ロールで許可・未付与?"}
  B -->|いいえ| C["付与しない"]
  B -->|はい| D["付与日をDBで確保"]
  D -->|確保できた| E["設定範囲のポイントを加算"]
  D -->|確保できない| C
  E --> F["ログインボーナス通知"]
Loading
erDiagram
  META {
    varchar id PK
    boolean enableLoginBonus
    varchar loginBonusResetTime "新規: HH:mm、日本時間"
    integer loginBonusMinPoints "新規: 下限"
    integer loginBonusMaxPoints "新規: 上限"
  }
  USER {
    varchar id PK
    integer points
  }
  USER_PROFILE {
    varchar userId PK, FK
    varchar lastLoginBonusDate
  }
  USER ||--|| USER_PROFILE : profile
Loading

検証: backendの対象テスト20件、frontendの対象テスト2件、両パッケージの型検査、変更ファイルlint、SPDX・locale検査がPASS。pnpm build-misskey-js-with-typesでAPI型を再生成し、pnpm --filter backend check-migrationsもpending DDLなしでPASS。実画面で設定保存、10ポイント固定の付与、再読み込み時の重複なし、逆転範囲の保存不可を確認しました。

反映には新規migrationの適用、ビルド、再起動が必要です。既存の有効・無効の設定は引き継ぎます。本番への反映・全体ビルドは未実施です。

CHANGELOG候補: ログインボーナスの付与時刻とポイント範囲を管理画面から設定できるように。

実装・検証・PR作成にCodexを使用しました。

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

Copilot AI balanced review requested due to automatic review settings October 4, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: Type4ny-Project/Misskey/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2373c4a0-537c-41ad-9ef0-47133ab26c12
📥 Commits

Reviewing files that changed from the base of the PR and between ae89203 and b278694.

⛔ Files ignored due to path filters (1)
  • docs/screenshots/login-bonus-settings.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • locales/ja-JP.yml
  • packages/backend/migration/1791144811075-LoginBonusSettings.js
  • packages/backend/src/core/LoginBonusService.ts
  • packages/backend/src/models/Meta.ts
  • packages/backend/src/server/api/endpoints/admin/meta.ts
  • packages/backend/src/server/api/endpoints/admin/update-meta.ts
  • packages/backend/test/unit/server/api/endpoints/admin/update-meta.ts
  • packages/backend/test/unit/server/api/endpoints/i.ts
  • packages/frontend/src/pages/admin/settings.vue
  • packages/frontend/test/unit/admin-login-bonus.test.ts
  • packages/i18n/src/autogen/locale.ts
  • packages/misskey-js/src/autogen/types.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -12271,6 +12271,15 @@
                     "enableLoginBonus": {
                       "type": "boolean"
                     },
+                    "loginBonusResetTime": {
+                      "type": "string"
+                    },
+                    "loginBonusMinPoints": {
+                      "type": "integer"
+                    },
+                    "loginBonusMaxPoints": {
+                      "type": "integer"
+                    },
                     "cacheRemoteFiles": {
                       "type": "boolean"
                     },
@@ -12967,6 +12976,9 @@
                     "nowLocalUsers",
                     "maxLocalUsers",
                     "enableLoginBonus",
+                    "loginBonusResetTime",
+                    "loginBonusMinPoints",
+                    "loginBonusMaxPoints",
                     "cacheRemoteFiles",
                     "cacheRemoteSensitiveFiles",
                     "emailRequiredForSignup",
@@ -22160,6 +22172,20 @@
                   "enableLoginBonus": {
                     "type": "boolean"
                   },
+                  "loginBonusResetTime": {
+                    "type": "string",
+                    "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
+                  },
+                  "loginBonusMinPoints": {
+                    "type": "integer",
+                    "minimum": 1,
+                    "maximum": 2147483647
+                  },
+                  "loginBonusMaxPoints": {
+                    "type": "integer",
+                    "minimum": 1,
+                    "maximum": 2147483647
+                  },
                   "disableRegistration": {
                     "type": [
                       "boolean",
@@ -22921,6 +22947,15 @@
                   "$ref": "#/components/schemas/Error"
                 },
                 "examples": {
+                  "INVALID_LOGIN_BONUS_POINTS_RANGE": {
+                    "value": {
+                      "error": {
+                        "message": "Minimum login bonus points must not exceed maximum points.",
+                        "code": "INVALID_LOGIN_BONUS_POINTS_RANGE",
+                        "id": "6e2ffe67-587e-41f9-887f-3355e95161e7"
+                      }
+                    }
+                  },
                   "INVALID_PARAM": {
                     "value": {
                       "error": {

Get diff files from Workflow Page

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

🖥 Frontend Diagnostics Report

(No significant changes)

View details

Requests by resource type
Type Requests Encoded bytes
Base Head Δ Base Head Δ
Document 2 2 0 34 KB 34 KB 0 B
Script 151 151 0 2.4 MB 2.4 MB 0 B
Stylesheet 63 63 0 319 KB 319 KB 0 B
Fetch 28 28 0 47 KB 47 KB 0 B
Image 9 9 0 238 KB 238 KB 0 B
Font 2 2 0 129 KB 129 KB 0 B
Other 9 9 0 421 KB 421 KB 0 B
V8 heap snapshot statistics
Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 12 MB
± 879 B
12 MB
± 5.7 KB
$\text{-9.5 KB}$
$\text{-0.1\%}$
5.8 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 2.9 MB 2.9 MB $\text{-492 B}$ 1.3 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 1.3 MB 1.3 MB $\text{-8 B}$ 200 B
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 121 KB 121 KB 0 B 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 0 B 0 B 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 0 B 0 B 0 B 0 B
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 2.1 MB 2.1 MB $\text{-68 B}$ 360 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 5.4 MB 5.4 MB $\text{-8.9 KB}$ 4.7 KB

Download representative heap snapshot: base / head

📦 Bundle Stats

Chunk size diff (2 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 6.1 MB 6.1 MB $\color{orange}{\text{+3.2 KB}}$ $\text{+0.1\%}$
src/pages/admin/settings.vue ja-JP/haphjDVoN-C6ypOVNA.js → ja-JP/jQwzhSEpP-D3Nyp5IC.js
34 KB 37 KB $\color{orange}{\text{+3 KB}}$ $\color{orange}{\text{+8.9\%}}$
search-index:admin ja-JP/haphjDVoN-BHvNZ7tP.js → ja-JP/jQwzhSEpP-CqcM-gDY.js
26 KB 26 KB $\text{+139 B}$ $\color{orange}{\text{+0.5\%}}$
(other generated chunks) 2.3 MB 2.3 MB 0 B 0%
Startup chunk size (0 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 934 KB 934 KB 0 B 0%
(other generated chunks) 860 KB 860 KB 0 B 0%
(other) 74 KB 74 KB 0 B 0%

Startup chunks are the Vite entry for src/_boot_.ts and its static imports.

Bundles Modules Entries Imports Size
Static Dynamic Rendered Gzip Brotli
Base 506 3,004 22 11,213 364 11 MB 3 MB 2.6 MB
Head 506 3,004 22 11,213 364 11 MB 3 MB 2.6 MB
Δ 0 0 0 0 0 $\color{orange}{\text{+6 KB}}$ $\text{+826 B}$ $\text{+528 B}$
Δ (%) 0% 0% 0% 0% 0% $\text{+0.1\%}$ $\text{+0\%}$ $\text{+0\%}$

Open treemap HTML

@mattyatea
mattyatea merged commit e08d977 into develop Oct 4, 2026
44 checks passed
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

⚙️ Backend Diagnostics Report

Memory: After GC

(No significant changes)

V8 Heap Snapshot Statistics

Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 90 MB
± 2.8 KB
90 MB
± 13 KB
$\text{+12 KB}$
$\text{+0\%}$
13 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 26 MB 26 MB $\text{+1.7 KB}$ 6.9 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 31 MB 31 MB $\text{+6 KB}$ 1.1 KB
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 4.9 MB 4.9 MB $\text{+424 B}$ 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 566 KB 566 KB 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 2.3 MB 2.3 MB $\text{+192 B}$ 1.7 KB
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 25 MB 25 MB $\text{+2.7 KB}$ 47 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 39 KB 39 KB 0 B 0 B

Download representative heap snapshot: base / head

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants