Skip to content

Commit

Permalink
Merge pull request #4645 from kobergj/RemoveLinkItemID
Browse files Browse the repository at this point in the history
LinkRemoved ItemID
  • Loading branch information
kobergj authored Apr 19, 2024
2 parents f30ce62 + e488d26 commit 8a636c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/linkremoved-itemid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add ItemID to LinkRemoved

Add itemID to linkremoved response and event

https://github.com/cs3org/reva/pull/4645
3 changes: 3 additions & 0 deletions internal/grpc/interceptors/eventsmiddleware/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions pkg/events/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ type LinkRemoved struct {
ShareID *link.PublicShareId
ShareToken string
Timestamp *types.Timestamp
ItemID *provider.ResourceId
}

// Unmarshal to fulfill umarshaller interface
Expand Down

0 comments on commit 8a636c8

Please sign in to comment.