mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-13 13:37:31 -07:00
[mastodon-client] Use ctx.cache for all endpoints
This commit is contained in:
parent
937a8c76c8
commit
c8415a5223
2 changed files with 2 additions and 4 deletions
|
@ -11,10 +11,9 @@ export function setupEndpointsNotifications(router: Router): void {
|
|||
router.get("/v1/notifications",
|
||||
auth(true, ['read:notifications']),
|
||||
async (ctx) => {
|
||||
const cache = UserHelpers.getFreshAccountCache();
|
||||
const args = normalizeUrlQuery(convertPaginationArgsIds(limitToInt(ctx.query)), ['types[]', 'exclude_types[]']);
|
||||
const res = await NotificationHelpers.getNotifications(ctx.user, args.max_id, args.since_id, args.min_id, args.limit, args['types[]'], args['exclude_types[]'], args.account_id);
|
||||
const data = await NotificationConverter.encodeMany(res.data, ctx.user, cache);
|
||||
const data = await NotificationConverter.encodeMany(res.data, ctx.user, ctx.cache);
|
||||
|
||||
ctx.body = data.map(n => convertNotificationIds(n));
|
||||
ctx.pagination = res.pagination;
|
||||
|
|
|
@ -10,8 +10,7 @@ export function setupEndpointsSearch(router: Router): void {
|
|||
auth(true, ['read:search']),
|
||||
async (ctx) => {
|
||||
const args = normalizeUrlQuery(convertPaginationArgsIds(argsToBools(limitToInt(ctx.query), ['resolve', 'following', 'exclude_unreviewed'])));
|
||||
const cache = UserHelpers.getFreshAccountCache();
|
||||
const result = await SearchHelpers.search(ctx.user, args.q, args.type, args.resolve, args.following, args.account_id, args['exclude_unreviewed'], args.max_id, args.min_id, args.limit, args.offset, cache);
|
||||
const result = await SearchHelpers.search(ctx.user, args.q, args.type, args.resolve, args.following, args.account_id, args['exclude_unreviewed'], args.max_id, args.min_id, args.limit, args.offset, ctx.cache);
|
||||
|
||||
ctx.body = convertSearchIds(result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue