Refactor
This commit is contained in:
		@@ -4,9 +4,9 @@ import User, { isRemoteUser, isLocalUser } from '../../../models/user';
 | 
			
		||||
import { IdentifiableError } from '../../../misc/identifiable-error';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get valied note for API processing
 | 
			
		||||
 * Get note for API processing
 | 
			
		||||
 */
 | 
			
		||||
export async function getValiedNote(noteId: mongo.ObjectID) {
 | 
			
		||||
export async function getNote(noteId: mongo.ObjectID) {
 | 
			
		||||
	const note = await Note.findOne({
 | 
			
		||||
		_id: noteId,
 | 
			
		||||
		deletedAt: { $exists: false }
 | 
			
		||||
@@ -24,10 +24,17 @@ export async function getValiedNote(noteId: mongo.ObjectID) {
 | 
			
		||||
 */
 | 
			
		||||
export async function getUser(userId: mongo.ObjectID) {
 | 
			
		||||
	const user = await User.findOne({
 | 
			
		||||
		_id: userId
 | 
			
		||||
		_id: userId,
 | 
			
		||||
		isDeleted: false
 | 
			
		||||
	}, {
 | 
			
		||||
		fields: {
 | 
			
		||||
			data: false,
 | 
			
		||||
			profile: false,
 | 
			
		||||
			clientSettings: false
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	if (user == null) {
 | 
			
		||||
	if (user === null) {
 | 
			
		||||
		throw new IdentifiableError('15348ddd-432d-49c2-8a5a-8069753becff', 'No such user.');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user