Pull request: 5290-rules-count

Merge in DNS/adguard-home from 5290-rules-count to master

Closes #5290.

Squashed commit of the following:

commit c29fd668dd8f25dbfe978fb95f850acbbd632b8b
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Dec 23 14:42:57 2022 +0400

    all: log changes

commit fba4fe7cc046578f17cdf72dff93523558b8aa1f
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Fri Dec 23 14:33:57 2022 +0400

    filtering: fix rules count on err
This commit is contained in:
Eugene Burkov 2022-12-23 17:11:11 +03:00
parent e481922d91
commit 97af23b0af
2 changed files with 5 additions and 2 deletions

View File

@ -42,6 +42,7 @@ See also the [v0.107.21 GitHub milestone][ms-v0.107.21].
### Fixed ### Fixed
- Zeroing rules counter of erroneusly edited filtering rule lists ([#5290]).
- Filters updating strategy, which could sometimes lead to use of broken or - Filters updating strategy, which could sometimes lead to use of broken or
incompletely downloaded lists ([#5258]). incompletely downloaded lists ([#5258]).
- Errors popping up during updates of settings, which could sometimes cause the - Errors popping up during updates of settings, which could sometimes cause the
@ -50,6 +51,7 @@ See also the [v0.107.21 GitHub milestone][ms-v0.107.21].
[#5238]: https://github.com/AdguardTeam/AdGuardHome/issues/5238 [#5238]: https://github.com/AdguardTeam/AdGuardHome/issues/5238
[#5251]: https://github.com/AdguardTeam/AdGuardHome/issues/5251 [#5251]: https://github.com/AdguardTeam/AdGuardHome/issues/5251
[#5258]: https://github.com/AdguardTeam/AdGuardHome/issues/5258 [#5258]: https://github.com/AdguardTeam/AdGuardHome/issues/5258
[#5290]: https://github.com/AdguardTeam/AdGuardHome/issues/5290
[ms-v0.107.21]: https://github.com/AdguardTeam/AdGuardHome/milestone/57?closed=1 [ms-v0.107.21]: https://github.com/AdguardTeam/AdGuardHome/milestone/57?closed=1

View File

@ -99,14 +99,15 @@ func (d *DNSFilter) filterSetProperties(
filt.URL, filt.URL,
) )
defer func(oldURL, oldName string, oldEnabled bool, oldUpdated time.Time) { defer func(oldURL, oldName string, oldEnabled bool, oldUpdated time.Time, oldRulesCount int) {
if err != nil { if err != nil {
filt.URL = oldURL filt.URL = oldURL
filt.Name = oldName filt.Name = oldName
filt.Enabled = oldEnabled filt.Enabled = oldEnabled
filt.LastUpdated = oldUpdated filt.LastUpdated = oldUpdated
filt.RulesCount = oldRulesCount
} }
}(filt.URL, filt.Name, filt.Enabled, filt.LastUpdated) }(filt.URL, filt.Name, filt.Enabled, filt.LastUpdated, filt.RulesCount)
filt.Name = newList.Name filt.Name = newList.Name