From e488d269e3a616f040279101e399ee7643abdb7b Mon Sep 17 00:00:00 2001 From: jkoberg Date: Fri, 19 Apr 2024 14:49:04 +0200 Subject: [PATCH] feat(events): add itemid to linkremovedevent Signed-off-by: jkoberg --- changelog/unreleased/linkremoved-itemid.md | 5 +++++ internal/grpc/interceptors/eventsmiddleware/conversion.go | 3 +++ .../grpc/services/publicshareprovider/publicshareprovider.go | 1 + pkg/events/sharing.go | 1 + 4 files changed, 10 insertions(+) create mode 100644 changelog/unreleased/linkremoved-itemid.md diff --git a/changelog/unreleased/linkremoved-itemid.md b/changelog/unreleased/linkremoved-itemid.md new file mode 100644 index 0000000000..635222948d --- /dev/null +++ b/changelog/unreleased/linkremoved-itemid.md @@ -0,0 +1,5 @@ +Enhancement: Add ItemID to LinkRemoved + +Add itemID to linkremoved response and event + +https://github.com/cs3org/reva/pull/4645 diff --git a/internal/grpc/interceptors/eventsmiddleware/conversion.go b/internal/grpc/interceptors/eventsmiddleware/conversion.go index 1a123f1ca9..87ee14af57 100644 --- a/internal/grpc/interceptors/eventsmiddleware/conversion.go +++ b/internal/grpc/interceptors/eventsmiddleware/conversion.go @@ -179,11 +179,14 @@ func LinkAccessFailed(r *link.GetPublicShareByTokenResponse, req *link.GetPublic // LinkRemoved converts the response to an event func LinkRemoved(r *link.RemovePublicShareResponse, req *link.RemovePublicShareRequest, executant *user.UserId) events.LinkRemoved { + var rid *provider.ResourceId + _ = utils.ReadJSONFromOpaque(r.Opaque, "resourceid", &rid) return events.LinkRemoved{ Executant: executant, ShareID: req.Ref.GetId(), ShareToken: req.Ref.GetToken(), Timestamp: utils.TSNow(), + ItemID: rid, } } diff --git a/internal/grpc/services/publicshareprovider/publicshareprovider.go b/internal/grpc/services/publicshareprovider/publicshareprovider.go index 4879d7caf4..0c740f3668 100644 --- a/internal/grpc/services/publicshareprovider/publicshareprovider.go +++ b/internal/grpc/services/publicshareprovider/publicshareprovider.go @@ -372,6 +372,7 @@ func (s *service) RemovePublicShare(ctx context.Context, req *link.RemovePublicS }, err } return &link.RemovePublicShareResponse{ + Opaque: utils.AppendJSONToOpaque(nil, "resourceid", ps.GetResourceId()), Status: status.NewOK(ctx), }, nil } diff --git a/pkg/events/sharing.go b/pkg/events/sharing.go index 77c7f04bed..6c438d5dba 100644 --- a/pkg/events/sharing.go +++ b/pkg/events/sharing.go @@ -223,6 +223,7 @@ type LinkRemoved struct { ShareID *link.PublicShareId ShareToken string Timestamp *types.Timestamp + ItemID *provider.ResourceId } // Unmarshal to fulfill umarshaller interface