2019-04-07 12:50:36 +00:00
|
|
|
import { EntityRepository, Repository, In } from 'typeorm';
|
|
|
|
import { Note } from '../entities/note';
|
|
|
|
import { User } from '../entities/user';
|
2020-08-18 13:44:21 +00:00
|
|
|
import { Emojis, Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '..';
|
2019-06-27 09:04:09 +00:00
|
|
|
import { SchemaType } from '../../misc/schema';
|
2019-04-23 13:35:26 +00:00
|
|
|
import { awaitAll } from '../../prelude/await-all';
|
2020-04-13 15:42:59 +00:00
|
|
|
import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '../../misc/reaction-lib';
|
2020-04-26 02:48:09 +00:00
|
|
|
import { toString } from '../../mfm/to-string';
|
2020-03-06 13:51:50 +00:00
|
|
|
import { parse } from '../../mfm/parse';
|
2020-04-13 15:42:59 +00:00
|
|
|
import { Emoji } from '../entities/emoji';
|
|
|
|
import { concat } from '../../prelude/array';
|
2021-03-19 01:53:09 +00:00
|
|
|
import { NoteReaction } from '../entities/note-reaction';
|
2019-04-23 13:35:26 +00:00
|
|
|
|
|
|
|
export type PackedNote = SchemaType<typeof packedNoteSchema>;
|
2019-04-07 12:50:36 +00:00
|
|
|
|
|
|
|
@EntityRepository(Note)
|
|
|
|
export class NoteRepository extends Repository<Note> {
|
|
|
|
public validateCw(x: string) {
|
|
|
|
return x.trim().length <= 100;
|
|
|
|
}
|
|
|
|
|
2019-04-23 13:35:26 +00:00
|
|
|
private async hideNote(packedNote: PackedNote, meId: User['id'] | null) {
|
2019-04-07 12:50:36 +00:00
|
|
|
let hide = false;
|
|
|
|
|
|
|
|
// visibility が specified かつ自分が指定されていなかったら非表示
|
2019-04-23 13:35:26 +00:00
|
|
|
if (packedNote.visibility === 'specified') {
|
2019-04-07 12:50:36 +00:00
|
|
|
if (meId == null) {
|
|
|
|
hide = true;
|
|
|
|
} else if (meId === packedNote.userId) {
|
|
|
|
hide = false;
|
|
|
|
} else {
|
|
|
|
// 指定されているかどうか
|
2019-04-23 13:35:26 +00:00
|
|
|
const specified = packedNote.visibleUserIds!.some((id: any) => meId === id);
|
2019-04-07 12:50:36 +00:00
|
|
|
|
|
|
|
if (specified) {
|
|
|
|
hide = false;
|
|
|
|
} else {
|
|
|
|
hide = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// visibility が followers かつ自分が投稿者のフォロワーでなかったら非表示
|
2020-04-03 23:46:54 +00:00
|
|
|
if (packedNote.visibility === 'followers') {
|
2019-04-07 12:50:36 +00:00
|
|
|
if (meId == null) {
|
|
|
|
hide = true;
|
|
|
|
} else if (meId === packedNote.userId) {
|
|
|
|
hide = false;
|
2019-04-23 13:35:26 +00:00
|
|
|
} else if (packedNote.reply && (meId === (packedNote.reply as PackedNote).userId)) {
|
2019-04-07 12:50:36 +00:00
|
|
|
// 自分の投稿に対するリプライ
|
|
|
|
hide = false;
|
2019-04-23 13:35:26 +00:00
|
|
|
} else if (packedNote.mentions && packedNote.mentions.some(id => meId === id)) {
|
2019-04-07 12:50:36 +00:00
|
|
|
// 自分へのメンション
|
|
|
|
hide = false;
|
|
|
|
} else {
|
|
|
|
// フォロワーかどうか
|
|
|
|
const following = await Followings.findOne({
|
|
|
|
followeeId: packedNote.userId,
|
|
|
|
followerId: meId
|
|
|
|
});
|
|
|
|
|
|
|
|
if (following == null) {
|
|
|
|
hide = true;
|
|
|
|
} else {
|
|
|
|
hide = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hide) {
|
2019-04-23 13:35:26 +00:00
|
|
|
packedNote.visibleUserIds = undefined;
|
2019-04-07 12:50:36 +00:00
|
|
|
packedNote.fileIds = [];
|
|
|
|
packedNote.files = [];
|
|
|
|
packedNote.text = null;
|
2019-04-23 13:35:26 +00:00
|
|
|
packedNote.poll = undefined;
|
2019-04-07 12:50:36 +00:00
|
|
|
packedNote.cw = null;
|
|
|
|
packedNote.isHidden = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public async pack(
|
|
|
|
src: Note['id'] | Note,
|
2019-04-12 16:43:22 +00:00
|
|
|
me?: User['id'] | User | null | undefined,
|
2019-04-07 12:50:36 +00:00
|
|
|
options?: {
|
|
|
|
detail?: boolean;
|
|
|
|
skipHide?: boolean;
|
2021-03-19 01:53:09 +00:00
|
|
|
_hint_?: {
|
2021-03-20 04:54:59 +00:00
|
|
|
emojis: Emoji[] | null;
|
2021-03-19 01:53:09 +00:00
|
|
|
myReactions: Map<Note['id'], NoteReaction | null>;
|
|
|
|
};
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
2019-04-23 13:35:26 +00:00
|
|
|
): Promise<PackedNote> {
|
2019-04-07 12:50:36 +00:00
|
|
|
const opts = Object.assign({
|
|
|
|
detail: true,
|
|
|
|
skipHide: false
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
const meId = me ? typeof me === 'string' ? me : me.id : null;
|
2021-02-13 06:33:38 +00:00
|
|
|
const note = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
2019-04-07 12:50:36 +00:00
|
|
|
const host = note.userHost;
|
|
|
|
|
|
|
|
async function populatePoll() {
|
2021-02-13 06:33:38 +00:00
|
|
|
const poll = await Polls.findOneOrFail(note.id);
|
2019-04-07 12:50:36 +00:00
|
|
|
const choices = poll.choices.map(c => ({
|
|
|
|
text: c,
|
|
|
|
votes: poll.votes[poll.choices.indexOf(c)],
|
|
|
|
isVoted: false
|
|
|
|
}));
|
|
|
|
|
|
|
|
if (poll.multiple) {
|
|
|
|
const votes = await PollVotes.find({
|
2019-04-12 16:43:22 +00:00
|
|
|
userId: meId!,
|
2019-04-07 12:50:36 +00:00
|
|
|
noteId: note.id
|
|
|
|
});
|
|
|
|
|
|
|
|
const myChoices = votes.map(v => v.choice);
|
|
|
|
for (const myChoice of myChoices) {
|
|
|
|
choices[myChoice].isVoted = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
const vote = await PollVotes.findOne({
|
2019-04-12 16:43:22 +00:00
|
|
|
userId: meId!,
|
2019-04-07 12:50:36 +00:00
|
|
|
noteId: note.id
|
|
|
|
});
|
|
|
|
|
|
|
|
if (vote) {
|
|
|
|
choices[vote.choice].isVoted = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
multiple: poll.multiple,
|
|
|
|
expiresAt: poll.expiresAt,
|
|
|
|
choices
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
/**
|
|
|
|
* 添付用emojisを解決する
|
|
|
|
* @param emojiNames Note等に添付されたカスタム絵文字名 (:は含めない)
|
|
|
|
* @param noteUserHost Noteのホスト
|
|
|
|
* @param reactionNames Note等にリアクションされたカスタム絵文字名 (:は含めない)
|
|
|
|
*/
|
2020-01-07 03:28:20 +00:00
|
|
|
async function populateEmojis(emojiNames: string[], noteUserHost: string | null, reactionNames: string[]) {
|
2021-03-20 04:54:59 +00:00
|
|
|
const customReactions = reactionNames?.map(x => decodeReaction(x)).filter(x => x.name);
|
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
let all = [] as {
|
|
|
|
name: string,
|
|
|
|
url: string
|
|
|
|
}[];
|
2020-01-07 03:28:20 +00:00
|
|
|
|
2021-03-20 04:54:59 +00:00
|
|
|
// 与えられたhintだけで十分(=新たにクエリする必要がない)かどうかを表すフラグ
|
|
|
|
let enough = true;
|
|
|
|
if (options?._hint_?.emojis) {
|
|
|
|
for (const name of emojiNames) {
|
|
|
|
const matched = options._hint_.emojis.find(x => x.name === name && x.host === noteUserHost);
|
|
|
|
if (matched) {
|
|
|
|
all.push({
|
|
|
|
name: matched.name,
|
|
|
|
url: matched.url,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
enough = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const customReaction of customReactions) {
|
|
|
|
const matched = options._hint_.emojis.find(x => x.name === customReaction.name && x.host === customReaction.host);
|
|
|
|
if (matched) {
|
|
|
|
all.push({
|
|
|
|
name: `${matched.name}@${matched.host || '.'}`, // @host付きでローカルは.
|
|
|
|
url: matched.url,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
enough = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
enough = false;
|
|
|
|
}
|
|
|
|
if (enough) return all;
|
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
// カスタム絵文字
|
2020-01-07 03:28:20 +00:00
|
|
|
if (emojiNames?.length > 0) {
|
2020-04-13 15:42:59 +00:00
|
|
|
const tmp = await Emojis.find({
|
|
|
|
where: {
|
|
|
|
name: In(emojiNames),
|
|
|
|
host: noteUserHost
|
|
|
|
},
|
|
|
|
select: ['name', 'host', 'url']
|
|
|
|
}).then(emojis => emojis.map((emoji: Emoji) => {
|
|
|
|
return {
|
|
|
|
name: emoji.name,
|
|
|
|
url: emoji.url,
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
|
|
|
|
all = concat([all, tmp]);
|
2020-01-07 03:28:20 +00:00
|
|
|
}
|
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
if (customReactions?.length > 0) {
|
|
|
|
const where = [] as {}[];
|
2020-01-07 03:28:20 +00:00
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
for (const customReaction of customReactions) {
|
|
|
|
where.push({
|
|
|
|
name: customReaction.name,
|
|
|
|
host: customReaction.host
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const tmp = await Emojis.find({
|
|
|
|
where,
|
|
|
|
select: ['name', 'host', 'url']
|
|
|
|
}).then(emojis => emojis.map((emoji: Emoji) => {
|
|
|
|
return {
|
|
|
|
name: `${emoji.name}@${emoji.host || '.'}`, // @host付きでローカルは.
|
|
|
|
url: emoji.url,
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
all = concat([all, tmp]);
|
|
|
|
}
|
2020-01-07 03:28:20 +00:00
|
|
|
|
2020-04-13 15:42:59 +00:00
|
|
|
return all;
|
2020-01-07 03:28:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-07 12:50:36 +00:00
|
|
|
async function populateMyReaction() {
|
2021-03-19 01:53:09 +00:00
|
|
|
if (options?._hint_?.myReactions) {
|
|
|
|
const reaction = options._hint_.myReactions.get(note.id);
|
|
|
|
if (reaction) {
|
|
|
|
return convertLegacyReaction(reaction.reaction);
|
|
|
|
} else if (reaction === null) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
// 実装上抜けがあるだけかもしれないので、「ヒントに含まれてなかったら(=undefinedなら)return」のようにはしない
|
|
|
|
}
|
|
|
|
|
2019-04-07 12:50:36 +00:00
|
|
|
const reaction = await NoteReactions.findOne({
|
2019-04-12 16:43:22 +00:00
|
|
|
userId: meId!,
|
2019-04-07 12:50:36 +00:00
|
|
|
noteId: note.id,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (reaction) {
|
2020-01-29 19:37:25 +00:00
|
|
|
return convertLegacyReaction(reaction.reaction);
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
|
|
|
|
2019-04-13 06:02:15 +00:00
|
|
|
return undefined;
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let text = note.text;
|
|
|
|
|
2020-04-02 12:59:14 +00:00
|
|
|
if (note.name && (note.url || note.uri)) {
|
|
|
|
text = `【${note.name}】\n${(note.text || '').trim()}\n\n${note.url || note.uri}`;
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 13:44:21 +00:00
|
|
|
const channel = note.channelId
|
|
|
|
? note.channel
|
|
|
|
? note.channel
|
|
|
|
: await Channels.findOne(note.channelId)
|
|
|
|
: null;
|
|
|
|
|
2019-04-23 13:35:26 +00:00
|
|
|
const packed = await awaitAll({
|
2019-04-07 12:50:36 +00:00
|
|
|
id: note.id,
|
2019-04-23 13:35:26 +00:00
|
|
|
createdAt: note.createdAt.toISOString(),
|
2019-04-07 12:50:36 +00:00
|
|
|
userId: note.userId,
|
2021-03-20 04:54:59 +00:00
|
|
|
user: Users.pack(note.user || note.userId, meId, {
|
|
|
|
detail: false,
|
|
|
|
_hint_: {
|
|
|
|
emojis: options?._hint_?.emojis || null
|
|
|
|
}
|
|
|
|
}),
|
2019-04-07 12:50:36 +00:00
|
|
|
text: text,
|
|
|
|
cw: note.cw,
|
|
|
|
visibility: note.visibility,
|
2019-04-13 05:55:59 +00:00
|
|
|
localOnly: note.localOnly || undefined,
|
|
|
|
visibleUserIds: note.visibility === 'specified' ? note.visibleUserIds : undefined,
|
|
|
|
viaMobile: note.viaMobile || undefined,
|
2019-04-08 07:49:05 +00:00
|
|
|
renoteCount: note.renoteCount,
|
|
|
|
repliesCount: note.repliesCount,
|
2020-02-18 21:36:50 +00:00
|
|
|
reactions: convertLegacyReactions(note.reactions),
|
2019-06-07 11:40:05 +00:00
|
|
|
tags: note.tags.length > 0 ? note.tags : undefined,
|
2020-01-07 03:28:20 +00:00
|
|
|
emojis: populateEmojis(note.emojis, host, Object.keys(note.reactions)),
|
2019-04-07 12:50:36 +00:00
|
|
|
fileIds: note.fileIds,
|
|
|
|
files: DriveFiles.packMany(note.fileIds),
|
|
|
|
replyId: note.replyId,
|
|
|
|
renoteId: note.renoteId,
|
2020-08-18 13:44:21 +00:00
|
|
|
channelId: note.channelId || undefined,
|
|
|
|
channel: channel ? {
|
|
|
|
id: channel.id,
|
|
|
|
name: channel.name,
|
|
|
|
} : undefined,
|
2019-04-17 16:05:40 +00:00
|
|
|
mentions: note.mentions.length > 0 ? note.mentions : undefined,
|
2019-04-16 22:25:34 +00:00
|
|
|
uri: note.uri || undefined,
|
2020-04-02 12:59:14 +00:00
|
|
|
url: note.url || undefined,
|
2020-02-18 10:05:11 +00:00
|
|
|
_featuredId_: (note as any)._featuredId_ || undefined,
|
|
|
|
_prId_: (note as any)._prId_ || undefined,
|
2019-04-07 12:50:36 +00:00
|
|
|
|
|
|
|
...(opts.detail ? {
|
2021-03-20 04:54:59 +00:00
|
|
|
reply: note.replyId ? this.pack(note.reply || note.replyId, meId, {
|
2021-03-19 01:53:09 +00:00
|
|
|
detail: false,
|
|
|
|
_hint_: options?._hint_
|
2019-04-13 05:55:59 +00:00
|
|
|
}) : undefined,
|
2019-04-07 12:50:36 +00:00
|
|
|
|
2021-03-20 04:54:59 +00:00
|
|
|
renote: note.renoteId ? this.pack(note.renote || note.renoteId, meId, {
|
2021-03-19 01:53:09 +00:00
|
|
|
detail: true,
|
|
|
|
_hint_: options?._hint_
|
2019-04-13 05:55:59 +00:00
|
|
|
}) : undefined,
|
2019-04-07 12:50:36 +00:00
|
|
|
|
2019-04-13 05:55:59 +00:00
|
|
|
poll: note.hasPoll ? populatePoll() : undefined,
|
2019-04-07 12:50:36 +00:00
|
|
|
|
|
|
|
...(meId ? {
|
|
|
|
myReaction: populateMyReaction()
|
|
|
|
} : {})
|
|
|
|
} : {})
|
|
|
|
});
|
|
|
|
|
|
|
|
if (packed.user.isCat && packed.text) {
|
2020-03-06 13:51:50 +00:00
|
|
|
const tokens = packed.text ? parse(packed.text) : [];
|
|
|
|
packed.text = toString(tokens, { doNyaize: true });
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.skipHide) {
|
|
|
|
await this.hideNote(packed, meId);
|
|
|
|
}
|
|
|
|
|
|
|
|
return packed;
|
|
|
|
}
|
2019-04-25 04:27:07 +00:00
|
|
|
|
2021-03-19 01:53:09 +00:00
|
|
|
public async packMany(
|
2019-04-25 04:27:07 +00:00
|
|
|
notes: (Note['id'] | Note)[],
|
|
|
|
me?: User['id'] | User | null | undefined,
|
|
|
|
options?: {
|
|
|
|
detail?: boolean;
|
|
|
|
skipHide?: boolean;
|
|
|
|
}
|
|
|
|
) {
|
2021-03-19 01:53:09 +00:00
|
|
|
if (notes.length === 0) return [];
|
|
|
|
|
|
|
|
const meId = me ? typeof me === 'string' ? me : me.id : null;
|
|
|
|
const noteIds = notes.map(n => typeof n === 'object' ? n.id : n);
|
|
|
|
const myReactionsMap = new Map<Note['id'], NoteReaction | null>();
|
|
|
|
if (meId) {
|
|
|
|
const renoteIds = notes.filter(n => (typeof n === 'object') && (n.renoteId != null)).map(n => (n as Note).renoteId!);
|
|
|
|
const targets = [...noteIds, ...renoteIds];
|
|
|
|
const myReactions = await NoteReactions.find({
|
|
|
|
userId: meId,
|
|
|
|
noteId: In(targets),
|
|
|
|
});
|
|
|
|
|
|
|
|
for (const target of targets) {
|
|
|
|
myReactionsMap.set(target, myReactions.find(reaction => reaction.noteId === target) || null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-20 04:54:59 +00:00
|
|
|
// TODO: ここら辺の処理をaggregateEmojisみたいな関数に切り出したい
|
|
|
|
let emojisWhere: any[] = [];
|
|
|
|
for (const note of notes) {
|
|
|
|
if (typeof note !== 'object') continue;
|
|
|
|
emojisWhere.push({
|
|
|
|
name: In(note.emojis),
|
|
|
|
host: note.userHost
|
|
|
|
});
|
|
|
|
if (note.renote) {
|
|
|
|
emojisWhere.push({
|
|
|
|
name: In(note.renote.emojis),
|
|
|
|
host: note.renote.userHost
|
|
|
|
});
|
|
|
|
if (note.renote.user) {
|
|
|
|
emojisWhere.push({
|
|
|
|
name: In(note.renote.user.emojis),
|
|
|
|
host: note.renote.userHost
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const customReactions = Object.keys(note.reactions).map(x => decodeReaction(x)).filter(x => x.name);
|
|
|
|
emojisWhere = emojisWhere.concat(customReactions.map(x => ({
|
|
|
|
name: x.name,
|
|
|
|
host: x.host
|
|
|
|
})));
|
|
|
|
if (note.user) {
|
|
|
|
emojisWhere.push({
|
|
|
|
name: In(note.user.emojis),
|
|
|
|
host: note.userHost
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const emojis = emojisWhere.length > 0 ? await Emojis.find({
|
|
|
|
where: emojisWhere,
|
|
|
|
select: ['name', 'host', 'url']
|
|
|
|
}) : null;
|
|
|
|
|
2021-03-19 01:53:09 +00:00
|
|
|
return await Promise.all(notes.map(n => this.pack(n, me, {
|
|
|
|
...options,
|
|
|
|
_hint_: {
|
2021-03-20 04:54:59 +00:00
|
|
|
myReactions: myReactionsMap,
|
|
|
|
emojis: emojis
|
2021-03-19 01:53:09 +00:00
|
|
|
}
|
|
|
|
})));
|
2019-04-25 04:27:07 +00:00
|
|
|
}
|
2019-04-07 12:50:36 +00:00
|
|
|
}
|
2019-04-23 13:35:26 +00:00
|
|
|
|
|
|
|
export const packedNoteSchema = {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
properties: {
|
|
|
|
id: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id',
|
|
|
|
description: 'The unique identifier for this Note.',
|
|
|
|
example: 'xxxxxxxxxx',
|
|
|
|
},
|
|
|
|
createdAt: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'date-time',
|
|
|
|
description: 'The date that the Note was created on Misskey.'
|
|
|
|
},
|
|
|
|
text: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
cw: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
userId: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id',
|
|
|
|
},
|
|
|
|
user: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
ref: 'User',
|
2019-06-27 09:04:09 +00:00
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
replyId: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id',
|
|
|
|
example: 'xxxxxxxxxx',
|
|
|
|
},
|
|
|
|
renoteId: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id',
|
|
|
|
example: 'xxxxxxxxxx',
|
|
|
|
},
|
|
|
|
reply: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
ref: 'Note'
|
|
|
|
},
|
|
|
|
renote: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
ref: 'Note'
|
|
|
|
},
|
|
|
|
viaMobile: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'boolean' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
isHidden: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'boolean' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
visibility: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
mentions: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
items: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
visibleUserIds: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
items: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fileIds: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
items: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
format: 'id'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
files: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
items: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
ref: 'DriveFile'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tags: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
optional: true as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
items: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
poll: {
|
2019-06-27 09:04:09 +00:00
|
|
|
type: 'object' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
2020-08-18 13:44:21 +00:00
|
|
|
channelId: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
|
|
|
format: 'id',
|
|
|
|
example: 'xxxxxxxxxx',
|
|
|
|
},
|
|
|
|
channel: {
|
|
|
|
type: 'object' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
|
|
|
ref: 'Channel'
|
|
|
|
},
|
2021-02-13 08:50:51 +00:00
|
|
|
localOnly: {
|
|
|
|
type: 'boolean' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
|
|
|
},
|
|
|
|
emojis: {
|
|
|
|
type: 'array' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
items: {
|
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
properties: {
|
|
|
|
name: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
reactions: {
|
|
|
|
type: 'object' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
description: 'Key is either Unicode emoji or custom emoji, value is count of that emoji reaction.',
|
|
|
|
},
|
|
|
|
renoteCount: {
|
|
|
|
type: 'number' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
},
|
|
|
|
repliesCount: {
|
|
|
|
type: 'number' as const,
|
|
|
|
optional: false as const, nullable: false as const,
|
|
|
|
},
|
|
|
|
uri: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
|
|
|
description: 'The URI of a note. it will be null when the note is local.',
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
|
|
|
description: 'The human readable url of a note. it will be null when the note is local.',
|
|
|
|
},
|
|
|
|
_featuredId_: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
|
|
|
},
|
|
|
|
_prId_: {
|
|
|
|
type: 'string' as const,
|
|
|
|
optional: false as const, nullable: true as const,
|
|
|
|
},
|
|
|
|
myReaction: {
|
|
|
|
type: 'object' as const,
|
|
|
|
optional: true as const, nullable: true as const,
|
|
|
|
description: 'Key is either Unicode emoji or custom emoji, value is count of that emoji reaction.',
|
|
|
|
},
|
2019-04-23 13:35:26 +00:00
|
|
|
},
|
|
|
|
};
|