1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

Add is sponsored item to subscription response

This commit is contained in:
Matt Gibson
2021-11-10 18:05:31 -05:00
committed by Justin Baur
parent 3d28ae1547
commit be6ab1883c
5 changed files with 14 additions and 6 deletions

View File

@ -158,10 +158,15 @@ namespace Bit.Api.Controllers
var existingOrgSponsorship = await _organizationSponsorshipRepository
.GetBySponsoringOrganizationUserIdAsync(orgUser.Id);
if (existingOrgSponsorship == null || existingOrgSponsorship.SponsoredOrganizationId == null)
if (existingOrgSponsorship == null)
{
throw new BadRequestException("You are not currently sponsoring an organization.");
}
if (existingOrgSponsorship.SponsoredOrganizationId == null)
{
await _organizationSponsorshipRepository.DeleteAsync(existingOrgSponsorship);
return;
}
var sponsoredOrganization = await _organizationRepository
.GetByIdAsync(existingOrgSponsorship.SponsoredOrganizationId.Value);