mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-09 21:59:42 -06:00
Merge pull request #9485 from kobergj/ActivitylogSpaceFix
Activitylog Spaces
This commit is contained in:
@@ -2,4 +2,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/9485
|
||||
https://github.com/owncloud/ocis/pull/9467
|
||||
|
||||
@@ -110,15 +110,15 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
|
||||
case events.UploadReady:
|
||||
message = MessageResourceCreated
|
||||
ts = utils.TSToTime(ev.Timestamp)
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.FileRef, true), WithUser(ev.ExecutingUser.GetId(), ev.ExecutingUser.GetDisplayName()))
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.FileRef, true), WithUser(ev.ExecutingUser.GetId(), ev.ExecutingUser.GetDisplayName()), WithSpace(toSpace(ev.FileRef)))
|
||||
case events.FileTouched:
|
||||
message = MessageResourceCreated
|
||||
ts = utils.TSToTime(ev.Timestamp)
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""))
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""), WithSpace(toSpace(ev.Ref)))
|
||||
case events.ContainerCreated:
|
||||
message = MessageResourceCreated
|
||||
ts = utils.TSToTime(ev.Timestamp)
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""))
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""), WithSpace(toSpace(ev.Ref)))
|
||||
case events.ItemTrashed:
|
||||
message = MessageResourceTrashed
|
||||
ts = utils.TSToTime(ev.Timestamp)
|
||||
@@ -130,7 +130,7 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, false), WithOldResource(ev.OldReference), WithUser(ev.Executant, ""))
|
||||
case false:
|
||||
message = MessageResourceMoved
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""))
|
||||
vars, err = s.GetVars(ctx, WithResource(ev.Ref, true), WithUser(ev.Executant, ""), WithSpace(toSpace(ev.Ref)))
|
||||
}
|
||||
ts = utils.TSToTime(ev.Timestamp)
|
||||
case events.ShareCreated:
|
||||
|
||||
@@ -192,6 +192,11 @@ func WithSharee(uid *user.UserId, gid *group.GroupId) ActivityOption {
|
||||
// WithSpace sets the space variable for an activity
|
||||
func WithSpace(spaceid *provider.StorageSpaceId) ActivityOption {
|
||||
return func(ctx context.Context, gwc gateway.GatewayAPIClient, vars map[string]interface{}) error {
|
||||
if _, ok := vars["space"]; ok {
|
||||
// do not override space if already set
|
||||
return nil
|
||||
}
|
||||
|
||||
s, err := utils.GetSpace(ctx, spaceid.GetOpaqueId(), gwc)
|
||||
if err != nil {
|
||||
vars["space"] = Resource{
|
||||
|
||||
Reference in New Issue
Block a user