feat: #8983, update pin tooltip in topic

This commit is contained in:
Barış Soner Uşaklı
2020-12-01 16:25:13 -05:00
parent 69864b8746
commit 954dc5b7be
3 changed files with 15 additions and 7 deletions

View File

@@ -37,12 +37,11 @@ Topics.purge = async (req, res) => {
};
Topics.pin = async (req, res) => {
await api.topics.pin(req, { tids: [req.params.tid] });
// Pin expiry was not available w/ sockets hence not included in api lib method
if (req.body.expiry) {
topics.tools.setPinExpiry(req.params.tid, req.body.expiry, req.uid);
await topics.tools.setPinExpiry(req.params.tid, req.body.expiry, req.uid);
}
await api.topics.pin(req, { tids: [req.params.tid] });
helpers.formatApiResponse(200, res);
};

View File

@@ -168,6 +168,8 @@ module.exports = function (Topics) {
['cid:' + topicData.cid + ':tids:posts', topicData.postcount, tid],
['cid:' + topicData.cid + ':tids:votes', parseInt(topicData.votes, 10) || 0, tid],
]));
topicData.pinExpiry = undefined;
topicData.pinExpiryISO = undefined;
}
await Promise.all(promises);