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
This commit is contained in:
tamaina 2021-09-22 22:35:55 +09:00 committed by GitHub
parent bea42f5804
commit 14795b68f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 312 additions and 122 deletions

View file

@ -3,15 +3,13 @@ import * as mfm from 'mfm-js';
import { Note } from '@/models/entities/note';
import { User } from '@/models/entities/user';
import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index';
import { SchemaType } from '@/misc/schema';
import { Packed } from '@/misc/schema';
import { nyaize } from '@/misc/nyaize';
import { awaitAll } from '@/prelude/await-all';
import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib';
import { NoteReaction } from '@/models/entities/note-reaction';
import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis';
export type PackedNote = SchemaType<typeof packedNoteSchema>;
@EntityRepository(Note)
export class NoteRepository extends Repository<Note> {
public validateCw(x: string) {
@ -67,7 +65,7 @@ export class NoteRepository extends Repository<Note> {
return true;
}
private async hideNote(packedNote: PackedNote, meId: User['id'] | null) {
private async hideNote(packedNote: Packed<'Note'>, meId: User['id'] | null) {
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
let hide = false;
@ -137,7 +135,7 @@ export class NoteRepository extends Repository<Note> {
myReactions: Map<Note['id'], NoteReaction | null>;
};
}
): Promise<PackedNote> {
): Promise<Packed<'Note'>> {
const opts = Object.assign({
detail: true,
skipHide: false