Skip to content

Commit

Permalink
Merge pull request #5031 from 2403905/issue-10813
Browse files Browse the repository at this point in the history
Allow to accepted invite after it was once deleted
  • Loading branch information
2403905 authored Jan 8, 2025
2 parents 2f48e2c + 50edf91 commit 9d64adf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/ocm-accept-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Allow to accepted invite after it was once deleted

Allowed to accepted invite even after it was once deleted on the invite receiver or invite creation side.

https://github.com/cs3org/reva/pull/5031
https://github.com/owncloud/ocis/issues/10813
16 changes: 8 additions & 8 deletions internal/grpc/services/ocminvitemanager/ocminvitemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ func (s *service) ForwardInvite(ctx context.Context, req *invitepb.ForwardInvite
Mail: remoteUser.Email,
DisplayName: remoteUser.Name,
}); err != nil {
if !errors.Is(err, invite.ErrUserAlreadyAccepted) {
// skip error if user was already accepted
if errors.Is(err, invite.ErrUserAlreadyAccepted) {
return &invitepb.ForwardInviteResponse{
Status: status.NewInternal(ctx, err.Error()),
Status: status.NewAlreadyExists(ctx, err, err.Error()),
}, nil
}
return &invitepb.ForwardInviteResponse{
Status: status.NewInternal(ctx, err.Error()),
}, nil
}

return &invitepb.ForwardInviteResponse{
Expand Down Expand Up @@ -276,14 +278,12 @@ func (s *service) AcceptInvite(ctx context.Context, req *invitepb.AcceptInviteRe
remoteUser := req.GetRemoteUser()

if err := s.repo.AddRemoteUser(ctx, token.GetUserId(), remoteUser); err != nil {
if errors.Is(err, invite.ErrUserAlreadyAccepted) {
if !errors.Is(err, invite.ErrUserAlreadyAccepted) {
// skip error if user was already accepted
return &invitepb.AcceptInviteResponse{
Status: status.NewAlreadyExists(ctx, err, err.Error()),
Status: status.NewInternal(ctx, err.Error()),
}, nil
}
return &invitepb.AcceptInviteResponse{
Status: status.NewInternal(ctx, err.Error()),
}, nil
}

return &invitepb.AcceptInviteResponse{
Expand Down

0 comments on commit 9d64adf

Please sign in to comment.