Commit cbc5f9af authored by kushalpandya's avatar kushalpandya

Avoid hard-coded access level index

parent 9d0ccc54
...@@ -10,3 +10,5 @@ export const LEVEL_TYPES = { ...@@ -10,3 +10,5 @@ export const LEVEL_TYPES = {
USER: 'user', USER: 'user',
GROUP: 'group', GROUP: 'group',
}; };
export const ACCESS_LEVEL_NONE = 0;
/* eslint-disable no-param-reassign, no-underscore-dangle, class-methods-use-this */ /* eslint-disable no-param-reassign, no-underscore-dangle, class-methods-use-this */
/* global Flash */ /* global Flash */
import { ACCESS_LEVELS, LEVEL_TYPES } from './'; import { ACCESS_LEVELS, LEVEL_TYPES, ACCESS_LEVEL_NONE } from './';
export default class ProtectedTagAccessDropdown { export default class ProtectedTagAccessDropdown {
constructor(options) { constructor(options) {
...@@ -26,7 +26,7 @@ export default class ProtectedTagAccessDropdown { ...@@ -26,7 +26,7 @@ export default class ProtectedTagAccessDropdown {
if (ACCESS_LEVELS.CREATE === this.accessLevel) { if (ACCESS_LEVELS.CREATE === this.accessLevel) {
this.isAllowedToCreateDropdown = true; this.isAllowedToCreateDropdown = true;
this.noOneObj = this.accessLevelsData[2]; this.noOneObj = this.accessLevelsData.find(level => level.id === ACCESS_LEVEL_NONE);
} }
this.initDropdown(); this.initDropdown();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment