mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
copy changes to hybrid-timeline.ts
This commit is contained in:
parent
c3ba139655
commit
ef3b5541f8
2 changed files with 12 additions and 51 deletions
|
@ -66,9 +66,6 @@ export const paramDef = {
|
||||||
sinceDate: { type: 'integer' },
|
sinceDate: { type: 'integer' },
|
||||||
untilDate: { type: 'integer' },
|
untilDate: { type: 'integer' },
|
||||||
allowPartial: { type: 'boolean', default: false }, // true is recommended but for compatibility false by default
|
allowPartial: { type: 'boolean', default: false }, // true is recommended but for compatibility false by default
|
||||||
includeMyRenotes: { type: 'boolean', default: true },
|
|
||||||
includeRenotedMyNotes: { type: 'boolean', default: true },
|
|
||||||
includeLocalRenotes: { type: 'boolean', default: true },
|
|
||||||
withFiles: { type: 'boolean', default: false },
|
withFiles: { type: 'boolean', default: false },
|
||||||
withRenotes: { type: 'boolean', default: true },
|
withRenotes: { type: 'boolean', default: true },
|
||||||
withReplies: { type: 'boolean', default: false },
|
withReplies: { type: 'boolean', default: false },
|
||||||
|
@ -114,12 +111,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
untilId,
|
untilId,
|
||||||
sinceId,
|
sinceId,
|
||||||
limit: ps.limit,
|
limit: ps.limit,
|
||||||
includeMyRenotes: ps.includeMyRenotes,
|
|
||||||
includeRenotedMyNotes: ps.includeRenotedMyNotes,
|
|
||||||
includeLocalRenotes: ps.includeLocalRenotes,
|
|
||||||
withFiles: ps.withFiles,
|
withFiles: ps.withFiles,
|
||||||
withReplies: ps.withReplies,
|
withReplies: ps.withReplies,
|
||||||
withBots: ps.withBots,
|
withBots: ps.withBots,
|
||||||
|
withRenotes: ps.withRenotes,
|
||||||
}, me);
|
}, me);
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -178,12 +173,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
untilId,
|
untilId,
|
||||||
sinceId,
|
sinceId,
|
||||||
limit,
|
limit,
|
||||||
includeMyRenotes: ps.includeMyRenotes,
|
|
||||||
includeRenotedMyNotes: ps.includeRenotedMyNotes,
|
|
||||||
includeLocalRenotes: ps.includeLocalRenotes,
|
|
||||||
withFiles: ps.withFiles,
|
withFiles: ps.withFiles,
|
||||||
withReplies: ps.withReplies,
|
withReplies: ps.withReplies,
|
||||||
withBots: ps.withBots,
|
withBots: ps.withBots,
|
||||||
|
withRenotes: ps.withRenotes,
|
||||||
}, me),
|
}, me),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -199,12 +192,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
untilId: string | null,
|
untilId: string | null,
|
||||||
sinceId: string | null,
|
sinceId: string | null,
|
||||||
limit: number,
|
limit: number,
|
||||||
includeMyRenotes: boolean,
|
|
||||||
includeRenotedMyNotes: boolean,
|
|
||||||
includeLocalRenotes: boolean,
|
|
||||||
withFiles: boolean,
|
withFiles: boolean,
|
||||||
withReplies: boolean,
|
withReplies: boolean,
|
||||||
withBots: boolean,
|
withBots: boolean,
|
||||||
|
withRenotes: boolean,
|
||||||
}, me: MiLocalUser) {
|
}, me: MiLocalUser) {
|
||||||
const followees = await this.userFollowingService.getFollowees(me.id);
|
const followees = await this.userFollowingService.getFollowees(me.id);
|
||||||
const followingChannels = await this.channelFollowingsRepository.find({
|
const followingChannels = await this.channelFollowingsRepository.find({
|
||||||
|
@ -227,8 +218,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
.leftJoinAndSelect('note.reply', 'reply')
|
.leftJoinAndSelect('note.reply', 'reply')
|
||||||
.leftJoinAndSelect('note.renote', 'renote')
|
.leftJoinAndSelect('note.renote', 'renote')
|
||||||
.leftJoinAndSelect('reply.user', 'replyUser')
|
.leftJoinAndSelect('reply.user', 'replyUser', 'replyUser.id = note.replyUserId')
|
||||||
.leftJoinAndSelect('renote.user', 'renoteUser');
|
.leftJoinAndSelect('renote.user', 'renoteUser', 'renoteUser.id = note.renoteUserId');
|
||||||
|
|
||||||
if (followingChannels.length > 0) {
|
if (followingChannels.length > 0) {
|
||||||
const followingChannelIds = followingChannels.map(x => x.followeeId);
|
const followingChannelIds = followingChannels.map(x => x.followeeId);
|
||||||
|
@ -255,45 +246,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
this.queryService.generateVisibilityQuery(query, me);
|
this.queryService.generateVisibilityQuery(query, me);
|
||||||
this.queryService.generateBlockedHostQueryForNote(query);
|
this.queryService.generateBlockedHostQueryForNote(query);
|
||||||
|
this.queryService.generateSilencedUserQueryForNotes(query, me);
|
||||||
this.queryService.generateMutedUserQueryForNotes(query, me);
|
this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||||
this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
|
||||||
|
|
||||||
if (ps.includeMyRenotes === false) {
|
|
||||||
query.andWhere(new Brackets(qb => {
|
|
||||||
qb.orWhere('note.userId != :meId', { meId: me.id });
|
|
||||||
qb.orWhere('note.renoteId IS NULL');
|
|
||||||
qb.orWhere('note.text IS NOT NULL');
|
|
||||||
qb.orWhere('note.fileIds != \'{}\'');
|
|
||||||
qb.orWhere('0 < (SELECT COUNT(*) FROM poll WHERE poll."noteId" = note.id)');
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ps.includeRenotedMyNotes === false) {
|
|
||||||
query.andWhere(new Brackets(qb => {
|
|
||||||
qb.orWhere('note.renoteUserId != :meId', { meId: me.id });
|
|
||||||
qb.orWhere('note.renoteId IS NULL');
|
|
||||||
qb.orWhere('note.text IS NOT NULL');
|
|
||||||
qb.orWhere('note.fileIds != \'{}\'');
|
|
||||||
qb.orWhere('0 < (SELECT COUNT(*) FROM poll WHERE poll."noteId" = note.id)');
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ps.includeLocalRenotes === false) {
|
|
||||||
query.andWhere(new Brackets(qb => {
|
|
||||||
qb.orWhere('note.renoteUserHost IS NOT NULL');
|
|
||||||
qb.orWhere('note.renoteId IS NULL');
|
|
||||||
qb.orWhere('note.text IS NOT NULL');
|
|
||||||
qb.orWhere('note.fileIds != \'{}\'');
|
|
||||||
qb.orWhere('0 < (SELECT COUNT(*) FROM poll WHERE poll."noteId" = note.id)');
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ps.withFiles) {
|
if (ps.withFiles) {
|
||||||
query.andWhere('note.fileIds != \'{}\'');
|
query.andWhere('note.fileIds != \'{}\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ps.withBots) query.andWhere('user.isBot = FALSE');
|
if (!ps.withBots) query.andWhere('user.isBot = FALSE');
|
||||||
|
|
||||||
|
if (!ps.withRenotes) {
|
||||||
|
this.queryService.generateExcludedRenotesQueryForNotes(query);
|
||||||
|
} else {
|
||||||
|
this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
return await query.limit(ps.limit).getMany();
|
return await query.limit(ps.limit).getMany();
|
||||||
|
|
|
@ -27230,12 +27230,6 @@ export type operations = {
|
||||||
untilDate?: number;
|
untilDate?: number;
|
||||||
/** @default false */
|
/** @default false */
|
||||||
allowPartial?: boolean;
|
allowPartial?: boolean;
|
||||||
/** @default true */
|
|
||||||
includeMyRenotes?: boolean;
|
|
||||||
/** @default true */
|
|
||||||
includeRenotedMyNotes?: boolean;
|
|
||||||
/** @default true */
|
|
||||||
includeLocalRenotes?: boolean;
|
|
||||||
/** @default false */
|
/** @default false */
|
||||||
withFiles?: boolean;
|
withFiles?: boolean;
|
||||||
/** @default true */
|
/** @default true */
|
||||||
|
|
Loading…
Add table
Reference in a new issue