Skip to content

Commit

Permalink
[PM-16194] Do not sort Favorite ciphers by last used date (#12466)
Browse files Browse the repository at this point in the history
* [PM-16194] Do not sort Favorite ciphers by last used date

* [PM-16194] Remove test
  • Loading branch information
shane-melton authored Dec 19, 2024
1 parent fff4126 commit 69d42a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,6 @@ describe("VaultPopupItemsService", () => {
});
});

it("should sort by last used then by name", (done) => {
service.favoriteCiphers$.subscribe((ciphers) => {
expect(cipherServiceMock.sortCiphersByLastUsedThenName).toHaveBeenCalled();
done();
});
});

it("should filter favoriteCiphers$ down to search term", (done) => {
const cipherList = Object.values(allCiphers);
const searchText = "Card 2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,13 @@ export class VaultPopupItemsService {

/**
* List of favorite ciphers that are not currently suggested for autofill.
* Ciphers are sorted by last used date, then by name.
* Ciphers are sorted by name.
*/
favoriteCiphers$: Observable<PopupCipherView[]> = this.autoFillCiphers$.pipe(
withLatestFrom(this._filteredCipherList$),
map(([autoFillCiphers, ciphers]) =>
ciphers.filter((cipher) => cipher.favorite && !autoFillCiphers.includes(cipher)),
),
map((ciphers) =>
ciphers.sort((a, b) => this.cipherService.sortCiphersByLastUsedThenName(a, b)),
),
shareReplay({ refCount: false, bufferSize: 1 }),
);

Expand Down

0 comments on commit 69d42a7

Please sign in to comment.