Improve reaction tooltip

This commit is contained in:
syuilo
2019-09-03 07:25:02 +09:00
parent f36d88246a
commit d36b129369
3 changed files with 20 additions and 4 deletions

View File

@ -4,6 +4,8 @@ import define from '../../define';
import { getNote } from '../../common/getters';
import { ApiError } from '../../error';
import { NoteReactions } from '../../../../models';
import { DeepPartial } from 'typeorm';
import { NoteReaction } from '../../../../models/entities/note-reaction';
export const meta = {
desc: {
@ -24,6 +26,10 @@ export const meta = {
}
},
type: {
validator: $.optional.nullable.str,
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
@ -70,7 +76,11 @@ export default define(meta, async (ps, user) => {
const query = {
noteId: note.id
};
} as DeepPartial<NoteReaction>;
if (ps.type) {
query.reaction = ps.type;
}
const reactions = await NoteReactions.find({
where: query,