]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Always set the unlearn flag when relearning
authoraduernberger <aduernberger@googlemail.com>
Thu, 18 Apr 2024 12:28:34 +0000 (14:28 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 12:28:34 +0000 (14:28 +0200)
Treat relearning from ham to spam the same as relearning from spam to ham. `res` is only set to true if the mail is already learned.

src/libstat/learn_cache/redis_cache.cxx

index 15dccf141986ef2fb815859c1fae3f00470cdb48..0de5cd094111d882f1db45868ef6cc3920dc1a72 100644 (file)
@@ -170,7 +170,7 @@ rspamd_stat_cache_checked(lua_State *L)
                                                  (task->flags & RSPAMD_TASK_FLAG_LEARN_SPAM) ? "spam" : "ham");
                        task->flags |= RSPAMD_TASK_FLAG_ALREADY_LEARNED;
                }
-               else if (val != 0) {
+               else {
                        /* Unlearn flag */
                        task->flags |= RSPAMD_TASK_FLAG_UNLEARN;
                }