mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 15:21:00 -04:00
Improve sorting
- Extract sort logic into a separate function - Sort non-core parameters with localeCompare Signed-off-by: Christopher Ng <chrng8@gmail.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
parent
68fecc1d9f
commit
697a6935a4
3 changed files with 16 additions and 6 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -53,6 +53,16 @@ import { PROFILE_READABLE_ENUM } from '../../../constants/AccountPropertyConstan
|
|||
const { profileConfig } = loadState('settings', 'profileParameters', {})
|
||||
const { profileEnabled } = loadState('settings', 'personalInfoParameters', false)
|
||||
|
||||
const compareParams = (a, b) => {
|
||||
if (a.appId === b.appId || (a.appId !== 'core' && b.appId !== 'core')) {
|
||||
return a.displayId.localeCompare(b.displayId)
|
||||
} else if (a.appId === 'core') {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'ProfileVisibilitySection',
|
||||
|
||||
|
|
@ -67,7 +77,7 @@ export default {
|
|||
profileEnabled,
|
||||
visibilityParams: Object.entries(profileConfig)
|
||||
.map(([paramId, { appId, displayId, visibility }]) => ({ id: paramId, appId, displayId, visibility }))
|
||||
.sort((a, b) => a.appId === b.appId ? a.displayId.localeCompare(b.displayId) : (a.appId !== 'core' ? -1 : 1)),
|
||||
.sort(compareParams),
|
||||
// TODO remove this when not used once the settings layout is updated
|
||||
marginLeft: window.getComputedStyle(document.getElementById('personal-settings-avatar-container')).getPropertyValue('width').trim(),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue