mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-01-26 09:36:02 -07:00
[mastodon-client] Correctly return accounts' pinned posts
This commit is contained in:
parent
a0cf791e53
commit
d4cca752ac
1 changed files with 12 additions and 8 deletions
|
@ -8,7 +8,7 @@ import {
|
||||||
NoteFavorites,
|
NoteFavorites,
|
||||||
NoteReactions,
|
NoteReactions,
|
||||||
Notes,
|
Notes,
|
||||||
NoteWatchings, RegistryItems,
|
NoteWatchings, RegistryItems, UserNotePinings,
|
||||||
UserProfiles,
|
UserProfiles,
|
||||||
Users
|
Users
|
||||||
} from "@/models/index.js";
|
} from "@/models/index.js";
|
||||||
|
@ -282,11 +282,6 @@ export class UserHelpers {
|
||||||
public static async getUserStatuses(user: User, localUser: ILocalUser | null, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 20, onlyMedia: boolean = false, excludeReplies: boolean = false, excludeReblogs: boolean = false, pinned: boolean = false, tagged: string | undefined): Promise<Note[]> {
|
public static async getUserStatuses(user: User, localUser: ILocalUser | null, maxId: string | undefined, sinceId: string | undefined, minId: string | undefined, limit: number = 20, onlyMedia: boolean = false, excludeReplies: boolean = false, excludeReblogs: boolean = false, pinned: boolean = false, tagged: string | undefined): Promise<Note[]> {
|
||||||
if (limit > 40) limit = 40;
|
if (limit > 40) limit = 40;
|
||||||
|
|
||||||
if (pinned) {
|
|
||||||
//FIXME respect pinned
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tagged !== undefined) {
|
if (tagged !== undefined) {
|
||||||
//FIXME respect tagged
|
//FIXME respect tagged
|
||||||
return [];
|
return [];
|
||||||
|
@ -298,7 +293,14 @@ export class UserHelpers {
|
||||||
maxId,
|
maxId,
|
||||||
minId
|
minId
|
||||||
)
|
)
|
||||||
.andWhere("note.userId = :userId", { userId: user.id });
|
.andWhere("note.userId = :userId");
|
||||||
|
|
||||||
|
if (pinned) {
|
||||||
|
const sq = UserNotePinings.createQueryBuilder("pin")
|
||||||
|
.select("pin.noteId")
|
||||||
|
.where("pin.userId = :userId");
|
||||||
|
query.andWhere(`note.id IN (${sq.getQuery()})`);
|
||||||
|
}
|
||||||
|
|
||||||
if (excludeReblogs) {
|
if (excludeReblogs) {
|
||||||
query.andWhere(
|
query.andWhere(
|
||||||
|
@ -315,7 +317,7 @@ export class UserHelpers {
|
||||||
qb.where("note.replyId IS NULL")
|
qb.where("note.replyId IS NULL")
|
||||||
.orWhere(new Brackets(qb => {
|
.orWhere(new Brackets(qb => {
|
||||||
qb.where('note.mentions = :mentions', {mentions: []})
|
qb.where('note.mentions = :mentions', {mentions: []})
|
||||||
.andWhere('thread.userId = :userId', {userId: user.id})
|
.andWhere('thread.userId = :userId')
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -333,6 +335,8 @@ export class UserHelpers {
|
||||||
query.andWhere("note.visibility != 'hidden'");
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
query.andWhere("note.visibility != 'specified'");
|
query.andWhere("note.visibility != 'specified'");
|
||||||
|
|
||||||
|
query.setParameters({ userId: user.id });
|
||||||
|
|
||||||
return PaginationHelpers.execQuery(query, limit, minId !== undefined);
|
return PaginationHelpers.execQuery(query, limit, minId !== undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue