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