Skip to content

Commit

Permalink
Kept historical resource naming after renaming in activity for shares…
Browse files Browse the repository at this point in the history
… and public links.
  • Loading branch information
2403905 committed Oct 16, 2024
1 parent 1ba6e4b commit 9c04e61
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 112 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-activity-rename.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Kept historical resource naming in activity

Kept historical resource naming after renaming in activity for shares and public links.

https://github.com/owncloud/ocis/pull/10266
https://github.com/owncloud/ocis/issues/10210
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.11.0
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb
github.com/cs3org/reva/v2 v2.25.1-0.20241015142909-99548fe690bd
github.com/cs3org/reva/v2 v2.25.1-0.20241016095128-a322d4ae17f8
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/reva/v2 v2.25.1-0.20241004072335-2a6fdbed139d h1:ETrSkU/XK50QzsxCAHQrr0b7klOHb9TVmJjmOsjMhr8=
github.com/cs3org/reva/v2 v2.25.1-0.20241004072335-2a6fdbed139d/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cs3org/reva/v2 v2.25.1-0.20241015142909-99548fe690bd h1:+cV0mcJR2v4Fidrs1ckM7c0+dSINTLsmECO76AbW8No=
github.com/cs3org/reva/v2 v2.25.1-0.20241015142909-99548fe690bd/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cs3org/reva/v2 v2.25.1-0.20241016095128-a322d4ae17f8 h1:MdW7vda/bf41NL1f6uZE5QQvIKNd4Zky18vm7LLIFI0=
github.com/cs3org/reva/v2 v2.25.1-0.20241016095128-a322d4ae17f8/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
Expand Down
25 changes: 20 additions & 5 deletions services/activitylog/pkg/service/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,30 +160,45 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
case events.ShareCreated:
message = MessageShareCreated
ts = utils.TSToTime(ev.CTime)
vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithSharee(ev.GranteeUserID, ev.GranteeGroupID))
vars, err = s.GetVars(ctx,
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
WithUser(ev.Executant, nil, nil),
WithSharee(ev.GranteeUserID, ev.GranteeGroupID))
case events.ShareUpdated:
if ev.Sharer != nil && ev.ItemID != nil && ev.Sharer.GetOpaqueId() == ev.ItemID.GetSpaceId() {
continue
}
message = MessageShareUpdated
ts = utils.TSToTime(ev.MTime)
vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithTranslation(&t, loc, "field", ev.UpdateMask))
vars, err = s.GetVars(ctx,
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
WithUser(ev.Executant, nil, nil),
WithTranslation(&t, loc, "field", ev.UpdateMask))
case events.ShareRemoved:
message = MessageShareDeleted
ts = ev.Timestamp
vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil), WithSharee(ev.GranteeUserID, ev.GranteeGroupID))
vars, err = s.GetVars(ctx,
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
WithUser(ev.Executant, nil, nil),
WithSharee(ev.GranteeUserID, ev.GranteeGroupID))
case events.LinkCreated:
message = MessageLinkCreated
ts = utils.TSToTime(ev.CTime)
vars, err = s.GetVars(ctx, WithResource(toRef(ev.ItemID), false), WithUser(ev.Executant, nil, nil))
vars, err = s.GetVars(ctx,
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
WithUser(ev.Executant, nil, nil))
case events.LinkUpdated:
if ev.Sharer != nil && ev.ItemID != nil && ev.Sharer.GetOpaqueId() == ev.ItemID.GetSpaceId() {
continue
}
message = MessageLinkUpdated
ts = utils.TSToTime(ev.MTime)
vars, err = s.GetVars(ctx,
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
WithUser(ev.Executant, nil, nil),
WithTranslation(&t, loc, "field", []string{ev.FieldUpdated}),
WithVar("token", ev.ItemID.GetOpaqueId(), ev.Token))
Expand Down
78 changes: 7 additions & 71 deletions tests/acceptance/features/apiActivities/shareActivities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1139,15 +1139,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -1211,7 +1202,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1222,15 +1213,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -1294,7 +1276,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1305,15 +1287,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -1467,7 +1440,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1478,15 +1451,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -1550,7 +1514,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1561,15 +1525,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -1633,7 +1588,7 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["field","folder","resource","token","user"],
"required": ["field","resource","token","user"],
"properties": {
"field": {
"type": "object",
Expand All @@ -1644,15 +1599,6 @@ Feature: check share activity
}
}
},
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "new-space"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -2064,17 +2010,8 @@ Feature: check share activity
},
"variables": {
"type": "object",
"required": ["folder","resource","user"],
"required": ["resource","user"],
"properties": {
"folder": {
"type": "object",
"required": ["id","name"],
"properties": {
"name": {
"const": "Alice Hansen"
}
}
},
"resource": {
"type": "object",
"required": ["id","name"],
Expand Down Expand Up @@ -2287,4 +2224,3 @@ Feature: check share activity
}
}
"""

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9c04e61

Please sign in to comment.