Fix: notes/create hangs when rejected (#3221)
This commit is contained in:
		
							parent
							
								
									adbe0fbcd1
								
							
						
					
					
						commit
						9f0b8ba2f8
					
				
					 3 changed files with 16 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -56,7 +56,7 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
 | 
			
		|||
			console.warn(`SLOW API CALL DETECTED: ${ep.name} (${time}ms)`);
 | 
			
		||||
		}
 | 
			
		||||
	} catch (e) {
 | 
			
		||||
		if (e.name == 'INVALID_PARAM') {
 | 
			
		||||
		if (e && e.name == 'INVALID_PARAM') {
 | 
			
		||||
			rej({
 | 
			
		||||
				code: e.name,
 | 
			
		||||
				param: e.param,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -216,7 +216,7 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	// 投稿を作成
 | 
			
		||||
	const note = await create(user, {
 | 
			
		||||
	create(user, {
 | 
			
		||||
		createdAt: new Date(),
 | 
			
		||||
		files: files,
 | 
			
		||||
		poll: ps.poll,
 | 
			
		||||
| 
						 | 
				
			
			@ -229,12 +229,14 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
 | 
			
		|||
		visibility: ps.visibility,
 | 
			
		||||
		visibleUsers,
 | 
			
		||||
		geo: ps.geo
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	const noteObj = await pack(note, user);
 | 
			
		||||
 | 
			
		||||
	// Reponse
 | 
			
		||||
	res({
 | 
			
		||||
		createdNote: noteObj
 | 
			
		||||
	})
 | 
			
		||||
	.then(note => pack(note, user))
 | 
			
		||||
	.then(noteObj => {
 | 
			
		||||
		res({
 | 
			
		||||
			createdNote: noteObj
 | 
			
		||||
		});
 | 
			
		||||
	})
 | 
			
		||||
	.catch(e => {
 | 
			
		||||
		rej(e);
 | 
			
		||||
	});
 | 
			
		||||
}));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue