fix generateNoScheduleNotesQuery
This commit is contained in:
parent
eb6c30301b
commit
384d8d853b
1 changed files with 11 additions and 13 deletions
|
@ -55,9 +55,10 @@ export class TimelineHelpers {
|
||||||
generateMutedUserQuery(query, user);
|
generateMutedUserQuery(query, user);
|
||||||
generateBlockedUserQuery(query, user);
|
generateBlockedUserQuery(query, user);
|
||||||
generateMutedUserRenotesQueryForNotes(query, user);
|
generateMutedUserRenotesQueryForNotes(query, user);
|
||||||
this.generateNoScheduleNotesQuery(query);
|
|
||||||
|
|
||||||
query.andWhere("note.visibility != 'hidden'");
|
query
|
||||||
|
.andWhere("note.visibility != 'hidden'")
|
||||||
|
.andWhere("note.scheduledAt IS NULL");
|
||||||
|
|
||||||
return PaginationHelpers.execQueryLinkPagination(
|
return PaginationHelpers.execQueryLinkPagination(
|
||||||
query,
|
query,
|
||||||
|
@ -98,7 +99,9 @@ export class TimelineHelpers {
|
||||||
sinceId,
|
sinceId,
|
||||||
maxId,
|
maxId,
|
||||||
minId,
|
minId,
|
||||||
).andWhere("note.visibility = 'public'");
|
)
|
||||||
|
.andWhere("note.visibility = 'public'")
|
||||||
|
.andWhere("note.scheduledAt IS NULL");
|
||||||
|
|
||||||
if (remote) query.andWhere("note.userHost IS NOT NULL");
|
if (remote) query.andWhere("note.userHost IS NOT NULL");
|
||||||
if (local) query.andWhere("note.userHost IS NULL");
|
if (local) query.andWhere("note.userHost IS NULL");
|
||||||
|
@ -109,7 +112,7 @@ export class TimelineHelpers {
|
||||||
.leftJoinAndSelect("note.renote", "renote");
|
.leftJoinAndSelect("note.renote", "renote");
|
||||||
|
|
||||||
generateRepliesQuery(query, true, user);
|
generateRepliesQuery(query, true, user);
|
||||||
this.generateNoScheduleNotesQuery(query);
|
|
||||||
if (user) {
|
if (user) {
|
||||||
generateMutedUserQuery(query, user);
|
generateMutedUserQuery(query, user);
|
||||||
generateBlockedUserQuery(query, user);
|
generateBlockedUserQuery(query, user);
|
||||||
|
@ -150,12 +153,12 @@ export class TimelineHelpers {
|
||||||
)
|
)
|
||||||
.andWhere(`note.userId IN (${listQuery.getQuery()})`)
|
.andWhere(`note.userId IN (${listQuery.getQuery()})`)
|
||||||
.andWhere("note.visibility != 'specified'")
|
.andWhere("note.visibility != 'specified'")
|
||||||
|
.andWhere("note.scheduledAt IS NULL")
|
||||||
.leftJoinAndSelect("note.user", "user")
|
.leftJoinAndSelect("note.user", "user")
|
||||||
.leftJoinAndSelect("note.renote", "renote")
|
.leftJoinAndSelect("note.renote", "renote")
|
||||||
.setParameters({ listId: list.id });
|
.setParameters({ listId: list.id });
|
||||||
|
|
||||||
generateVisibilityQuery(query, user);
|
generateVisibilityQuery(query, user);
|
||||||
this.generateNoScheduleNotesQuery(query);
|
|
||||||
|
|
||||||
return PaginationHelpers.execQueryLinkPagination(
|
return PaginationHelpers.execQueryLinkPagination(
|
||||||
query,
|
query,
|
||||||
|
@ -195,6 +198,7 @@ export class TimelineHelpers {
|
||||||
minId,
|
minId,
|
||||||
)
|
)
|
||||||
.andWhere("note.visibility = 'public'")
|
.andWhere("note.visibility = 'public'")
|
||||||
|
.andWhere("note.scheduledAt IS NULL")
|
||||||
.andWhere("note.tags @> array[:tag]::varchar[]", { tag: tag });
|
.andWhere("note.tags @> array[:tag]::varchar[]", { tag: tag });
|
||||||
|
|
||||||
if (any.length > 0)
|
if (any.length > 0)
|
||||||
|
@ -215,7 +219,7 @@ export class TimelineHelpers {
|
||||||
.leftJoinAndSelect("note.renote", "renote");
|
.leftJoinAndSelect("note.renote", "renote");
|
||||||
|
|
||||||
generateRepliesQuery(query, true, user);
|
generateRepliesQuery(query, true, user);
|
||||||
this.generateNoScheduleNotesQuery(query);
|
|
||||||
if (user) {
|
if (user) {
|
||||||
generateMutedUserQuery(query, user);
|
generateMutedUserQuery(query, user);
|
||||||
generateBlockedUserQuery(query, user);
|
generateBlockedUserQuery(query, user);
|
||||||
|
@ -263,11 +267,10 @@ export class TimelineHelpers {
|
||||||
maxId,
|
maxId,
|
||||||
minId,
|
minId,
|
||||||
)
|
)
|
||||||
|
.andWhere("note.scheduledAt IS NULL")
|
||||||
.innerJoin(`(${sq.getQuery()})`, "sq", "note.id = sq.latest")
|
.innerJoin(`(${sq.getQuery()})`, "sq", "note.id = sq.latest")
|
||||||
.setParameters({ userId: user.id });
|
.setParameters({ userId: user.id });
|
||||||
|
|
||||||
this.generateNoScheduleNotesQuery(query);
|
|
||||||
|
|
||||||
return query
|
return query
|
||||||
.take(limit)
|
.take(limit)
|
||||||
.getMany()
|
.getMany()
|
||||||
|
@ -378,9 +381,4 @@ export class TimelineHelpers {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Exclude scheduled notes from Mastodon timeline */
|
|
||||||
public static generateNoScheduleNotesQuery(q: SelectQueryBuilder<Note>) {
|
|
||||||
q.andWhere("note.scheduledAt IS NULL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue