feat(topic-events): topic events GET route in write API

This commit is contained in:
Julian Lam
2021-01-13 10:09:17 -05:00
parent 449c379d22
commit dc84559d0b
4 changed files with 97 additions and 0 deletions

View File

@@ -181,3 +181,11 @@ async function checkThumbPrivileges({ tid, uid, res }) {
return helpers.formatApiResponse(403, res, new Error('[[error:no-privileges]]'));
}
}
Topics.getEvents = async (req, res) => {
if (!await privileges.topics.can('topics:read', req.params.tid, req.uid)) {
return helpers.formatApiResponse(403, res);
}
helpers.formatApiResponse(200, res, await topics.events.get(req.params.tid));
};