mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	upd: filter fallback to db for silenced users
This commit is contained in:
		
							parent
							
								
									4b230d792c
								
							
						
					
					
						commit
						bb54909d8e
					
				
					 3 changed files with 19 additions and 4 deletions
				
			
		| 
						 | 
					@ -185,7 +185,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
					.leftJoinAndSelect('note.renote', 'renote')
 | 
										.leftJoinAndSelect('note.renote', 'renote')
 | 
				
			||||||
					.leftJoinAndSelect('reply.user', 'replyUser')
 | 
										.leftJoinAndSelect('reply.user', 'replyUser')
 | 
				
			||||||
					.leftJoinAndSelect('renote.user', 'renoteUser');
 | 
										.leftJoinAndSelect('renote.user', 'renoteUser');
 | 
				
			||||||
					
 | 
					
 | 
				
			||||||
				if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
									if (!ps.withBots) query.andWhere('user.isBot = FALSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				query.andWhere(new Brackets(qb => {
 | 
									query.andWhere(new Brackets(qb => {
 | 
				
			||||||
| 
						 | 
					@ -238,7 +238,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				//#endregion
 | 
									//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				const timeline = await query.limit(ps.limit).getMany();
 | 
									let timeline = await query.limit(ps.limit).getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									timeline = timeline.filter(note => {
 | 
				
			||||||
 | 
										if (note.user?.isSilenced && note.userId !== me.id && !followings[note.userId]) return false;
 | 
				
			||||||
 | 
										return true;
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				process.nextTick(() => {
 | 
									process.nextTick(() => {
 | 
				
			||||||
					this.activeUsersChart.read(me);
 | 
										this.activeUsersChart.read(me);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,7 +171,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
					query.andWhere('note.fileIds != \'{}\'');
 | 
										query.andWhere('note.fileIds != \'{}\'');
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				const timeline = await query.limit(ps.limit).getMany();
 | 
									let timeline = await query.limit(ps.limit).getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									timeline = timeline.filter(note => {
 | 
				
			||||||
 | 
										if (note.user?.isSilenced && me && followings && note.userId !== me.id && !followings[note.userId]) return false;
 | 
				
			||||||
 | 
										return true;
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				process.nextTick(() => {
 | 
									process.nextTick(() => {
 | 
				
			||||||
					if (me) {
 | 
										if (me) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,7 +199,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				//#endregion
 | 
									//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				const timeline = await query.limit(ps.limit).getMany();
 | 
									let timeline = await query.limit(ps.limit).getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									timeline = timeline.filter(note => {
 | 
				
			||||||
 | 
										if (note.user?.isSilenced && note.userId !== me.id && !followings[note.userId]) return false;
 | 
				
			||||||
 | 
										return true;
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				process.nextTick(() => {
 | 
									process.nextTick(() => {
 | 
				
			||||||
					this.activeUsersChart.read(me);
 | 
										this.activeUsersChart.read(me);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue