mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: dont allow edit if post is deleted by someone else
This commit is contained in:
		| @@ -154,7 +154,7 @@ module.exports = function (privileges) { | |||||||
| 					isMod: async.apply(posts.isModerator, [pid], uid), | 					isMod: async.apply(posts.isModerator, [pid], uid), | ||||||
| 					owner: async.apply(posts.isOwner, pid, uid), | 					owner: async.apply(posts.isOwner, pid, uid), | ||||||
| 					edit: async.apply(privileges.posts.can, 'posts:edit', pid, uid), | 					edit: async.apply(privileges.posts.can, 'posts:edit', pid, uid), | ||||||
| 					postData: async.apply(posts.getPostFields, pid, ['tid', 'timestamp']), | 					postData: async.apply(posts.getPostFields, pid, ['tid', 'timestamp', 'deleted', 'deleterUid']), | ||||||
| 				}, next); | 				}, next); | ||||||
| 			}, | 			}, | ||||||
| 			function (_results, next) { | 			function (_results, next) { | ||||||
| @@ -174,6 +174,10 @@ module.exports = function (privileges) { | |||||||
| 					return callback(null, { flag: false, message: '[[error:topic-locked]]' }); | 					return callback(null, { flag: false, message: '[[error:topic-locked]]' }); | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
|  | 				if (!results.isMod && results.postData.deleted && parseInt(uid, 10) !== parseInt(results.postData.deleterUid, 10)) { | ||||||
|  | 					return callback(null, { flag: false, message: '[[error:post-deleted]]' }); | ||||||
|  | 				} | ||||||
|  |  | ||||||
| 				results.pid = parseInt(pid, 10); | 				results.pid = parseInt(pid, 10); | ||||||
| 				results.uid = uid; | 				results.uid = uid; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user