Skip to content

Commit 173a0a9

Browse files
have ShareManyAsync return CipherDetails
1 parent fed12d7 commit 173a0a9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Api/Vault/Controllers/CiphersController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutShareMany([From
10861086
}
10871087
}
10881088

1089-
var shareCiphers = new List<(Cipher, DateTime?)>();
1089+
var shareCiphers = new List<(CipherDetails, DateTime?)>();
10901090
foreach (var cipher in model.Ciphers)
10911091
{
10921092
if (!ciphersDict.TryGetValue(cipher.Id.Value, out var existingCipher))
@@ -1096,7 +1096,7 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutShareMany([From
10961096

10971097
ValidateClientVersionForFido2CredentialSupport(existingCipher);
10981098

1099-
shareCiphers.Add((cipher.ToCipher(existingCipher), cipher.LastKnownRevisionDate));
1099+
shareCiphers.Add((cipher.ToCipherDetails(existingCipher), cipher.LastKnownRevisionDate));
11001100
}
11011101

11021102
var updated = await _cipherService.ShareManyAsync(
@@ -1106,7 +1106,7 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutShareMany([From
11061106
userId
11071107
);
11081108

1109-
var response = updated.Select(c => new CipherMiniResponseModel(c, _globalSettings, false));
1109+
var response = updated.Select(c => new CipherMiniResponseModel(c, _globalSettings, c.OrganizationUseTotp));
11101110
return new ListResponseModel<CipherMiniResponseModel>(response);
11111111
}
11121112

src/Core/Vault/Services/ICipherService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Task CreateAttachmentShareAsync(Cipher cipher, Stream stream, string fileName, s
2424
Task DeleteFolderAsync(Folder folder);
2525
Task ShareAsync(Cipher originalCipher, Cipher cipher, Guid organizationId, IEnumerable<Guid> collectionIds,
2626
Guid userId, DateTime? lastKnownRevisionDate);
27-
Task<IEnumerable<Cipher>> ShareManyAsync(IEnumerable<(Cipher cipher, DateTime? lastKnownRevisionDate)> ciphers, Guid organizationId,
27+
Task<IEnumerable<CipherDetails>> ShareManyAsync(IEnumerable<(CipherDetails cipher, DateTime? lastKnownRevisionDate)> ciphers, Guid organizationId,
2828
IEnumerable<Guid> collectionIds, Guid sharingUserId);
2929
Task SaveCollectionsAsync(Cipher cipher, IEnumerable<Guid> collectionIds, Guid savingUserId, bool orgAdmin);
3030
Task SoftDeleteAsync(CipherDetails cipherDetails, Guid deletingUserId, bool orgAdmin = false);

src/Core/Vault/Services/Implementations/CipherService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ await _attachmentStorageService.RollbackShareAttachmentAsync(cipher.Id, organiza
625625
await _pushService.PushSyncCipherUpdateAsync(cipher, collectionIds);
626626
}
627627

628-
public async Task<IEnumerable<Cipher>> ShareManyAsync(IEnumerable<(Cipher cipher, DateTime? lastKnownRevisionDate)> cipherInfos,
628+
public async Task<IEnumerable<CipherDetails>> ShareManyAsync(IEnumerable<(CipherDetails cipher, DateTime? lastKnownRevisionDate)> cipherInfos,
629629
Guid organizationId, IEnumerable<Guid> collectionIds, Guid sharingUserId)
630630
{
631631
var cipherIds = new List<Guid>();

test/Api.Test/Vault/Controllers/CiphersControllerTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,8 @@ public async Task PutShareMany_ShouldShareCiphersAndReturnRevisionDateMap(
17831783

17841784
var newDate1 = oldDate1.AddMinutes(5);
17851785
var newDate2 = oldDate2.AddMinutes(5);
1786-
var updatedCipher1 = new Cipher { Id = detail1.Id, RevisionDate = newDate1, Type = detail1.Type, Data = detail1.Data };
1787-
var updatedCipher2 = new Cipher { Id = detail2.Id, RevisionDate = newDate2, Type = detail2.Type, Data = detail2.Data };
1786+
var updatedCipher1 = new CipherDetails { Id = detail1.Id, RevisionDate = newDate1, Type = detail1.Type, Data = detail1.Data };
1787+
var updatedCipher2 = new CipherDetails { Id = detail2.Id, RevisionDate = newDate2, Type = detail2.Type, Data = detail2.Data };
17881788

17891789
sutProvider.GetDependency<ICurrentContext>()
17901790
.OrganizationUser(organizationId)
@@ -1802,12 +1802,12 @@ public async Task PutShareMany_ShouldShareCiphersAndReturnRevisionDateMap(
18021802

18031803
sutProvider.GetDependency<ICipherService>()
18041804
.ShareManyAsync(
1805-
Arg.Any<IEnumerable<(Cipher, DateTime?)>>(),
1805+
Arg.Any<IEnumerable<(CipherDetails, DateTime?)>>(),
18061806
organizationId,
18071807
Arg.Any<IEnumerable<Guid>>(),
18081808
userId
18091809
)
1810-
.Returns(Task.FromResult<IEnumerable<Cipher>>(new[] { updatedCipher1, updatedCipher2 }));
1810+
.Returns(Task.FromResult<IEnumerable<CipherDetails>>(new[] { updatedCipher1, updatedCipher2 }));
18111811

18121812
var cipherRequests = preloadedDetails.Select(d =>
18131813
{

0 commit comments

Comments
 (0)