mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master' into category-whitelisting
This commit is contained in:
		| @@ -3,7 +3,7 @@ define(function() { | |||||||
| 		loadingMoreTopics = false; | 		loadingMoreTopics = false; | ||||||
|  |  | ||||||
| 	Unread.init = function() { | 	Unread.init = function() { | ||||||
| 		app.enter_room('recent_posts'); | 		app.enterRoom('recent_posts'); | ||||||
|  |  | ||||||
| 		ajaxify.register_events([ | 		ajaxify.register_events([ | ||||||
| 			'event:new_topic', | 			'event:new_topic', | ||||||
|   | |||||||
| @@ -74,13 +74,18 @@ | |||||||
| 									<button class="btn btn-sm btn-primary btn post_reply" type="button">[[topic:reply]] <i class="fa fa-reply"></i></button> | 									<button class="btn btn-sm btn-primary btn post_reply" type="button">[[topic:reply]] <i class="fa fa-reply"></i></button> | ||||||
| 								</div> | 								</div> | ||||||
|  |  | ||||||
| 								<div class="btn-group pull-right post-tools"> | 								<div class="pull-right"> | ||||||
| 									<button class="btn btn-sm btn-default link" type="button" title="[[topic:link]]"><i class="fa fa-link"></i></button> | 									<div class="btn-group post-tools"> | ||||||
| 									<button class="btn btn-sm btn-default main-post facebook-share" type="button" title=""><i class="fa fa-facebook"></i></button> | 										<button class="btn btn-sm btn-default link" type="button" title="[[topic:link]]"><i class="fa fa-link"></i></button> | ||||||
| 									<button class="btn btn-sm btn-default main-post twitter-share" type="button" title=""><i class="fa fa-twitter"></i></button> | 										<button class="btn btn-sm btn-default facebook-share" type="button" title=""><i class="fa fa-facebook"></i></button> | ||||||
| 									<button class="btn btn-sm btn-default main-post google-share" type="button" title=""><i class="fa fa-google-plus"></i></button> | 										<button class="btn btn-sm btn-default twitter-share" type="button" title=""><i class="fa fa-twitter"></i></button> | ||||||
| 									<button class="btn btn-sm btn-default edit {posts.display_moderator_tools}" type="button" title="[[topic:edit]]"><i class="fa fa-pencil"></i></button> | 										<button class="btn btn-sm btn-default google-share" type="button" title=""><i class="fa fa-google-plus"></i></button> | ||||||
| 									<button class="btn btn-sm btn-default delete {posts.display_moderator_tools}" type="button" title="[[topic:delete]]"><i class="fa fa-trash-o"></i></button> | 									</div> | ||||||
|  |  | ||||||
|  | 									<div class="btn-group post-tools"> | ||||||
|  | 										<button class="btn btn-sm btn-default edit {posts.display_moderator_tools}" type="button" title="[[topic:edit]]"><i class="fa fa-pencil"></i></button> | ||||||
|  | 										<button class="btn btn-sm btn-default delete {posts.display_moderator_tools}" type="button" title="[[topic:delete]]"><i class="fa fa-trash-o"></i></button> | ||||||
|  | 									</div> | ||||||
| 								</div> | 								</div> | ||||||
|  |  | ||||||
| 								<input id="post_{posts.pid}_link" value="" class="pull-right" style="display:none;"></input> | 								<input id="post_{posts.pid}_link" value="" class="pull-right" style="display:none;"></input> | ||||||
|   | |||||||
| @@ -149,7 +149,7 @@ var RDB = require('./redis.js'), | |||||||
| 			if(cids && cids.length === 0) { | 			if(cids && cids.length === 0) { | ||||||
| 				return callback(null, {categories : []}); | 				return callback(null, {categories : []}); | ||||||
| 			} | 			} | ||||||
| 			 |  | ||||||
| 			Categories.getCategories(cids, current_user, callback); | 			Categories.getCategories(cids, current_user, callback); | ||||||
| 		}); | 		}); | ||||||
| 	}; | 	}; | ||||||
| @@ -300,12 +300,12 @@ var RDB = require('./redis.js'), | |||||||
| 		RDB.hmgetObject('category:' + cid, fields, callback); | 		RDB.hmgetObject('category:' + cid, fields, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Categories.setCategoryField = function(cid, field, value) { | 	Categories.setCategoryField = function(cid, field, value, callback) { | ||||||
| 		RDB.hset('category:' + cid, field, value); | 		RDB.hset('category:' + cid, field, value, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Categories.incrementCategoryFieldBy = function(cid, field, value) { | 	Categories.incrementCategoryFieldBy = function(cid, field, value, callback) { | ||||||
| 		RDB.hincrby('category:' + cid, field, value); | 		RDB.hincrby('category:' + cid, field, value, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Categories.getCategories = function(cids, uid, callback) { | 	Categories.getCategories = function(cids, uid, callback) { | ||||||
|   | |||||||
| @@ -202,9 +202,12 @@ var fs = require('fs'), | |||||||
| 						break; | 						break; | ||||||
| 					case 'action': | 					case 'action': | ||||||
| 						async.each(hookList, function(hookObj) { | 						async.each(hookList, function(hookObj) { | ||||||
| 							if (hookObj.method) hookObj.method.call(_self.libraries[hookObj.id], args); | 							if (hookObj.method) { | ||||||
| 							else { | 								hookObj.method.call(_self.libraries[hookObj.id], args); | ||||||
| 								if (global.env === 'development') winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); | 							} else { | ||||||
|  | 								if (global.env === 'development') { | ||||||
|  | 									winston.info('[plugins] Expected method \'' + hookObj.method + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); | ||||||
|  | 								} | ||||||
| 							} | 							} | ||||||
| 						}); | 						}); | ||||||
| 						break; | 						break; | ||||||
| @@ -215,7 +218,9 @@ var fs = require('fs'), | |||||||
| 			} else { | 			} else { | ||||||
| 				// Otherwise, this hook contains no methods | 				// Otherwise, this hook contains no methods | ||||||
| 				var returnVal = args; | 				var returnVal = args; | ||||||
| 				if (callback) callback(null, returnVal); | 				if (callback) { | ||||||
|  | 					callback(null, returnVal); | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		isActive: function(id, callback) { | 		isActive: function(id, callback) { | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -44,14 +44,12 @@ var RDB = require('./redis'), | |||||||
| 						return callback(err, null); | 						return callback(err, null); | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					content = newContent; |  | ||||||
|  |  | ||||||
| 					var timestamp = Date.now(), | 					var timestamp = Date.now(), | ||||||
| 						postData = { | 						postData = { | ||||||
| 							'pid': pid, | 							'pid': pid, | ||||||
| 							'uid': uid, | 							'uid': uid, | ||||||
| 							'tid': tid, | 							'tid': tid, | ||||||
| 							'content': content, | 							'content': newContent, | ||||||
| 							'timestamp': timestamp, | 							'timestamp': timestamp, | ||||||
| 							'reputation': 0, | 							'reputation': 0, | ||||||
| 							'editor': '', | 							'editor': '', | ||||||
| @@ -348,13 +346,13 @@ var RDB = require('./redis'), | |||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Posts.setPostField = function(pid, field, value, done) { | 	Posts.setPostField = function(pid, field, value, callback) { | ||||||
| 		RDB.hset('post:' + pid, field, value); | 		RDB.hset('post:' + pid, field, value, callback); | ||||||
| 		plugins.fireHook('action:post.setField', { | 		plugins.fireHook('action:post.setField', { | ||||||
| 			'pid': pid, | 			'pid': pid, | ||||||
| 			'field': field, | 			'field': field, | ||||||
| 			'value': value | 			'value': value | ||||||
| 		}, done); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Posts.getPostsByPids = function(pids, callback) { | 	Posts.getPostsByPids = function(pids, callback) { | ||||||
|   | |||||||
| @@ -682,7 +682,7 @@ var RDB = require('./redis'), | |||||||
|  |  | ||||||
| 		user.notifications.getUnreadByUniqueId(uid, 'topic:' + tid, function(err, nids) { | 		user.notifications.getUnreadByUniqueId(uid, 'topic:' + tid, function(err, nids) { | ||||||
| 			notifications.mark_read_multiple(nids, uid, function() { | 			notifications.mark_read_multiple(nids, uid, function() { | ||||||
| 			 |  | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| @@ -787,16 +787,16 @@ var RDB = require('./redis'), | |||||||
| 		RDB.hmgetObject('topic:' + tid, fields, callback); | 		RDB.hmgetObject('topic:' + tid, fields, callback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Topics.setTopicField = function(tid, field, value) { | 	Topics.setTopicField = function(tid, field, value, callback) { | ||||||
| 		RDB.hset('topic:' + tid, field, value); | 		RDB.hset('topic:' + tid, field, value, callback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Topics.increasePostCount = function(tid) { | 	Topics.increasePostCount = function(tid, callback) { | ||||||
| 		RDB.hincrby('topic:' + tid, 'postcount', 1); | 		RDB.hincrby('topic:' + tid, 'postcount', 1, callback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Topics.increaseViewCount = function(tid) { | 	Topics.increaseViewCount = function(tid, callback) { | ||||||
| 		RDB.hincrby('topic:' + tid, 'viewcount', 1); | 		RDB.hincrby('topic:' + tid, 'viewcount', 1, callback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Topics.isLocked = function(tid, callback) { | 	Topics.isLocked = function(tid, callback) { | ||||||
|   | |||||||
| @@ -316,8 +316,8 @@ var bcrypt = require('bcrypt'), | |||||||
| 		RDB.hset('user:' + uid, field, value, callback); | 		RDB.hset('user:' + uid, field, value, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.setUserFields = function(uid, data) { | 	User.setUserFields = function(uid, data, callback) { | ||||||
| 		RDB.hmset('user:' + uid, data); | 		RDB.hmset('user:' + uid, data, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.incrementUserFieldBy = function(uid, field, value, callback) { | 	User.incrementUserFieldBy = function(uid, field, value, callback) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user