mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
feat: allow pins to expire (if set) (#8908)
* fix: add back topic assert middleware for pin route * feat: server-side handling of pin expiries * refactor: togglePin to not require uid parameter [breaking] * feat: automatic unpinning if pin has expiration set * feat: client-side modal for setting pin expiration * refactor: categories.getPinnedTids to accept multiple cids ... in preparation for pin expiry logic, direct access to *:pinned zsets is discouraged * fix: remove references to since-removed jobs file for topics * feat: expire pins when getPinnedTids is called * refactor: make the togglePin change non-breaking The 'action:topic.pin' hook now sends uid again, as before. However, if it is a system action (that is, a pin that expired), 'system' will be sent in instead of a valid uid
This commit is contained in:
@@ -38,6 +38,12 @@ 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);
|
||||
}
|
||||
|
||||
helpers.formatApiResponse(200, res);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user