mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	editing of posts
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -68,13 +68,11 @@ var	RDB = require('./redis.js'), | ||||
| 				pid.push(pids[i]); | ||||
| 			} | ||||
|  | ||||
|  | ||||
| 			Posts.getFavouritesByPostIDs(pids, current_user, function(fav_data) { | ||||
| 				vote_data = fav_data; | ||||
| 				generateThread(); | ||||
| 			}); | ||||
|  | ||||
|  | ||||
| 			RDB.multi() | ||||
| 				.mget(content) | ||||
| 				.mget(uid) | ||||
| @@ -182,6 +180,7 @@ var	RDB = require('./redis.js'), | ||||
| 					RDB.set('pid:' + pid + ':uid', uid); | ||||
| 					RDB.set('pid:' + pid + ':timestamp', new Date().getTime()); | ||||
| 					RDB.set('pid:' + pid + ':rep', 0); | ||||
| 					RDB.set('pid:' + pid + ':tid', tid); | ||||
| 					 | ||||
| 					RDB.incr('tid:' + tid + ':postcount'); | ||||
| 					 | ||||
| @@ -189,7 +188,7 @@ var	RDB = require('./redis.js'), | ||||
| 					RDB.lpush('uid:' + uid + ':posts', pid); | ||||
| 					 | ||||
| 					user.incrementUserFieldBy(uid, 'postcount', 1); | ||||
| 					 | ||||
|  | ||||
| 					if (callback)  | ||||
| 						callback(pid); | ||||
| 				}); | ||||
| @@ -262,4 +261,17 @@ var	RDB = require('./redis.js'), | ||||
| 			}(pids[i])) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	Posts.getRawContent = function(pid, socket) { | ||||
| 		RDB.get('pid:' + pid + ':content', function(err, raw) { | ||||
| 			socket.emit('api:posts.getRawPost', { post: raw }); | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| 	Posts.edit = function(pid, content) { | ||||
| 		RDB.get('pid:' + pid + ':tid', function(err, tid) { | ||||
| 			RDB.set('pid:' + pid + ':content', content); | ||||
| 			io.sockets.in('topic_' + tid).emit('event:post_edited', { pid: pid, content: marked(content || '') }); | ||||
| 		}); | ||||
| 	} | ||||
| }(exports)); | ||||
		Reference in New Issue
	
	Block a user