Added ACP option to customise recent post

Before, could either be OP or last reply.

Now, you can choose between OP, last reply, or last post (which
includes OP)
v1.18.x
Julian Lam 9 years ago
parent 14df793ba6
commit 8eaff1492a

@ -31,7 +31,7 @@
"profileImageDimension": 128,
"requireEmailConfirmation": 0,
"allowProfileImageUploads": 1,
"teaserPost": "last",
"teaserPost": "last-reply",
"allowPrivateGroups": 1,
"unreadCutoff": 2,
"bookmarkThreshold": 5

@ -105,14 +105,7 @@ module.exports = function(Categories) {
function (next) {
topics.getTopicsFields(tids, ['tid', 'mainPid', 'slug', 'title', 'teaserPid', 'cid', 'postcount'], next);
},
function (_topicData, next) {
topicData = _topicData;
topicData.forEach(function(topic) {
topic.teaserPid = topic.teaserPid || topic.mainPid;
});
topics.getTeasers(topicData, next);
},
async.apply(topics.getTeasers, topicData),
function (teasers, next) {
teasers.forEach(function(teaser, index) {
if (teaser) {

@ -26,7 +26,24 @@ module.exports = function(Topics) {
topics.forEach(function(topic) {
counts.push(topic && (parseInt(topic.postcount, 10) || 0));
if (topic) {
teaserPids.push(meta.config.teaserPost === 'first' ? topic.mainPid : topic.teaserPid);
if (topic.teaserPid === 'null') {
delete topic.teaserPid;
}
switch(meta.config.teaserPost) {
case 'first':
teaserPids.push(topic.mainPid);
break;
case 'last-post':
teaserPids.push(topic.teaserPid || topic.mainPid);
break;
case 'last-reply': // intentional fall-through
default:
teaserPids.push(topic.teaserPid);
break;
}
}
});
@ -113,7 +130,11 @@ module.exports = function(Topics) {
}
pid = pid || null;
Topics.setTopicField(tid, 'teaserPid', pid, callback);
if (pid) {
Topics.setTopicField(tid, 'teaserPid', pid, callback);
} else {
Topics.deleteTopicField(tid, 'teaserPid', callback);
}
});
};
};

@ -83,7 +83,8 @@
<div class="form-group">
<label>Teaser Post</label>
<select class="form-control" data-field="teaserPost">
<option value="last">Last</option>
<option value="last-post">Last &ndash; Show the latest post, including the original post, if no replies</option>
<option value="last-reply">Last &ndash; Show the latest reply, or a "No replies" placeholder if no replies</option>
<option value="first">First</option>
</select>
</div>

Loading…
Cancel
Save