File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed
jsapp/js/components/permissions Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
CHECKBOX_NAMES ,
18
18
CHECKBOX_PERM_PAIRS ,
19
19
PARTIAL_IMPLIED_CHECKBOX_PAIRS ,
20
+ CHECKBOX_LABELS ,
20
21
} from './permConstants' ;
21
22
import type {
22
23
CheckboxNameAll ,
@@ -27,7 +28,7 @@ import type {
27
28
import type { AssignablePermsMap } from './sharingForm.component' ;
28
29
import type { PermissionBase } from 'js/dataInterface' ;
29
30
import userExistence from 'js/users/userExistence.store' ;
30
- import { getPartialByUsersListName , getCheckboxLabel } from './utils' ;
31
+ import { getPartialByUsersListName } from './utils' ;
31
32
32
33
const PARTIAL_PLACEHOLDER = t ( 'Enter usernames separated by comma' ) ;
33
34
const USERNAMES_SEPARATOR = ',' ;
@@ -513,7 +514,7 @@ export default class UserAssetPermsEditor extends React.Component<
513
514
checked = { this . state [ checkboxName ] }
514
515
disabled = { isDisabled }
515
516
onChange = { this . onCheckboxChange . bind ( this , checkboxName ) }
516
- label = { getCheckboxLabel ( checkboxName ) }
517
+ label = { CHECKBOX_LABELS [ checkboxName ] }
517
518
/>
518
519
) ;
519
520
}
Original file line number Diff line number Diff line change @@ -256,17 +256,6 @@ export function getCheckboxNameByPermission(
256
256
return found ;
257
257
}
258
258
259
- /**
260
- * A wrapper function for getting item from `CHECKBOX_LABELS`. If anything goes
261
- * awry, we will return checkbox name as fallback.
262
- */
263
- export function getCheckboxLabel ( checkboxName : CheckboxNameAll ) {
264
- if ( checkboxName in CHECKBOX_LABELS ) {
265
- return CHECKBOX_LABELS [ checkboxName ] ;
266
- }
267
- return checkboxName ;
268
- }
269
-
270
259
/** Detects if partial permissions is of "by users" kind */
271
260
export function isPartialByUsers ( perm : UserPerm ) {
272
261
// TODO for now this only checks if this is partial permission, as there is
@@ -296,8 +285,8 @@ export function getPermLabel(perm: UserPerm) {
296
285
if ( permDef ) {
297
286
const checkboxName = getCheckboxNameByPermission ( permDef . codename ) ;
298
287
299
- if ( checkboxName && checkboxName in CHECKBOX_LABELS ) {
300
- return getCheckboxLabel ( checkboxName ) ;
288
+ if ( checkboxName ) {
289
+ return CHECKBOX_LABELS [ checkboxName ] ;
301
290
}
302
291
}
303
292
You can’t perform that action at this time.
0 commit comments