Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit 719f0f0

Browse files
committed
ポイント受領通知を追加
1 parent 4774311 commit 719f0f0

File tree

13 files changed

+168
-15
lines changed

13 files changed

+168
-15
lines changed

locales/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10018,6 +10018,10 @@ export interface Locale extends ILocale {
1001810018
* ログインボーナス
1001910019
*/
1002010020
"loginbonus": string;
10021+
/**
10022+
* {sender}から{point}{pointName}をもらいました
10023+
*/
10024+
"acceptPoints": ParameterizedString<"sender" | "point" | "pointName">;
1002110025
/**
1002210026
* 通知テスト
1002310027
*/
@@ -10119,6 +10123,10 @@ export interface Locale extends ILocale {
1011910123
* ログインボーナス
1012010124
*/
1012110125
"loginBonus": string;
10126+
/**
10127+
* {pointName}獲得
10128+
*/
10129+
"acceptPoints": ParameterizedString<"pointName">;
1012210130
/**
1012310131
* エクスポートが完了した
1012410132
*/

locales/ja-JP.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,7 @@ _notification:
26412641
emptyPushNotificationMessage: "プッシュ通知の更新をしました"
26422642
achievementEarned: "実績を獲得"
26432643
loginbonus: "ログインボーナス"
2644+
acceptPoints: "{sender}から{point}{pointName}をもらいました"
26442645
testNotification: "通知テスト"
26452646
checkNotificationBehavior: "通知の表示を確かめる"
26462647
sendTestNotification: "テスト通知を送信する"
@@ -2668,6 +2669,7 @@ _notification:
26682669
roleAssigned: "ロールが付与された"
26692670
achievementEarned: "実績の獲得"
26702671
loginBonus: "ログインボーナス"
2672+
acceptPoints: "{pointName}獲得"
26712673
exportCompleted: "エクスポートが完了した"
26722674
login: "ログイン"
26732675
test: "通知のテスト"

packages/backend/src/core/entities/NotificationEntityService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ export class NotificationEntityService implements OnModuleInit {
171171
...(notification.type === 'loginBonus' ? {
172172
loginBonus: notification.loginBonus,
173173
} : {}),
174+
...(notification.type === 'acceptPoints' ? {
175+
getPoint: notification.getPoint,
176+
} : {}),
174177
...(notification.type === 'app' ? {
175178
body: notification.customBody,
176179
header: notification.customHeader,

packages/backend/src/models/Notification.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ export type MiNotification = {
5959
createdAt: string;
6060
loginBonus: number;
6161
} | {
62-
type: 'sendPoint';
62+
type: 'acceptPoints';
6363
id: string;
6464
createdAt: string;
6565
getPoint: number;
66-
senderId: MiUser['id'];
66+
notifierId: MiUser['id'];
6767
} | {
6868
type: 'pollEnded';
6969
id: string;

packages/backend/src/models/json-schema/notification.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,30 @@ export const packedNotificationSchema = {
412412
},
413413
},
414414
},
415+
}, {
416+
type: 'object',
417+
properties: {
418+
...baseSchema.properties,
419+
type: {
420+
type: 'string',
421+
optional: false, nullable: false,
422+
enum: ['acceptPoints'],
423+
},
424+
getPoint: {
425+
type: 'number',
426+
optional: false, nullable: false,
427+
},
428+
user: {
429+
type: 'object',
430+
ref: 'UserLite',
431+
optional: false, nullable: false,
432+
},
433+
userId: {
434+
type: 'string',
435+
optional: false, nullable: false,
436+
format: 'id',
437+
},
438+
},
415439
}, {
416440
type: 'object',
417441
properties: {

packages/backend/src/server/api/endpoints/point/send.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
5252
getPoints: user.getPoints + ps.points,
5353
});
5454

55-
this.notificationService.createNotification(user.id, 'sendPoint', {
55+
this.notificationService.createNotification(user.id, 'acceptPoints', {
5656
getPoint: ps.points,
57-
senderId: sender.id,
58-
});
57+
}, sender.id);
5958

6059
return {};
6160
});

packages/backend/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const notificationTypes = [
4848
'app',
4949
'test',
5050
'loginBonus',
51+
'acceptPoints',
5152
] as const;
5253

5354
export const groupedNotificationTypes = [

packages/frontend/src/components/MkNotification.vue

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ SPDX-License-Identifier: AGPL-3.0-only
5555
[$style.t_achievementEarned]:
5656
notification.type === 'achievementEarned' || notification.type === 'loginBonus',
5757
[$style.t_exportCompleted]: notification.type === 'exportCompleted',
58-
[$style.t_login]: notification.type === 'login',
59-
[$style.t_roleAssigned]:
58+
[$style.t_login]: notification.type === 'login',
59+
[$style.t_acceptPoints]: notification.type === 'acceptPoints',
60+
[$style.t_roleAssigned]:
6061
notification.type === 'roleAssigned' &&
6162
notification.role.iconUrl == null,
6263
},
@@ -90,6 +91,10 @@ SPDX-License-Identifier: AGPL-3.0-only
9091
v-else-if="notification.type === 'loginBonus'"
9192
class="ti ti-medal"
9293
></i>
94+
<i
95+
v-else-if="notification.type === 'acceptPoints'"
96+
class="ti ti-medal"
97+
></i>
9398
<i v-else-if="notification.type === 'exportCompleted'" class="ti ti-archive"></i>
9499
<i v-else-if="notification.type === 'login'" class="ti ti-login-2"></i>
95100
<template v-else-if="notification.type === 'roleAssigned'">
@@ -140,7 +145,8 @@ SPDX-License-Identifier: AGPL-3.0-only
140145
notification.type === 'quote' ||
141146
notification.type === 'reaction' ||
142147
notification.type === 'receiveFollowRequest' ||
143-
notification.type === 'followRequestAccepted'
148+
notification.type === 'followRequestAccepted' ||
149+
notification.type === 'acceptPoints'
144150
"
145151
v-user-preview="notification.user.id"
146152
:class="$style.headerName"
@@ -298,6 +304,18 @@ SPDX-License-Identifier: AGPL-3.0-only
298304
})
299305
}}
300306
</div>
307+
<div
308+
v-else-if="notification.type === 'acceptPoints'"
309+
:class="$style.text"
310+
>
311+
{{
312+
i18n.tsx._notification.acceptPoints({
313+
point: notification.getPoint,
314+
pointName: instance?.pointName ?? i18n.ts.point,
315+
sender: notification.user.username,
316+
})
317+
}}
318+
</div>
301319
<MkA
302320
v-else-if="notification.type === 'achievementEarned'"
303321
:class="$style.text"
@@ -488,6 +506,7 @@ function getActualReactedUsersCount(
488506
--eventReactionHeart: var(--MI_THEME-love);
489507
--eventReaction: #e99a0b;
490508
--eventAchievement: #cb9a11;
509+
--eventAcceptPoints: #cb9a11;
491510
--eventLogin: #007aff;
492511
--eventOther: #88a6b7;
493512
}
@@ -612,6 +631,12 @@ function getActualReactedUsersCount(
612631
pointer-events: none;
613632
}
614633
634+
.t_acceptPoints {
635+
padding: 3px;
636+
background: var(--eventAcceptPoints);
637+
pointer-events: none;
638+
}
639+
615640
.t_login {
616641
padding: 3px;
617642
background: var(--eventLogin);

packages/misskey-js/etc/misskey-js.api.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ declare namespace entities {
18651865
UsersAchievementsRequest,
18661866
UsersAchievementsResponse,
18671867
UsersUpdateMemoRequest,
1868-
PointSendRequest,
1868+
PointSendRequest,
18691869
FetchRssRequest,
18701870
FetchRssResponse,
18711871
FetchExternalResourcesRequest,
@@ -2998,6 +2998,9 @@ type PingResponse = operations['ping']['responses']['200']['content']['applicati
29982998
// @public (undocumented)
29992999
type PinnedUsersResponse = operations['pinned-users']['responses']['200']['content']['application/json'];
30003000

3001+
// @public (undocumented)
3002+
type PointSendRequest = operations['point___send']['requestBody']['content']['application/json'];
3003+
30013004
// @public (undocumented)
30023005
type PromoReadRequest = operations['promo___read']['requestBody']['content']['application/json'];
30033006

@@ -3526,8 +3529,6 @@ type UsersShowResponse = operations['users___show']['responses']['200']['content
35263529
// @public (undocumented)
35273530
type UsersUpdateMemoRequest = operations['users___update-memo']['requestBody']['content']['application/json'];
35283531

3529-
// @public (undocumented)
3530-
type PointSendRequest = operations['point___send']['requestBody']['content']['application/json']
35313532
// Warnings were encountered during analysis:
35323533
//
35333534
// src/entities.ts:50:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts

packages/misskey-js/src/autogen/apiClientJSDoc.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4344,6 +4344,18 @@ declare module '../api.js' {
43444344
credential?: string | null,
43454345
): Promise<SwitchCaseResponseType<E, P>>;
43464346

4347+
/**
4348+
* No description provided.
4349+
*
4350+
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
4351+
* **Credential required**: *Yes* / **Permission**: *write:points*
4352+
*/
4353+
request<E extends 'point/send', P extends Endpoints[E]['req']>(
4354+
endpoint: E,
4355+
params: P,
4356+
credential?: string | null,
4357+
): Promise<SwitchCaseResponseType<E, P>>;
4358+
43474359
/**
43484360
* No description provided.
43494361
*

0 commit comments

Comments
 (0)