Skip to content

Commit

Permalink
enhance(backend): notify new login (misskey-dev#14673)
Browse files Browse the repository at this point in the history
* wip

* Update CHANGELOG.md

* wip

* fix

* Update index.d.ts

* Update SigninService.ts

* Update MkNotification.vue
  • Loading branch information
syuilo authored and liumingye committed Nov 1, 2024
1 parent eea63af commit 2e52781
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Enhance: フォロワーへのメッセージ欄のデザイン改良

### Server
-
- Enhance: セキュリティ向上のため、ログイン時にメール通知を行うように


## 2024.9.0
Expand Down
6 changes: 5 additions & 1 deletion packages/backend/src/models/Notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { userExportableEntities } from '@/types.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
import { MiAccessToken } from './AccessToken.js';
import { MiRole } from './Role.js';
import { MiDriveFile } from './DriveFile.js';
import { userExportableEntities } from '@/types.js';

export type MiNotification = {
type: 'note';
Expand Down Expand Up @@ -90,6 +90,10 @@ export type MiNotification = {
createdAt: string;
exportedEntity: typeof userExportableEntities[number];
fileId: MiDriveFile['id'];
} | {
type: 'login';
id: string;
createdAt: string;
} | {
type: 'app';
id: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/api/SigninService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { SigninsRepository, UserProfilesRepository } from '@/models/_.js';
import type { SigninsRepository } from '@/models/_.js';
import { IdService } from '@/core/IdService.js';
import type { MiLocalUser } from '@/models/User.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
Expand Down
9 changes: 1 addition & 8 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4469,14 +4469,7 @@ export type components = {
exportedEntity: 'antenna' | 'blocking' | 'clip' | 'customEmoji' | 'favorite' | 'following' | 'muting' | 'note' | 'userList';
/** Format: id */
fileId: string;
}) | {
/** Format: id */
id: string;
/** Format: date-time */
createdAt: string;
/** @enum {string} */
type: 'login';
} | ({
}) | ({
/** Format: id */
id: string;
/** Format: date-time */
Expand Down
6 changes: 6 additions & 0 deletions packages/sw/src/scripts/create-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
data,
}];

case 'login':
return [i18n.ts._notification.login, {
badge: iconUrl('login-2'),
data,
}];

case 'exportCompleted': {
const entityName = {
antenna: i18n.ts.antennas,
Expand Down

0 comments on commit 2e52781

Please sign in to comment.