Skip to content

Commit 027adfd

Browse files
committed
Add new profile visibility section
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent 43878e0 commit 027adfd

12 files changed

Lines changed: 51 additions & 123 deletions

File tree

apps/settings/src/components/PersonalInfo/BiographySection/BiographySection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
<Biography
3131
:biography.sync="primaryBiography.value"
3232
:scope.sync="primaryBiography.scope" />
33-
34-
<VisibilityDropdown
35-
:param-id="accountPropertyId"
36-
:display-id="accountProperty"
37-
:visibility.sync="visibility" />
3833
</section>
3934
</template>
4035

@@ -43,28 +38,23 @@ import { loadState } from '@nextcloud/initial-state'
4338
4439
import Biography from './Biography'
4540
import HeaderBar from '../shared/HeaderBar'
46-
import VisibilityDropdown from '../shared/VisibilityDropdown'
4741
48-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
42+
import { ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
4943
5044
const { biographyMap: { primaryBiography } } = loadState('settings', 'personalInfoParameters', {})
51-
const { profileConfig: { biography: { visibility } } } = loadState('settings', 'profileParameters', {})
5245
5346
export default {
5447
name: 'BiographySection',
5548
5649
components: {
5750
Biography,
5851
HeaderBar,
59-
VisibilityDropdown,
6052
},
6153
6254
data() {
6355
return {
6456
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.BIOGRAPHY,
65-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.BIOGRAPHY,
6657
primaryBiography,
67-
visibility,
6858
}
6959
},
7060
}

apps/settings/src/components/PersonalInfo/DisplayNameSection/DisplayNameSection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
<DisplayName
3434
:display-name.sync="primaryDisplayName.value"
3535
:scope.sync="primaryDisplayName.scope" />
36-
37-
<VisibilityDropdown
38-
:param-id="accountPropertyId"
39-
:display-id="accountProperty"
40-
:visibility.sync="visibility" />
4136
</template>
4237

4338
<span v-else>
@@ -51,31 +46,26 @@ import { loadState } from '@nextcloud/initial-state'
5146
5247
import DisplayName from './DisplayName'
5348
import HeaderBar from '../shared/HeaderBar'
54-
import VisibilityDropdown from '../shared/VisibilityDropdown'
5549
56-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
50+
import { ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
5751
import { validateStringInput } from '../../../utils/validate'
5852
5953
const { displayNameMap: { primaryDisplayName } } = loadState('settings', 'personalInfoParameters', {})
6054
const { displayNameChangeSupported } = loadState('settings', 'accountParameters', {})
61-
const { profileConfig: { displayname: { visibility } } } = loadState('settings', 'profileParameters', {})
6255
6356
export default {
6457
name: 'DisplayNameSection',
6558
6659
components: {
6760
DisplayName,
6861
HeaderBar,
69-
VisibilityDropdown,
7062
},
7163
7264
data() {
7365
return {
7466
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.DISPLAYNAME,
75-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.DISPLAYNAME,
7667
displayNameChangeSupported,
7768
primaryDisplayName,
78-
visibility,
7969
}
8070
},
8171

apps/settings/src/components/PersonalInfo/EmailSection/EmailSection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
:active-notification-email.sync="notificationEmail"
4141
@update:email="onUpdateEmail"
4242
@update:notification-email="onUpdateNotificationEmail" />
43-
44-
<VisibilityDropdown
45-
:param-id="accountPropertyId"
46-
:display-id="accountProperty"
47-
:visibility.sync="visibility" />
4843
</template>
4944

5045
<span v-else>
@@ -73,35 +68,30 @@ import { showError } from '@nextcloud/dialogs'
7368
7469
import Email from './Email'
7570
import HeaderBar from '../shared/HeaderBar'
76-
import VisibilityDropdown from '../shared/VisibilityDropdown'
7771
78-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM, DEFAULT_ADDITIONAL_EMAIL_SCOPE } from '../../../constants/AccountPropertyConstants'
72+
import { ACCOUNT_PROPERTY_READABLE_ENUM, DEFAULT_ADDITIONAL_EMAIL_SCOPE } from '../../../constants/AccountPropertyConstants'
7973
import { savePrimaryEmail, savePrimaryEmailScope, removeAdditionalEmail } from '../../../service/PersonalInfo/EmailService'
8074
import { validateEmail } from '../../../utils/validate'
8175
8276
const { emailMap: { additionalEmails, primaryEmail, notificationEmail } } = loadState('settings', 'personalInfoParameters', {})
8377
const { displayNameChangeSupported } = loadState('settings', 'accountParameters', {})
84-
const { profileConfig: { email: { visibility } } } = loadState('settings', 'profileParameters', {})
8578
8679
export default {
8780
name: 'EmailSection',
8881
8982
components: {
9083
HeaderBar,
9184
Email,
92-
VisibilityDropdown,
9385
},
9486
9587
data() {
9688
return {
9789
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL,
98-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.EMAIL,
9990
additionalEmails,
10091
displayNameChangeSupported,
10192
primaryEmail,
10293
savePrimaryEmailScope,
10394
notificationEmail,
104-
visibility,
10595
}
10696
},
10797

apps/settings/src/components/PersonalInfo/HeadlineSection/HeadlineSection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
<Headline
3131
:headline.sync="primaryHeadline.value"
3232
:scope.sync="primaryHeadline.scope" />
33-
34-
<VisibilityDropdown
35-
:param-id="accountPropertyId"
36-
:display-id="accountProperty"
37-
:visibility.sync="visibility" />
3833
</section>
3934
</template>
4035

@@ -43,28 +38,23 @@ import { loadState } from '@nextcloud/initial-state'
4338
4439
import Headline from './Headline'
4540
import HeaderBar from '../shared/HeaderBar'
46-
import VisibilityDropdown from '../shared/VisibilityDropdown'
4741
48-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
42+
import { ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
4943
5044
const { headlineMap: { primaryHeadline } } = loadState('settings', 'personalInfoParameters', {})
51-
const { profileConfig: { headline: { visibility } } } = loadState('settings', 'profileParameters', {})
5245
5346
export default {
5447
name: 'HeadlineSection',
5548
5649
components: {
5750
Headline,
5851
HeaderBar,
59-
VisibilityDropdown,
6052
},
6153
6254
data() {
6355
return {
6456
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.HEADLINE,
65-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.HEADLINE,
6657
primaryHeadline,
67-
visibility,
6858
}
6959
},
7060
}

apps/settings/src/components/PersonalInfo/OrganisationSection/OrganisationSection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
<Organisation
3131
:organisation.sync="primaryOrganisation.value"
3232
:scope.sync="primaryOrganisation.scope" />
33-
34-
<VisibilityDropdown
35-
:param-id="accountPropertyId"
36-
:display-id="accountProperty"
37-
:visibility.sync="visibility" />
3833
</section>
3934
</template>
4035

@@ -43,28 +38,23 @@ import { loadState } from '@nextcloud/initial-state'
4338
4439
import Organisation from './Organisation'
4540
import HeaderBar from '../shared/HeaderBar'
46-
import VisibilityDropdown from '../shared/VisibilityDropdown'
4741
48-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
42+
import { ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
4943
5044
const { organisationMap: { primaryOrganisation } } = loadState('settings', 'personalInfoParameters', {})
51-
const { profileConfig: { organisation: { visibility } } } = loadState('settings', 'profileParameters', {})
5245
5346
export default {
5447
name: 'OrganisationSection',
5548
5649
components: {
5750
Organisation,
5851
HeaderBar,
59-
VisibilityDropdown,
6052
},
6153
6254
data() {
6355
return {
6456
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.ORGANISATION,
65-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.ORGANISATION,
6657
primaryOrganisation,
67-
visibility,
6858
}
6959
},
7060
}

apps/settings/src/components/PersonalInfo/ProfileVisibilitySection/ProfileVisibilitySection.vue

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@
2525
<HeaderBar
2626
:account-property="heading" />
2727

28-
<VisibilityDropdown v-for="parameter in visibilityArray"
29-
:key="parameter.id"
30-
:param-id="parameter.id"
31-
:display-id="parameter.displayId"
32-
:show-display-id="true"
33-
:visibility.sync="parameter.visibility" />
34-
35-
<em :class="{ disabled }">{{ t('settings', 'The more restrictive setting of either visibility or scope is respected on your Profile — For example, when visibility is set to "Show to everyone" and scope is set to "Private", "Private" will be respected') }}</em>
28+
<em :class="{ disabled }">
29+
{{ t('settings', 'The more restrictive setting of either visibility or scope is respected on your Profile. For example, if visibility is set to "Show to everyone" and scope is set to "Private", "Private" is respected.') }}
30+
</em>
31+
32+
<div class="visibility-dropdowns">
33+
<VisibilityDropdown v-for="param in visibilityArray"
34+
:key="param.id"
35+
:param-id="param.id"
36+
:display-id="param.displayId"
37+
:visibility.sync="param.visibility" />
38+
</div>
3639
</section>
3740
</template>
3841

@@ -42,7 +45,7 @@ import { subscribe, unsubscribe } from '@nextcloud/event-bus'
4245
4346
import HeaderBar from '../shared/HeaderBar'
4447
import VisibilityDropdown from '../shared/VisibilityDropdown'
45-
import { ACCOUNT_PROPERTY_ENUM, PROFILE_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
48+
import { PROFILE_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
4649
4750
const { profileConfig } = loadState('settings', 'profileParameters', {})
4851
const { profileEnabled } = loadState('settings', 'personalInfoParameters', false)
@@ -60,9 +63,8 @@ export default {
6063
heading: PROFILE_READABLE_ENUM.PROFILE_VISIBILITY,
6164
profileEnabled,
6265
visibilityArray: Object.entries(profileConfig)
63-
// Filter for profile parameters registered by apps in this section as visibility controls for the rest (account properties) are handled in their respective property sections
64-
.filter(([paramId, { displayId, visibility }]) => !Object.values(ACCOUNT_PROPERTY_ENUM).includes(paramId))
65-
.map(([paramId, { displayId, visibility }]) => ({ id: paramId, displayId, visibility })),
66+
.map(([paramId, { appId, displayId, visibility }]) => ({ id: paramId, appId, displayId, visibility }))
67+
.sort((a, b) => a.appId === b.appId ? a.displayId.localeCompare(b.displayId) : (a.appId !== 'core' ? -1 : 1)),
6668
}
6769
},
6870
@@ -91,10 +93,11 @@ export default {
9193
<style lang="scss" scoped>
9294
section {
9395
padding: 10px 10px;
96+
width: 980px;
9497
9598
em {
9699
display: block;
97-
margin-top: 16px;
100+
margin: 16px 0;
98101
99102
&.disabled {
100103
filter: grayscale(1);
@@ -110,6 +113,14 @@ section {
110113
}
111114
}
112115
116+
.visibility-dropdowns {
117+
display: grid;
118+
grid-auto-flow: column;
119+
grid-template-rows: repeat(auto-fit, 44px);
120+
height: 350px;
121+
gap: 10px 80px;
122+
}
123+
113124
&::v-deep button:disabled {
114125
cursor: default;
115126
}

apps/settings/src/components/PersonalInfo/RoleSection/RoleSection.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
<Role
3131
:role.sync="primaryRole.value"
3232
:scope.sync="primaryRole.scope" />
33-
34-
<VisibilityDropdown
35-
:param-id="accountPropertyId"
36-
:display-id="accountProperty"
37-
:visibility.sync="visibility" />
3833
</section>
3934
</template>
4035

@@ -43,28 +38,23 @@ import { loadState } from '@nextcloud/initial-state'
4338
4439
import Role from './Role'
4540
import HeaderBar from '../shared/HeaderBar'
46-
import VisibilityDropdown from '../shared/VisibilityDropdown'
4741
48-
import { ACCOUNT_PROPERTY_ENUM, ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
42+
import { ACCOUNT_PROPERTY_READABLE_ENUM } from '../../../constants/AccountPropertyConstants'
4943
5044
const { roleMap: { primaryRole } } = loadState('settings', 'personalInfoParameters', {})
51-
const { profileConfig: { role: { visibility } } } = loadState('settings', 'profileParameters', {})
5245
5346
export default {
5447
name: 'RoleSection',
5548
5649
components: {
5750
Role,
5851
HeaderBar,
59-
VisibilityDropdown,
6052
},
6153
6254
data() {
6355
return {
6456
accountProperty: ACCOUNT_PROPERTY_READABLE_ENUM.ROLE,
65-
accountPropertyId: ACCOUNT_PROPERTY_ENUM.ROLE,
6657
primaryRole,
67-
visibility,
6858
}
6959
},
7060
}

0 commit comments

Comments
 (0)