mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	nextStart changes, fixed move topic notification text
This commit is contained in:
		| @@ -13,8 +13,8 @@ | ||||
|  | ||||
| 	"new_message_from": "New message from <strong>%1</strong>", | ||||
| 	"upvoted_your_post_in": "<strong>%1</strong> has upvoted your post in <strong>%2</strong>.", | ||||
| 	"moved_your_post": "<strong>%1<strong> has moved your post.", | ||||
| 	"moved_your_topic": "<strong>%1<strong> has moved your topic.", | ||||
| 	"moved_your_post": "<strong>%1</strong> has moved your post.", | ||||
| 	"moved_your_topic": "<strong>%1</strong> has moved your topic.", | ||||
| 	"favourited_your_post_in": "<strong>%1</strong> has favourited your post in <strong>%2</strong>.", | ||||
| 	"user_flagged_post_in": "<strong>%1</strong> flagged a post in <strong>%2</strong>", | ||||
| 	"user_posted_to" : "<strong>%1</strong> has posted a reply to: <strong>%2</strong>", | ||||
|   | ||||
| @@ -114,7 +114,7 @@ var db = require('./database'), | ||||
| 				topics.getTopicsByTids(tids, uid, next); | ||||
| 			}, | ||||
| 			function(topics, next) { | ||||
| 				if (!topics || !topics.length) { | ||||
| 				if (!Array.isArray(topics) || !topics.length) { | ||||
| 					return next(null, { | ||||
| 						topics: [], | ||||
| 						nextStart: 1 | ||||
| @@ -131,15 +131,9 @@ var db = require('./database'), | ||||
| 					topics[i].index = indices[topics[i].tid]; | ||||
| 				} | ||||
|  | ||||
| 				db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) { | ||||
| 					if(err) { | ||||
| 						return next(err); | ||||
| 					} | ||||
|  | ||||
| 				next(null, { | ||||
| 					topics: topics, | ||||
| 						nextStart: parseInt(rank, 10) + 1 | ||||
| 					}); | ||||
| 					nextStart: stop + 1 | ||||
| 				}); | ||||
| 			} | ||||
| 		], callback); | ||||
|   | ||||
| @@ -42,6 +42,7 @@ tagsController.getTag = function(req, res, next) { | ||||
| 			]; | ||||
|  | ||||
| 			data.tag = tag; | ||||
| 			data.nextStart = end + 1; | ||||
| 			res.render('tag', data); | ||||
| 		}); | ||||
| 	}); | ||||
|   | ||||
| @@ -260,13 +260,7 @@ var db = require('./database'), | ||||
| 					} | ||||
| 				}); | ||||
|  | ||||
| 				db.sortedSetRevRank('uid:' + uid + ':chats', results.users[results.users.length - 1].uid, function(err, rank) { | ||||
| 					if (err) { | ||||
| 						return callback(err); | ||||
| 					} | ||||
|  | ||||
| 					callback(null, {users: results.users, nextStart: rank + 1}); | ||||
| 				}); | ||||
| 				callback(null, {users: results.users, nextStart: end + 1}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|   | ||||
							
								
								
									
										31
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -469,7 +469,12 @@ var async = require('async'), | ||||
| 				if (err) { | ||||
| 					return callback(err); | ||||
| 				} | ||||
| 				getPostsFromSet('uid:' + uid + ':posts', pids, callerUid, callback); | ||||
| 				getPosts(pids, callerUid, function(err, posts) { | ||||
| 					if (err) { | ||||
| 						return callback(err); | ||||
| 					} | ||||
| 					callback(null, {posts: posts, nextStart: end + 1}); | ||||
| 				}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
| @@ -480,13 +485,18 @@ var async = require('async'), | ||||
| 				return callback(err); | ||||
| 			} | ||||
|  | ||||
| 			getPostsFromSet('uid:' + uid + ':favourites', pids, uid, callback); | ||||
| 			getPosts(pids, uid, function(err, posts) { | ||||
| 				if (err) { | ||||
| 					return callback(err); | ||||
| 				} | ||||
| 				callback(null, {posts: posts, nextStart: end + 1}); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	function getPostsFromSet(set, pids, uid, callback) { | ||||
| 	function getPosts(pids, uid, callback) { | ||||
| 		if (!Array.isArray(pids) || !pids.length) { | ||||
| 			return callback(null, {posts: [], nextStart: 0}); | ||||
| 			return callback(null, []); | ||||
| 		} | ||||
|  | ||||
| 		Posts.getPostSummaryByPids(pids, uid, {stripTags: false}, function(err, posts) { | ||||
| @@ -495,19 +505,10 @@ var async = require('async'), | ||||
| 			} | ||||
|  | ||||
| 			if (!Array.isArray(posts) || !posts.length) { | ||||
| 				return callback(null, {posts: [], nextStart: 0}); | ||||
| 				return callback(null, []); | ||||
| 			} | ||||
|  | ||||
| 			db.sortedSetRevRank(set, posts[posts.length - 1].pid, function(err, rank) { | ||||
| 				if(err) { | ||||
| 					return callback(err); | ||||
| 				} | ||||
| 				var data = { | ||||
| 					posts: posts, | ||||
| 					nextStart: parseInt(rank, 10) + 1 | ||||
| 				}; | ||||
| 				callback(null, data); | ||||
| 			}); | ||||
| 			callback(null, posts); | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -144,21 +144,14 @@ var async = require('async'), | ||||
| 					return callback(err); | ||||
| 				} | ||||
|  | ||||
| 				if(!topicData || !topicData.length) { | ||||
| 				if(!Array.isArray(topicData) || !topicData.length) { | ||||
| 					return callback(null, returnTopics); | ||||
| 				} | ||||
|  | ||||
| 				db.sortedSetRevRank(set, topicData[topicData.length - 1].tid, function(err, rank) { | ||||
| 					if(err) { | ||||
| 						return callback(err); | ||||
| 					} | ||||
|  | ||||
| 					returnTopics.nextStart = parseInt(rank, 10) + 1; | ||||
| 				returnTopics.topics = topicData; | ||||
| 				callback(null, returnTopics); | ||||
| 			}); | ||||
| 		}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	Topics.getTopicsFromSet = function(uid, set, start, end, callback) { | ||||
| @@ -167,7 +160,14 @@ var async = require('async'), | ||||
| 				return callback(err); | ||||
| 			} | ||||
|  | ||||
| 			Topics.getTopics(set, uid, tids, callback); | ||||
| 			Topics.getTopics(set, uid, tids, function(err, data) { | ||||
| 				if (err) { | ||||
| 					return callback(err); | ||||
| 				} | ||||
|  | ||||
| 				data.nextStart = end + 1; | ||||
| 				callback(null, data); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,14 @@ module.exports = function(Topics) { | ||||
| 				return callback(err); | ||||
| 			} | ||||
|  | ||||
| 			Topics.getTopics('topics:recent', uid, tids, callback); | ||||
| 			Topics.getTopics('topics:recent', uid, tids, function(err, data) { | ||||
| 				if (err) { | ||||
| 					return callback(err); | ||||
| 				} | ||||
|  | ||||
| 				data.nextStart = end + 1; | ||||
| 				callback(null, data); | ||||
| 			}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
|   | ||||
| @@ -45,18 +45,12 @@ module.exports = function(Topics) { | ||||
| 					return callback(null, unreadTopics); | ||||
| 				} | ||||
|  | ||||
| 				db.sortedSetRevRank('topics:recent', topicData[topicData.length - 1].tid, function(err, rank) { | ||||
| 					if (err) { | ||||
| 						return callback(err); | ||||
| 					} | ||||
|  | ||||
| 				unreadTopics.topics = topicData; | ||||
| 					unreadTopics.nextStart = parseInt(rank, 10) + 1; | ||||
| 				unreadTopics.nextStart = stop + 1; | ||||
|  | ||||
| 				callback(null, unreadTopics); | ||||
| 			}); | ||||
| 		}); | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	Topics.getUnreadTids = function(uid, start, stop, callback) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user