Skip to content

Commit a892d70

Browse files
committed
Ajustada o save do status da entidade para lixeira Ref.: #1
1 parent 599e7f3 commit a892d70

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Plugin.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,12 @@ public function _init()
118118
/** @var Entity $this */
119119
if($plugin->getSpamTerms($this, $plugin->config['termsBlock'])) {
120120
$this->spamBlock = true;
121-
$this->setStatus(-10);
122121
}
123122
});
124123

125124
// Verifica se existem termos maliciosos e dispara o e-mail e a notificação
126-
$app->hook("entity(<<{$hooks}>>).save:after", function () use ($plugin, $last_spam_sent) {
125+
$app->hook("entity(<<{$hooks}>>).save:after", function () use ($plugin, $last_spam_sent, $app) {
127126
/** @var Entity $this */
128-
129127
$users = $plugin->getAdminUsers($this);
130128
$terms = array_merge($plugin->config['termsBlock'], $plugin->config['terms']);
131129

@@ -151,6 +149,12 @@ public function _init()
151149
$notification->message = $message;
152150
$notification->save(true);
153151
}
152+
153+
if($this->spamBlock) {
154+
$conn = $app->em->getConnection();
155+
$table = $plugin->dictTable($this);
156+
$conn->executeQuery("UPDATE {$table} SET status = -10 WHERE id = {$this->id}");
157+
}
154158
});
155159

156160
// Garante que o termo encontrado fique salvo e o e-mail seja disparado

0 commit comments

Comments
 (0)