Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
katcday committed Sep 24, 2024
1 parent cd7b505 commit 53ac399
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion public/src/client/topic/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ define('forum/topic/events', [
el.find('[component="post/bookmark/off"]').toggleClass('hidden', data.isBookmarked);
}

function toggleAnswered(data) {
function toggleAnswered() {
console.log('hi');
}

Expand Down
17 changes: 8 additions & 9 deletions src/posts/answer.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
'use strict';

const db = require('../database');
const plugins = require('../plugins');

module.exports = function (Posts) {
Posts.answer = async function (pid, uid) {
return await toggleAnswered('answer', pid, uid);
};

Posts.unanswer = async function (pid, uid) {
return await toggleAnswered('unanswer', pid, uid);
};
Posts.unanswer = async function (pid, uid) {
return await toggleAnswered('unanswer', pid, uid);
};

async function toggleAnswered(type, pid, uid) {
const isAnswering = type === 'answer';
await plugins.hooks.fire(`filter:post.${type}`, { pid: pid, uid: uid });
const isAnswering = type === 'answer';
await plugins.hooks.fire(`filter:post.${type}`, { pid: pid, uid: uid });

await Posts.setPostFields(pid, {
await Posts.setPostFields(pid, {
answered: isAnswering ? 1 : 0,
answererUid: isAnswering ? uid : 0,
});

const postData = await Posts.getPostFields(pid, ['pid', 'tid', 'uid', 'content', 'timestamp']);

return postData;
};
}
}
};

0 comments on commit 53ac399

Please sign in to comment.