Skip to content

Commit 6a44b08

Browse files
committed
Fix user profile permissions growing bug
Fixes bug where repeatedly opening mutation menu while on user profile view would cause duplicate dummy mutations to be added to the "authorised operations" field
1 parent da2c095 commit 6a44b08

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/utils/aotf.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,14 @@ export function getIntrospectionQuery () {
611611
*/
612612
export function filterAssociations (cylcObject, tokens, mutations, permissions) {
613613
const ret = []
614-
for (const [permission, equivalents] of Object.entries(dummyMutationsPermissionsMap)) {
615-
if (permissions.includes(permission)) {
616-
permissions.push(...equivalents)
617-
}
618-
}
619-
permissions = permissions.map(x => x.toLowerCase())
614+
permissions = [
615+
...permissions.map(x => x.toLowerCase()),
616+
...Object.entries(dummyMutationsPermissionsMap).flatMap(
617+
([permission, equivalents]) => permissions.includes(permission)
618+
? equivalents.map(x => x.toLowerCase())
619+
: []
620+
),
621+
]
620622
for (const mutation of mutations) {
621623
const authorised = permissions.includes(mutation.name.toLowerCase())
622624
let requiresInfo = mutation._requiresInfo ?? false

0 commit comments

Comments
 (0)