[Server] Fix #3947
This commit is contained in:
		
							parent
							
								
									b44227948d
								
							
						
					
					
						commit
						4339f9af29
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -4,6 +4,7 @@ import Note, { packMany } from '../../../../models/note';
 | 
				
			||||||
import User from '../../../../models/user';
 | 
					import User from '../../../../models/user';
 | 
				
			||||||
import define from '../../define';
 | 
					import define from '../../define';
 | 
				
			||||||
import { countIf } from '../../../../prelude/array';
 | 
					import { countIf } from '../../../../prelude/array';
 | 
				
			||||||
 | 
					import Following from '../../../../models/following';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const meta = {
 | 
					export const meta = {
 | 
				
			||||||
	desc: {
 | 
						desc: {
 | 
				
			||||||
| 
						 | 
					@ -160,13 +161,20 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
 | 
				
			||||||
		return rej('user not found');
 | 
							return rej('user not found');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const isFollowing = me == null ? false : ((await Following.findOne({
 | 
				
			||||||
 | 
							followerId: me._id,
 | 
				
			||||||
 | 
							followeeId: user._id
 | 
				
			||||||
 | 
						})) != null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//#region Construct query
 | 
						//#region Construct query
 | 
				
			||||||
	const sort = { } as any;
 | 
						const sort = { } as any;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const visibleQuery = me == null ? [{
 | 
						const visibleQuery = me == null ? [{
 | 
				
			||||||
		visibility: { $in: ['public', 'home'] }
 | 
							visibility: { $in: ['public', 'home'] }
 | 
				
			||||||
	}] : [{
 | 
						}] : [{
 | 
				
			||||||
		visibility: { $in: [ 'public', 'home' ] }
 | 
							visibility: {
 | 
				
			||||||
 | 
								$in: isFollowing ? ['public', 'home', 'followers'] : ['public', 'home']
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		// myself (for specified/private)
 | 
							// myself (for specified/private)
 | 
				
			||||||
		userId: me._id
 | 
							userId: me._id
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue