mirror of
https://github.com/wassname/talk.git
synced 2026-07-28 11:27:05 +08:00
Merge branch 'master' into ignored-users-reply
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
const { APIError } = require('errors');
|
||||
const { TalkError } = require('errors');
|
||||
|
||||
// ErrSpam is sent during a `CreateComment` mutation where
|
||||
// `input.checkSpam` is set to true and the comment contains
|
||||
// detected spam as determined by the akismet service.
|
||||
const ErrSpam = new APIError('Comment is spam', {
|
||||
status: 400,
|
||||
translation_key: 'COMMENT_IS_SPAM',
|
||||
});
|
||||
class ErrSpam extends TalkError {
|
||||
constructor() {
|
||||
super('Comment is spam', {
|
||||
status: 400,
|
||||
translation_key: 'COMMENT_IS_SPAM',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ErrSpam,
|
||||
|
||||
@@ -100,7 +100,7 @@ module.exports = {
|
||||
|
||||
if (spam) {
|
||||
if (input.checkSpam) {
|
||||
throw ErrSpam;
|
||||
throw new ErrSpam();
|
||||
}
|
||||
|
||||
// Attach reason information for the flag being added.
|
||||
|
||||
@@ -29,10 +29,11 @@ async function updateNotificationSettings(ctx, settings) {
|
||||
}
|
||||
|
||||
module.exports = ctx => {
|
||||
const { connectors: { errors: ErrNotAuthorized } } = ctx;
|
||||
|
||||
let mutators = {
|
||||
User: {
|
||||
updateNotificationSettings: () =>
|
||||
Promise.reject(ctx.connectors.errors.ErrNotAuthorized),
|
||||
updateNotificationSettings: () => Promise.reject(new ErrNotAuthorized()),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
const { APIError } = require('errors');
|
||||
const { TalkError } = require('errors');
|
||||
|
||||
// ErrToxic is sent during a `CreateComment` mutation where
|
||||
// `input.checkToxicity` is set to true and the comment contains
|
||||
// toxic language as determined by the perspective service.
|
||||
const ErrToxic = new APIError('Comment is toxic', {
|
||||
status: 400,
|
||||
translation_key: 'COMMENT_IS_TOXIC',
|
||||
});
|
||||
class ErrToxic extends TalkError {
|
||||
constructor() {
|
||||
super('Comment is toxic', {
|
||||
status: 400,
|
||||
translation_key: 'COMMENT_IS_TOXIC',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ErrToxic,
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = {
|
||||
|
||||
if (isToxic(scores)) {
|
||||
if (input.checkToxicity) {
|
||||
throw ErrToxic;
|
||||
throw new ErrToxic();
|
||||
}
|
||||
|
||||
input.status = 'SYSTEM_WITHHELD';
|
||||
|
||||
Reference in New Issue
Block a user