Skip to content

Commit

Permalink
Merge pull request #331 from cofacts/feat-remove-reply
Browse files Browse the repository at this point in the history
feat: add replacedText param for spammer's reply replacement
  • Loading branch information
MrOrz authored Jan 7, 2024
2 parents 8a34ef6 + fb90e2a commit b4e3896
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/scripts/removeArticleReply.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
A script that deletes an article reply
*/

import client from 'util/client';
import { updateArticleReplyStatus } from 'graphql/mutations/UpdateArticleReplyStatus';
import yargs from 'yargs';

async function main({ articleId, replyId, userId } = {}) {
async function main({ articleId, replyId, userId, replacedText } = {}) {
if (!articleId || !replyId || !userId)
throw new Error('Please provide all of articleId, replyId and userId');

if (replacedText) {
const replyBody = {
text: replacedText,
};

await client.update({
index: 'replies',
type: 'doc',
body: replyBody,
});
}
return updateArticleReplyStatus({
articleId,
replyId,
Expand Down Expand Up @@ -43,6 +55,12 @@ if (require.main === module) {
type: 'string',
demandOption: true,
},
replacedText: {
alias: 'rt',
description: 'Replaced text for spammer reply',
type: 'string',
demandOption: false,
},
})
.help('help').argv;

Expand Down

0 comments on commit b4e3896

Please sign in to comment.