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 10, 2024
1 parent dec56ba commit f57f7d1
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 116 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
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,7 @@ replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/pl
// exclude the v2 line of go-sqlite3 which was released accidentally and prevents pulling in newer versions of go-sqlite3
// see https://github.com/mattn/go-sqlite3/issues/965 for more details
exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible

//replace github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.24.1-0.20241008163420-64f5373a2500

replace github.com/cs3org/reva/v2 => github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d h1:4BLvpjBits1saRN5AUNWp5GQFbWAwaoaTKxe8MuTFI8=
github.com/2403905/reva/v2 v2.24.1-0.20241009135234-4b4cbb21914d/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/Acconut/go-httptest-recorder v1.0.0 h1:TAv2dfnqp/l+SUvIaMAUK4GeN4+wqb6KZsFFFTGhoJg=
github.com/Acconut/go-httptest-recorder v1.0.0/go.mod h1:CwQyhTH1kq/gLyWiRieo7c0uokpu3PXeyF/nZjUNtmM=
github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
Expand Down Expand Up @@ -255,8 +257,6 @@ 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/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.

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

Loading

0 comments on commit f57f7d1

Please sign in to comment.