-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sidepanel not replicating sidebar sort preference (#33986)
- Loading branch information
1 parent
c7bca10
commit 8688bcd
Showing
5 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@rocket.chat/meteor': patch | ||
--- | ||
|
||
Fixes sidepanel not replicating sidebar sort preference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { mockAppRoot } from '@rocket.chat/mock-providers'; | ||
import { renderHook } from '@testing-library/react'; | ||
|
||
import { useSortQueryOptions } from './useSortQueryOptions'; | ||
|
||
it("should return query option to sort by last message when user preference is 'activity'", () => { | ||
const { result } = renderHook(() => useSortQueryOptions(), { | ||
legacyRoot: true, | ||
wrapper: mockAppRoot().withUserPreference('sidebarSortby', 'activity').build(), | ||
}); | ||
expect(result.current.sort).toHaveProperty('lm', -1); | ||
}); | ||
|
||
it("should return query option to sort by name when user preference is 'name'", () => { | ||
const { result } = renderHook(() => useSortQueryOptions(), { | ||
legacyRoot: true, | ||
wrapper: mockAppRoot().withUserPreference('sidebarSortby', 'name').build(), | ||
}); | ||
expect(result.current.sort).toHaveProperty('lowerCaseName', 1); | ||
}); | ||
|
||
it("should return query option to sort by fname when user preference is 'name' and showRealName is true", () => { | ||
const { result } = renderHook(() => useSortQueryOptions(), { | ||
legacyRoot: true, | ||
wrapper: mockAppRoot().withUserPreference('sidebarSortby', 'name').withSetting('UI_Use_Real_Name', true).build(), | ||
}); | ||
expect(result.current.sort).toHaveProperty('lowerCaseFName', 1); | ||
}); |
2 changes: 1 addition & 1 deletion
2
...client/sidebarv2/hooks/useQueryOptions.ts → ...eteor/client/hooks/useSortQueryOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters