mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
[mastodon-client] Add visibility checks for status.reblogged_by
This commit is contained in:
parent
7f6ac71dd0
commit
ad7c58b8d7
@ -243,7 +243,7 @@ export function setupEndpointsStatus(router: Router): void {
|
||||
|
||||
const cache = UserHelpers.getFreshAccountCache();
|
||||
const args = normalizeUrlQuery(convertPaginationArgsIds(limitToInt(ctx.query as any)));
|
||||
const res = await NoteHelpers.getNoteRebloggedBy(note, args.max_id, args.since_id, args.min_id, args.limit);
|
||||
const res = await NoteHelpers.getNoteRebloggedBy(note, user, args.max_id, args.since_id, args.min_id, args.limit);
|
||||
const users = await UserConverter.encodeMany(res.data, cache);
|
||||
ctx.body = users.map(m => convertAccount(m));
|
||||
PaginationHelpers.appendLinkPaginationHeader(args, ctx, res, 40);
|
||||
|
@ -200,7 +200,7 @@ export class NoteHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
public static async getNoteRebloggedBy(note: Note, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 40): Promise<LinkPaginationObject<User[]>> {
|
||||
public static async getNoteRebloggedBy(note: Note, user: ILocalUser | null, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 40): Promise<LinkPaginationObject<User[]>> {
|
||||
if (limit > 80) limit = 80;
|
||||
const query = PaginationHelpers.makePaginationQuery(
|
||||
Notes.createQueryBuilder("note"),
|
||||
@ -212,6 +212,8 @@ export class NoteHelpers {
|
||||
.andWhere("note.text IS NULL") // We don't want to count quotes as renotes
|
||||
.innerJoinAndSelect("note.user", "user");
|
||||
|
||||
generateVisibilityQuery(query, user);
|
||||
|
||||
return query.take(limit).getMany().then(async p => {
|
||||
if (minId !== undefined) p = p.reverse();
|
||||
const users = p
|
||||
|
Loading…
Reference in New Issue
Block a user