Pull request 1901: 5946-fix-blocked-services-client-schedule

Updates #5946.

Squashed commit of the following:

commit cd6ba613fae56d05a2e51ae1a65e9fcf4a39899e
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Jun 30 11:27:52 2023 +0300

    home: fix blocked services client schedule
This commit is contained in:
Stanislav Chzhen 2023-06-30 11:56:03 +03:00
parent efed23701a
commit 1fd6cf1a2f
1 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/AdguardTeam/AdGuardHome/internal/aghalg"
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/AdGuardHome/internal/schedule"
"github.com/AdguardTeam/AdGuardHome/internal/whois"
)
@ -118,13 +119,18 @@ func (clients *clientsContainer) jsonToClient(cj clientJSON, prev *Client) (c *C
}
}
weekly := schedule.EmptyWeekly()
if prev != nil {
weekly = prev.BlockedServices.Schedule.Clone()
}
c = &Client{
safeSearchConf: safeSearchConf,
Name: cj.Name,
BlockedServices: &filtering.BlockedServices{
Schedule: prev.BlockedServices.Schedule.Clone(),
Schedule: weekly,
IDs: cj.BlockedServices,
},