refactor: topic follow/ignore to use api lib

This commit is contained in:
Julian Lam
2020-10-16 12:30:14 -04:00
parent 68d6818bca
commit 9ee3cb9b62
3 changed files with 18 additions and 6 deletions

View File

@@ -120,6 +120,18 @@ topicsAPI.unlock = async function (caller, data) {
});
};
topicsAPI.follow = async function (caller, data) {
await topics.follow(data.tid, caller.uid);
};
topicsAPI.ignore = async function (caller, data) {
await topics.ignore(data.tid, caller.uid);
};
topicsAPI.unfollow = async function (caller, data) {
await topics.unfollow(data.tid, caller.uid);
};
async function doTopicAction(action, event, caller, { tids }) {
if (!Array.isArray(tids)) {
throw new Error('[[error:invalid-tid]]');