mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Add initial tests for reqlog
package
This commit is contained in:
@ -59,7 +59,7 @@ type FindRequestsFilter struct {
|
||||
type Config struct {
|
||||
Scope *scope.Scope
|
||||
Repository Repository
|
||||
ProjectService *proj.Service
|
||||
ProjectService proj.Service
|
||||
BypassOutOfScopeRequests bool
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ func NewService(cfg Config) *Service {
|
||||
}
|
||||
|
||||
cfg.ProjectService.OnProjectOpen(func(_ string) error {
|
||||
err := svc.loadSettings()
|
||||
err := svc.repo.FindSettingsByModule(context.Background(), moduleName, svc)
|
||||
if errors.Is(err, proj.ErrNoSettings) {
|
||||
return nil
|
||||
}
|
||||
@ -82,7 +82,8 @@ func NewService(cfg Config) *Service {
|
||||
return nil
|
||||
})
|
||||
cfg.ProjectService.OnProjectClose(func(_ string) error {
|
||||
svc.unloadSettings()
|
||||
svc.BypassOutOfScopeRequests = false
|
||||
svc.FindReqsFilter = FindRequestsFilter{}
|
||||
return nil
|
||||
})
|
||||
|
||||
@ -252,12 +253,3 @@ func (f *FindRequestsFilter) UnmarshalJSON(b []byte) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (svc *Service) loadSettings() error {
|
||||
return svc.repo.FindSettingsByModule(context.Background(), moduleName, svc)
|
||||
}
|
||||
|
||||
func (svc *Service) unloadSettings() {
|
||||
svc.BypassOutOfScopeRequests = false
|
||||
svc.FindReqsFilter = FindRequestsFilter{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user