mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Updated code
Using unedefined 'entry' variable is crashing the server
This commit is contained in:
parent
225ffecd7c
commit
08eeea7d0b
@ -100,10 +100,10 @@ module.exports = {
|
||||
entity = await strapi.services.comment.create(ctx.request.body);
|
||||
}
|
||||
|
||||
entry = sanitizeEntity(entity, { model: strapi.models.comment });
|
||||
entity = sanitizeEntity(entity, { model: strapi.models.comment });
|
||||
|
||||
// check if the comment content contains a bad word
|
||||
if (entry.content !== filter.clean(entry.content)) {
|
||||
if (entity.content !== filter.clean(entity.content)) {
|
||||
|
||||
// send an email by using the email plugin
|
||||
await strapi.plugins['email'].services.email.send({
|
||||
@ -111,15 +111,15 @@ module.exports = {
|
||||
from: 'admin@strapi.io'
|
||||
subject: 'Comment posted that contains a bad words',
|
||||
text: `
|
||||
The comment #${entry.id} contain a bad words.
|
||||
The comment #${entity.id} contain a bad words.
|
||||
|
||||
Comment:
|
||||
${entry.content}
|
||||
${entity.content}
|
||||
`,
|
||||
});
|
||||
}
|
||||
|
||||
return entry;
|
||||
return entity;
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user