diff --git a/API/Controller/Shares/UserShares/Invites.cs b/API/Controller/Shares/UserShares/Invites.cs index e4ca2c36..3e5f74c6 100644 --- a/API/Controller/Shares/UserShares/Invites.cs +++ b/API/Controller/Shares/UserShares/Invites.cs @@ -122,7 +122,13 @@ public async Task RedeemInvite([FromRoute] Guid inviteId, [FromSe .FirstOrDefaultAsync(x => x.Id == inviteId && (x.RecipientUserId == null || x.RecipientUserId == CurrentUser.Id)); if (shareRequest is null) return Problem(ShareError.ShareRequestNotFound); - + + var isShareOwner = shareRequest.OwnerId == CurrentUser.Id; + if (isShareOwner) + { + return Problem(ShareError.ShareRequestCreateCannotShareWithSelf); + } + var alreadySharedShockers = await _db.UserShares.Where(x => x.Shocker.Device.Owner.Id == shareRequest.OwnerId && x.SharedWithUserId == CurrentUser.Id).ToListAsync(); foreach (var shareInvitationShocker in shareRequest.ShockerMappings)