Merge pull request #29844 from nextcloud/backport/29567/stable23

[stable23] Improve sorting of profile visibility dropdowns
This commit is contained in:
Louis 2021-11-23 14:19:42 +01:00 committed by GitHub
commit 9b0b0fc8d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

View file

@ -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(),
}