View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/489 Closes #490 Approved-by: fEmber <acomputerdog@gmail.com> Approved-by: Marie <marie@kaifa.ch>
This commit is contained in:
commit
886948769e
3 changed files with 12 additions and 6 deletions
|
@ -66,6 +66,7 @@ export const paramDef = {
|
|||
properties: {
|
||||
query: { type: 'string', nullable: true, default: null },
|
||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||
offset: { type: 'integer', minimum: 1, nullable: true, default: null },
|
||||
sinceId: { type: 'string', format: 'misskey:id' },
|
||||
untilId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
|
@ -91,7 +92,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
//q.andWhere('emoji.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
//const emojis = await q.limit(ps.limit).getMany();
|
||||
|
||||
emojis = await q.orderBy('length(emoji.name)', 'ASC').getMany();
|
||||
emojis = await q.orderBy('length(emoji.name)', 'ASC').addOrderBy('id', 'DESC').getMany();
|
||||
const queryarry = ps.query.match(/:([\p{Letter}\p{Number}\p{Mark}_+-]*):/ug);
|
||||
|
||||
if (queryarry) {
|
||||
|
@ -105,9 +106,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
emoji.aliases.some(a => a.includes(queryNfc)) ||
|
||||
emoji.category?.includes(queryNfc));
|
||||
}
|
||||
emojis.splice(ps.limit + 1);
|
||||
emojis = emojis.slice((ps.offset ?? 0), ((ps.offset ?? 0) + ps.limit));
|
||||
} else {
|
||||
emojis = await q.limit(ps.limit).getMany();
|
||||
emojis = await q.take(ps.limit).skip(ps.offset ?? 0).getMany();
|
||||
}
|
||||
|
||||
return this.emojiEntityService.packDetailedMany(emojis);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue