Refactor
This commit is contained in:
		
							parent
							
								
									c5d5f7cef3
								
							
						
					
					
						commit
						b60ed8f20c
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
					@ -228,13 +228,6 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
 | 
				
			||||||
	// -----------------------------------------------------------
 | 
						// -----------------------------------------------------------
 | 
				
			||||||
	// Post processes
 | 
						// Post processes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (channel) {
 | 
					 | 
				
			||||||
		Channel.update({ _id: channel._id }, {
 | 
					 | 
				
			||||||
			$inc: {
 | 
					 | 
				
			||||||
				index: 1
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	User.update({ _id: user._id }, {
 | 
						User.update({ _id: user._id }, {
 | 
				
			||||||
		$set: {
 | 
							$set: {
 | 
				
			||||||
| 
						 | 
					@ -260,8 +253,15 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
 | 
				
			||||||
	// Publish event to myself's stream
 | 
						// Publish event to myself's stream
 | 
				
			||||||
	event(user._id, 'post', postObj);
 | 
						event(user._id, 'post', postObj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Publish event to channel
 | 
					 | 
				
			||||||
	if (channel) {
 | 
						if (channel) {
 | 
				
			||||||
 | 
							// Increment channel index(posts count)
 | 
				
			||||||
 | 
							Channel.update({ _id: channel._id }, {
 | 
				
			||||||
 | 
								$inc: {
 | 
				
			||||||
 | 
									index: 1
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Publish event to channel
 | 
				
			||||||
		publishChannelStream(channel._id, 'post', postObj);
 | 
							publishChannelStream(channel._id, 'post', postObj);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue