mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	check if post exists on up/down vote favourite
This commit is contained in:
		| @@ -96,7 +96,14 @@ SocketPosts.unfavourite = function(socket, data, callback) { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| function favouriteCommand(command, eventName, socket, data, callback) { | function favouriteCommand(command, eventName, socket, data, callback) { | ||||||
| 	if(data && data.pid && data.room_id) { | 	if(!data || !data.pid || !data.room_id) { | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 	posts.exists(data.pid, function(err, exists) { | ||||||
|  | 		if (err || !exists) { | ||||||
|  | 			return callback(err); | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		favourites[command](data.pid, socket.uid, function(err, result) { | 		favourites[command](data.pid, socket.uid, function(err, result) { | ||||||
| 			if (err) { | 			if (err) { | ||||||
| 				return callback(err); | 				return callback(err); | ||||||
| @@ -109,7 +116,7 @@ function favouriteCommand(command, eventName, socket, data, callback) { | |||||||
| 			} | 			} | ||||||
| 			callback(); | 			callback(); | ||||||
| 		}); | 		}); | ||||||
| 	} | 	}); | ||||||
| } | } | ||||||
|  |  | ||||||
| SocketPosts.sendNotificationToPostOwner = function(pid, fromuid, notification) { | SocketPosts.sendNotificationToPostOwner = function(pid, fromuid, notification) { | ||||||
| @@ -121,7 +128,7 @@ SocketPosts.sendNotificationToPostOwner = function(pid, fromuid, notification) { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (fromuid === parseInt(postData.uid, 10)) { | 		if (!postData.uid || fromuid === parseInt(postData.uid, 10)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user