Skip to content

Commit

Permalink
constify the "trashed" space state
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed May 12, 2023
1 parent 4953d9d commit fe42915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion services/graph/pkg/service/v0/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
const (
_spaceTypePersonal = "personal"
_spaceTypeProject = "project"
_spaceStateTrashed = "trashed"

_sortDescending = "desc"
)
Expand Down Expand Up @@ -535,7 +536,7 @@ func (g Graph) formatDrives(ctx context.Context, baseURL *url.URL, storageSpaces
}

// can't access disabled space
if utils.ReadPlainFromOpaque(storageSpace.Opaque, "trashed") != "trashed" {
if utils.ReadPlainFromOpaque(storageSpace.Opaque, "trashed") != _spaceStateTrashed {
res.Special = g.getSpecialDriveItems(ctx, baseURL, storageSpace)
quota, err := g.getDriveQuota(ctx, storageSpace)
res.Quota = &quota
Expand Down
6 changes: 5 additions & 1 deletion services/search/pkg/search/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (

//go:generate mockery --name=Searcher

const (
_spaceStateTrashed = "trashed"
)

// Searcher is the interface to the SearchService
type Searcher interface {
Search(ctx context.Context, req *searchsvc.SearchRequest) (*searchsvc.SearchResponse, error)
Expand Down Expand Up @@ -85,7 +89,7 @@ func (s *Service) Search(ctx context.Context, req *searchsvc.SearchRequest) (*se

spaces := []*provider.StorageSpace{}
for _, space := range listSpacesRes.StorageSpaces {
if utils.ReadPlainFromOpaque(space.Opaque, "trashed") == "trashed" {
if utils.ReadPlainFromOpaque(space.Opaque, "trashed") == _spaceStateTrashed {
// Do not consider disabled spaces
continue
}
Expand Down

0 comments on commit fe42915

Please sign in to comment.