refactor: Expand schema (#7772)

* 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の型不整合を修正
This commit is contained in:
tamaina 2021-09-12 01:12:23 +09:00 committed by GitHub
parent f59f424795
commit 53f3b779bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 148 additions and 129 deletions

View file

@ -95,7 +95,7 @@ export class NoteRepository extends Repository<Note> {
hide = true;
} else if (meId === packedNote.userId) {
hide = false;
} else if (packedNote.reply && (meId === (packedNote.reply as PackedNote).userId)) {
} else if (packedNote.reply && (meId === packedNote.reply.userId)) {
// 自分の投稿に対するリプライ
hide = false;
} else if (packedNote.mentions && packedNote.mentions.some(id => meId === id)) {
@ -353,7 +353,7 @@ export const packedNoteSchema = {
},
user: {
type: 'object' as const,
ref: 'User',
ref: 'User' as const,
optional: false as const, nullable: false as const,
},
replyId: {
@ -371,12 +371,12 @@ export const packedNoteSchema = {
reply: {
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
ref: 'Note' as const,
},
renote: {
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
ref: 'Note' as const,
},
viaMobile: {
type: 'boolean' as const,
@ -423,7 +423,7 @@ export const packedNoteSchema = {
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'DriveFile'
ref: 'DriveFile' as const,
}
},
tags: {
@ -447,11 +447,24 @@ export const packedNoteSchema = {
channel: {
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Channel'
items: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
},
name: {
type: 'string' as const,
optional: false as const, nullable: true as const,
},
},
},
},
localOnly: {
type: 'boolean' as const,
optional: false as const, nullable: true as const,
optional: true as const, nullable: false as const,
},
emojis: {
type: 'array' as const,
@ -466,7 +479,7 @@ export const packedNoteSchema = {
},
url: {
type: 'string' as const,
optional: false as const, nullable: false as const,
optional: false as const, nullable: true as const,
},
},
},
@ -485,11 +498,11 @@ export const packedNoteSchema = {
},
uri: {
type: 'string' as const,
optional: false as const, nullable: true as const,
optional: true as const, nullable: false as const,
},
url: {
type: 'string' as const,
optional: false as const, nullable: true as const,
optional: true as const, nullable: false as const,
},
myReaction: {