Skip to content

Commit

Permalink
fix(activitylog): multiple minor bugfixes
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Jun 25, 2024
1 parent dcd319a commit 96e8dc1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/activitylog-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Various fixes for the activitylog service

First round of fixes to make the activitylog service more robust and reliable.

https://github.com/owncloud/ocis/pull/9467
7 changes: 6 additions & 1 deletion services/activitylog/pkg/service/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/cs3org/reva/v2/pkg/utils"
"google.golang.org/grpc/metadata"

libregraph "github.com/owncloud/libre-graph-api-go"
"github.com/owncloud/ocis/v2/ocis-pkg/ast"
"github.com/owncloud/ocis/v2/ocis-pkg/kql"
"github.com/owncloud/ocis/v2/ocis-pkg/l10n"
Expand Down Expand Up @@ -83,7 +84,7 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
return
}

var resp GetActivitiesResponse
resp := GetActivitiesResponse{Activities: make([]libregraph.Activity, 0, len(evRes.GetEvents()))}
for _, e := range evRes.GetEvents() {
delete(toDelete, e.GetId())

Expand Down Expand Up @@ -269,6 +270,10 @@ func (s *ActivitylogService) getFilters(query string) (*provider.ResourceId, int
if err != nil {
return nil, limit, nil, nil, err
}
if rid.GetOpaqueId() == "" {
// space root requested - fix format
rid.OpaqueId = rid.GetSpaceId()
}
pref := func(a RawActivity) bool {
for _, f := range prefilters {
if !f(a) {
Expand Down
5 changes: 4 additions & 1 deletion services/activitylog/pkg/service/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func WithResource(ref *provider.Reference, addSpace bool) ActivityOption {
return func(ctx context.Context, gwc gateway.GatewayAPIClient, vars map[string]interface{}) error {
info, err := utils.GetResource(ctx, ref, gwc)
if err != nil {
vars["resource"] = Resource{
Name: filepath.Base(ref.GetPath()),
}
return err
}

Expand Down Expand Up @@ -209,7 +212,7 @@ func (s *ActivitylogService) GetVars(ctx context.Context, opts ...ActivityOption
vars := make(map[string]interface{})
for _, opt := range opts {
if err := opt(ctx, gwc, vars); err != nil {
return nil, err
s.log.Info().Err(err).Msg("error getting activity vars")
}
}

Expand Down

0 comments on commit 96e8dc1

Please sign in to comment.