Skip to content

Commit 593efdc

Browse files
authored
Merge pull request #629 from fiji-flo/group-trust
enable group trust
2 parents ec088e6 + 289bee1 commit 593efdc

8 files changed

Lines changed: 98 additions & 9 deletions

File tree

src/assets/js/scope.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ class Scope {
3232
'group_creators' in (mozilliansorgGroups || {}) ||
3333
'group_admins' in (mozilliansorgGroups || {});
3434
}
35+
36+
hasTrust(trust) {
37+
if (this.isStaff) {
38+
return true;
39+
}
40+
if (this.isNdaed) {
41+
return trust !== 'Staff';
42+
}
43+
return trust === 'Authenticated';
44+
}
3545
}
3646

3747
export default Scope;

src/components/access_group/AccessGroupCreate.vue

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
>
5656
<template v-slot:content>
5757
<div class="content-area__row">
58-
<div
58+
<label
5959
class="radio-control"
6060
v-for="(type, idx) in groupTypes"
6161
:key="idx"
6262
>
6363
<input type="radio" :value="type" v-model="groupType" />
6464
{{ type }}
65-
</div>
65+
</label>
6666
</div>
6767
<div class="content-area__row radio-control__description">
6868
<label class="description-label">{{
@@ -82,6 +82,32 @@
8282
</div>
8383
</template>
8484
</AccessGroupEditPanel>
85+
<AccessGroupEditPanel :title="fluent('access-group_trust')">
86+
<template v-slot:content>
87+
<div class="content-area__row">
88+
<label
89+
class="radio-control"
90+
v-for="[k, trust] in groupTrustLevels"
91+
:key="k"
92+
>
93+
<input type="radio" :value="trust" v-model="groupTrust" />
94+
{{ fluent('access-group_trust', trust) }}
95+
</label>
96+
</div>
97+
<div
98+
v-for="[k, trust] in groupTrustLevels"
99+
:key="k"
100+
class="content-area__row radio-control__description"
101+
>
102+
<label class="description-label">{{
103+
fluent('access-group_trust', trust)
104+
}}</label>
105+
<p class="description-content">
106+
<Fluent id="access-group_trust" :attr="`${trust}-content`" />
107+
</p>
108+
</div>
109+
</template>
110+
</AccessGroupEditPanel>
85111
<AccessGroupEditPanel :title="fluent('access-group_expiration')">
86112
<template v-slot:content>
87113
<div class="content-area__row group-expiration">
@@ -177,6 +203,7 @@ import { ACCESS_GROUP_PAGE, ACCESS_GROUP_INDEX_PAGE } from '@/router.js';
177203
import {
178204
TYPE_INDEX,
179205
ACCESS_GROUP_TYPES,
206+
ACCESS_GROUP_TRUST,
180207
MEMBER_EXPIRATION_ONE_YEAR,
181208
} from '@/view_models/AccessGroupViewModel.js';
182209
@@ -197,10 +224,12 @@ export default {
197224
highlightError: false,
198225
groupNamePattern: '[a-z0-9\\-_]*',
199226
groupDescription: '',
227+
groupTrust: ACCESS_GROUP_TRUST.ndaed,
200228
groupType: ACCESS_GROUP_TYPES[TYPE_INDEX.closed],
201229
groupName: '',
202230
groupTermsRequiredData: false,
203231
groupTermsData: '',
232+
groupTypes: ACCESS_GROUP_TYPES.filter((type) => type !== 'Open'),
204233
selectedExpiration: MEMBER_EXPIRATION_ONE_YEAR,
205234
lastMarkdownCollapsed: true,
206235
accessGroupListRoute: ACCESS_GROUP_INDEX_PAGE,
@@ -210,8 +239,8 @@ export default {
210239
...mapGetters({
211240
loading: 'getLoading',
212241
}),
213-
groupTypes() {
214-
return ACCESS_GROUP_TYPES.filter((type) => type !== 'Open');
242+
groupTrustLevels() {
243+
return Object.entries(ACCESS_GROUP_TRUST);
215244
},
216245
},
217246
methods: {
@@ -237,6 +266,7 @@ export default {
237266
type: this.groupType,
238267
description: this.groupDescription,
239268
group_expiration: this.selectedExpiration,
269+
trust: this.groupTrust,
240270
},
241271
});
242272
this.completeLoading();
@@ -251,6 +281,7 @@ export default {
251281
this.$root.$emit('toast', {
252282
content: this.fluent('ag_api_errors', e.message),
253283
});
284+
this.completeLoading();
254285
}
255286
}
256287
},

src/components/access_group/AccessGroupDescription.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ export default {
122122
return this.isMember;
123123
},
124124
showRequest() {
125-
return this.groupInformation.group.type === 'Reviewed';
125+
return (
126+
this.groupInformation.group.type === 'Reviewed' &&
127+
this.scope.hasTrust(this.groupInformation.group.trust)
128+
);
126129
},
127130
},
128131
methods: {

src/components/access_group/AccessGroupDetails.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@
2121
)} ${groupCreatedDate}`
2222
}}
2323
</p>
24+
<p class="primary-data-row">
25+
{{
26+
`${fluent('access-group_details', 'typ')}: ${
27+
groupInformation.group.type
28+
}`
29+
}}
30+
</p>
31+
<p class="primary-data-row">
32+
{{
33+
`${fluent('access-group_details', 'trust')}: ${
34+
groupInformation.group.trust
35+
}`
36+
}}
37+
</p>
2438
</div>
2539
</template>
2640

src/components/access_group/AccessGroupInformationEdit.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@
7575
>
7676
</template>
7777
</AccessGroupEditPanel>
78+
<AccessGroupEditPanel :title="fluent('access-group_trust')">
79+
<template v-slot:content>
80+
<div class="content-area__row radio-control__description">
81+
<label class="description-label">{{
82+
fluent('access-group_trust', groupTrust)
83+
}}</label>
84+
<p class="description-content">
85+
<Fluent id="access-group_trust" :attr="`${groupTrust}-content`" />
86+
</p>
87+
</div>
88+
</template>
89+
</AccessGroupEditPanel>
7890
<AccessGroupEditPanel
7991
form="termsForm"
8092
:handler="handleTermsUpdate"
@@ -200,6 +212,10 @@ import TextArea from '@/components/ui/TextArea.vue';
200212
import Button from '@/components/ui/Button.vue';
201213
import AccessGroupEditPanel from '@/components/access_group/AccessGroupEditPanel.vue';
202214
import AccessGroupMarkdownGuide from '@/components/access_group/AccessGroupMarkdownGuide.vue';
215+
import {
216+
ACCESS_GROUP_TYPES,
217+
ACCESS_GROUP_TRUST,
218+
} from '@/view_models/AccessGroupViewModel.js';
203219
204220
export default {
205221
name: 'AccessGroupInformationEdit',
@@ -225,6 +241,8 @@ export default {
225241
groupTermsDirty: false,
226242
groupTypeData: this.groupInformation.group.type,
227243
groupTypeDirty: false,
244+
groupTypes: ACCESS_GROUP_TYPES.filter((type) => type !== 'Open'),
245+
groupTrust: this.groupInformation.group.trust,
228246
enableDelete: false,
229247
emailInviteText: '',
230248
emailInviteTextEnabled: Boolean(this.emailInviteText),

src/locales/en-US/strings.ftl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ access-group_details = Group Details
458458
.name = Group name
459459
.description = Group description
460460
.update-details = Update details
461+
.typ = Group type
462+
.trust = Trust level
461463
access-groups_membership = -
462464
.since = Joined
463465
.expires = Expires
@@ -524,6 +526,13 @@ access-group_type = Group type
524526
.closed-heading = Closed
525527
.closed-content = "Closed" groups provide more tight control over a group. Mozillians cannot request membership, and can only be invited to join the group by Group Curators. Group Curators can, of course, remove people from the group if needed. Avoid using this group type unless you are absolutely sure it is necessary.
526528
.update-type = Update type
529+
access-group_trust = Group Trust Level
530+
.Authenticated = Authenticated
531+
.Authenticated-content = Any authenticated user can be a member of this group.
532+
.Ndaed = NDA'd
533+
.Ndaed-content = One must be a ndaed Mozillian or Mozilla staff in order to be member of this group.
534+
.Staff = Staff
535+
.Staff-content = Only Mozilla staff can be a member on this group.
527536
access-group_terms = Membership terms
528537
.heading = Terms and Conditions
529538
.terms-required = New members should accept terms
@@ -610,4 +619,4 @@ ag_errors = Something is wrong :/
610619
.number_gt_0 = x > 0
611620
ag_api_errors = Something went wrong :/
612621
.invalid_group_name = Minimum length is 3, allowed characters are: a-z, 0-9, _ and -.
613-
.group_name_exists = Group name already exists
622+
.group_name_exists = Group name already exists

src/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ Promise.all([
5454
scope() {
5555
return this.$store.state.scope;
5656
},
57-
groupTypes() {
58-
return ACCESS_GROUP_TYPES.filter((type) => type !== 'Open');
59-
},
6057
},
6158
methods: {
6259
fluent(...args) {

src/view_models/AccessGroupViewModel.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ export const TYPE_INDEX = {
246246
open: 2,
247247
};
248248
export const ACCESS_GROUP_TYPES = ['Closed', 'Reviewed', 'Open'];
249+
export const ACCESS_GROUP_TRUST = {
250+
authenticated: 'Authenticated',
251+
ndaed: 'Ndaed',
252+
staff: 'Staff',
253+
};
249254

250255
export class AbbGroupViewModel {
251256
constructor(data) {
@@ -288,6 +293,7 @@ export class GroupViewModel {
288293
this.expiration = MEMBER_EXPIRATION_NONE;
289294
this.error = false;
290295
this.created = '';
296+
this.trust = '';
291297
this.processData(data);
292298
}
293299

@@ -300,6 +306,7 @@ export class GroupViewModel {
300306
this.terms = data.terms;
301307
this.expiration = data.expiration;
302308
this.created = data.created;
309+
this.trust = data.trust;
303310
} catch (e) {
304311
this.error = e.message;
305312
console.error('Group data error: ', e.message);

0 commit comments

Comments
 (0)