mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	server-side srestruction to editing posts (though need to add rep of editor blah blah)
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -285,12 +285,21 @@ var	RDB = require('./redis.js'), | ||||
| 	} | ||||
|  | ||||
| 	Posts.edit = function(uid, pid, content) { | ||||
| 		RDB.get('pid:' + pid + ':tid', function(err, tid) { | ||||
| 			RDB.set('pid:' + pid + ':content', content); | ||||
| 			RDB.set('pid:' + pid + ':edited', new Date().getTime()); | ||||
| 			RDB.set('pid:' + pid + ':editor', uid); | ||||
| 		RDB.mget(['pid:' + pid + ':tid', 'pid:' + pid + ':uid'], function(err, results) { | ||||
| 			var	tid = results[0], | ||||
| 				author = results[1]; | ||||
|  | ||||
| 			io.sockets.in('topic_' + tid).emit('event:post_edited', { pid: pid, content: marked(content || '') }); | ||||
| 			if (uid === author) { | ||||
| 				RDB.set('pid:' + pid + ':content', content); | ||||
| 				RDB.set('pid:' + pid + ':edited', new Date().getTime()); | ||||
| 				RDB.set('pid:' + pid + ':editor', uid); | ||||
|  | ||||
| 				io.sockets.in('topic_' + tid).emit('event:post_edited', { pid: pid, content: marked(content || '') }); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	Posts.delete = function(uid, pid) { | ||||
| 		return 'elephants'; | ||||
| 	} | ||||
| }(exports)); | ||||
		Reference in New Issue
	
	Block a user