Changing tag method in policy is not applied to spamfilter users
short description
When I change rspamd_spam_tag_method in spamfilter policy, files in /etc/rspamd/local.d/users/ are regenerated. However old value for rspamd_spam_tag_method is used, so nothing changes. For example, policy has rewrite_subject value, and file in users directory has "rewrite subject" line, when I change to add_header, I still see "rewrite subject" line. If I change policy in spamfilter_user and change it back, then right rspamd_spam_tag_method is used.
correct behaviour
It should change to use new value for rspamd_spam_tag_method, i.e., if add_header is selected "add header" line should be in /etc/rspamd/local.d/users/ file
environment
Server OS: Debian Server OS version: buster ISPConfig version: 3.1.15p2
proposed fix
I think spamfilter_policy change should be saved to datalog before spamfilter_users. Spamfilter_users are saved in onAfterUpdate callback, and onUpdate saves spamfilter_policy to datalog after calling onAfterUpdate, so spamfilter_users are regenerated with old policy settings, then policy is updated.
I don't know if it's possible to move onAfterUpdate line after datalogSave line, in tform_actions class, so I have added a line to onAfterUpdate callback saving policy to datalog first.
if(is_array($spamfilter_users) && !empty($spamfilter_users)){
+ $app->tform->datalogSave('UPDATE', $this->id, $this->oldDataRecord, $app->tform->getDataRecord($this->id));
foreach($spamfilter_users as $spamfilter_user){
I don't create merge request becuase I'm not sure if it's the best way to fix this.