diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2021-09-22 22:35:55 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-22 22:35:55 +0900 |
| commit | 14795b68f2234c90504cd0a979de42ff4d757441 (patch) | |
| tree | aef21d0af6db7f373fe095806fbccce414375fc3 /src/services | |
| parent | New Crowdin updates (#7764) (diff) | |
| download | misskey-14795b68f2234c90504cd0a979de42ff4d757441.tar.gz misskey-14795b68f2234c90504cd0a979de42ff4d757441.tar.bz2 misskey-14795b68f2234c90504cd0a979de42ff4d757441.zip | |
refactor: PackedHoge型をPacked<'Hoge'>型に書き換える (#7792)
* packedNotificationSchemaを更新
* read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加
* fix
* add header, choice, invitation
* test
* fix
* yatta
* remove no longer needed "as PackedUser/PackedNote"
* clean up
* add simple-schema
* fix lint
* define items in full Schema
* revert https://github.com/misskey-dev/misskey/pull/7772#discussion_r706627736
* user packとnote packの型不整合を修正
* add prelude/types.ts
* emoji
* signin
* game
* matching
* fix
* add emoji schema
* add reversiGame
* add reversiMatching
* remove signin schema (use Signin entity)
* add Packed type
* note-reaction
* user
* user-group
* user-list
* note
* app, messaging-message
* notification
* drive-file
* drive-folder
* following
* muting
* blocking
* hashtag
* page
* app (with modifying schema)
* import user?
* channel
* antenna
* clip
* gallery-post
* emoji
* Packed
* reversi-matching
* add changelog
* add changelog
* revert fix
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/note/read.ts | 12 | ||||
| -rw-r--r-- | src/services/push-notification.ts | 5 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/services/note/read.ts b/src/services/note/read.ts index b5e7de7976..f25f86da9c 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -6,15 +6,15 @@ import { Not, IsNull, In } from 'typeorm'; import { Channel } from '@/models/entities/channel'; import { checkHitAntenna } from '@/misc/check-hit-antenna'; import { getAntennas } from '@/misc/antenna-cache'; -import { PackedNote } from '@/models/repositories/note'; import { readNotificationByQuery } from '@/server/api/common/read-notification'; +import { Packed } from '@/misc/schema'; /** * Mark notes as read */ export default async function( userId: User['id'], - notes: (Note | PackedNote)[], + notes: (Note | Packed<'Note'>)[], info?: { following: Set<User['id']>; followingChannels: Set<Channel['id']>; @@ -34,10 +34,10 @@ export default async function( })).map(x => x.followeeId)); const myAntennas = (await getAntennas()).filter(a => a.userId === userId); - const readMentions: (Note | PackedNote)[] = []; - const readSpecifiedNotes: (Note | PackedNote)[] = []; - const readChannelNotes: (Note | PackedNote)[] = []; - const readAntennaNotes: (Note | PackedNote)[] = []; + const readMentions: (Note | Packed<'Note'>)[] = []; + const readSpecifiedNotes: (Note | Packed<'Note'>)[] = []; + const readChannelNotes: (Note | Packed<'Note'>)[] = []; + const readAntennaNotes: (Note | Packed<'Note'>)[] = []; for (const note of notes) { if (note.mentions && note.mentions.includes(userId)) { diff --git a/src/services/push-notification.ts b/src/services/push-notification.ts index 5bd7499692..5949d11b3b 100644 --- a/src/services/push-notification.ts +++ b/src/services/push-notification.ts @@ -2,11 +2,10 @@ import * as push from 'web-push'; import config from '@/config/index'; import { SwSubscriptions } from '@/models/index'; import { fetchMeta } from '@/misc/fetch-meta'; -import { PackedNotification } from '../models/repositories/notification'; -import { PackedMessagingMessage } from '../models/repositories/messaging-message'; +import { Packed } from '@/misc/schema'; type notificationType = 'notification' | 'unreadMessagingMessage'; -type notificationBody = PackedNotification | PackedMessagingMessage; +type notificationBody = Packed<'Notification'> | Packed<'MessagingMessage'>; export default async function(userId: string, type: notificationType, body: notificationBody) { const meta = await fetchMeta(); |