{getLangText('Are you sure you would like to permanently delete this piece')}?
{getLangText('This is an irrevocable action%s', '.')}
diff --git a/js/utils/acl_utils.js b/js/utils/acl_utils.js index a3998576..fc3987c1 100644 --- a/js/utils/acl_utils.js +++ b/js/utils/acl_utils.js @@ -1,10 +1,6 @@ 'use strict'; -import { sanitize } from './general_utils'; - -export function intersectAcls(a, b) { - return a.filter((val) => b.indexOf(val) > -1); -} +import { sanitize, intersectLists } from './general_utils'; export function getAvailableAcls(editions, filterFn) { let availableAcls = []; @@ -44,7 +40,7 @@ export function getAvailableAcls(editions, filterFn) { } if(editionsCopy.length >= 2) { for(let i = 1; i < editionsCopy.length; i++) { - availableAcls = intersectAcls(availableAcls, editionsCopy[i].acl); + availableAcls = intersectLists(availableAcls, editionsCopy[i].acl); } } diff --git a/js/utils/general_utils.js b/js/utils/general_utils.js index af4cb752..fb1a71fa 100644 --- a/js/utils/general_utils.js +++ b/js/utils/general_utils.js @@ -242,4 +242,14 @@ export function getSubdomain() { let { host } = window.location; let tokens = host.split('.'); return tokens.length > 2 ? tokens[0] : 'www'; +} + +/** + * Takes two lists and returns their intersection as a list + * @param {Array} a + * @param {Array} b + * @return {[Array]} Intersected list of a and b + */ +export function intersectLists(a, b) { + return a.filter((val) => b.indexOf(val) > -1); } \ No newline at end of file