mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +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>",
|
"new_message_from": "New message from <strong>%1</strong>",
|
||||||
"upvoted_your_post_in": "<strong>%1</strong> has upvoted your post in <strong>%2</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_post": "<strong>%1</strong> has moved your post.",
|
||||||
"moved_your_topic": "<strong>%1<strong> has moved your topic.",
|
"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>.",
|
"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_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>",
|
"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);
|
topics.getTopicsByTids(tids, uid, next);
|
||||||
},
|
},
|
||||||
function(topics, next) {
|
function(topics, next) {
|
||||||
if (!topics || !topics.length) {
|
if (!Array.isArray(topics) || !topics.length) {
|
||||||
return next(null, {
|
return next(null, {
|
||||||
topics: [],
|
topics: [],
|
||||||
nextStart: 1
|
nextStart: 1
|
||||||
@@ -131,15 +131,9 @@ var db = require('./database'),
|
|||||||
topics[i].index = indices[topics[i].tid];
|
topics[i].index = indices[topics[i].tid];
|
||||||
}
|
}
|
||||||
|
|
||||||
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
|
next(null, {
|
||||||
if(err) {
|
topics: topics,
|
||||||
return next(err);
|
nextStart: stop + 1
|
||||||
}
|
|
||||||
|
|
||||||
next(null, {
|
|
||||||
topics: topics,
|
|
||||||
nextStart: parseInt(rank, 10) + 1
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
], callback);
|
], callback);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ tagsController.getTag = function(req, res, next) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
data.tag = tag;
|
data.tag = tag;
|
||||||
|
data.nextStart = end + 1;
|
||||||
res.render('tag', data);
|
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) {
|
callback(null, {users: results.users, nextStart: end + 1});
|
||||||
if (err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(null, {users: results.users, nextStart: rank + 1});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
31
src/posts.js
31
src/posts.js
@@ -469,7 +469,12 @@ var async = require('async'),
|
|||||||
if (err) {
|
if (err) {
|
||||||
return callback(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);
|
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) {
|
if (!Array.isArray(pids) || !pids.length) {
|
||||||
return callback(null, {posts: [], nextStart: 0});
|
return callback(null, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
Posts.getPostSummaryByPids(pids, uid, {stripTags: false}, function(err, posts) {
|
Posts.getPostSummaryByPids(pids, uid, {stripTags: false}, function(err, posts) {
|
||||||
@@ -495,19 +505,10 @@ var async = require('async'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(posts) || !posts.length) {
|
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) {
|
callback(null, posts);
|
||||||
if(err) {
|
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
var data = {
|
|
||||||
posts: posts,
|
|
||||||
nextStart: parseInt(rank, 10) + 1
|
|
||||||
};
|
|
||||||
callback(null, data);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,34 +140,34 @@ var async = require('async'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
Topics.getTopicsByTids(tids, uid, function(err, topicData) {
|
Topics.getTopicsByTids(tids, uid, function(err, topicData) {
|
||||||
if(err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!topicData || !topicData.length) {
|
if(!Array.isArray(topicData) || !topicData.length) {
|
||||||
return callback(null, returnTopics);
|
return callback(null, returnTopics);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.sortedSetRevRank(set, topicData[topicData.length - 1].tid, function(err, rank) {
|
returnTopics.topics = topicData;
|
||||||
if(err) {
|
callback(null, returnTopics);
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
returnTopics.nextStart = parseInt(rank, 10) + 1;
|
|
||||||
returnTopics.topics = topicData;
|
|
||||||
callback(null, returnTopics);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Topics.getTopicsFromSet = function(uid, set, start, end, callback) {
|
Topics.getTopicsFromSet = function(uid, set, start, end, callback) {
|
||||||
db.getSortedSetRevRange(set, start, end, function(err, tids) {
|
db.getSortedSetRevRange(set, start, end, function(err, tids) {
|
||||||
if(err) {
|
if (err) {
|
||||||
return callback(err);
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,18 @@ module.exports = function(Topics) {
|
|||||||
|
|
||||||
Topics.getLatestTopics = function(uid, start, end, term, callback) {
|
Topics.getLatestTopics = function(uid, start, end, term, callback) {
|
||||||
Topics.getLatestTids(start, end, term, function(err, tids) {
|
Topics.getLatestTids(start, end, term, function(err, tids) {
|
||||||
if(err) {
|
if (err) {
|
||||||
return callback(err);
|
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,16 +45,10 @@ module.exports = function(Topics) {
|
|||||||
return callback(null, unreadTopics);
|
return callback(null, unreadTopics);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.sortedSetRevRank('topics:recent', topicData[topicData.length - 1].tid, function(err, rank) {
|
unreadTopics.topics = topicData;
|
||||||
if (err) {
|
unreadTopics.nextStart = stop + 1;
|
||||||
return callback(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
unreadTopics.topics = topicData;
|
callback(null, unreadTopics);
|
||||||
unreadTopics.nextStart = parseInt(rank, 10) + 1;
|
|
||||||
|
|
||||||
callback(null, unreadTopics);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user