Skip to content

Commit 4cab3bc

Browse files
committed
fix: Fix chooseRole so it respects the suggestion
1 parent ba16235 commit 4cab3bc

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/actions/util/choose-roles.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ async function chooseRoles (blueprint, suggested = '$authenticated') {
2323
})
2424

2525
if (cats.length === 0) {
26-
console.log(c.bold(`No roles chosen, defaulting to ${c.cyan(roles[1].label)}`))
27-
cats.push(roles[1].label)
26+
const r = roles.find(r => r.name === suggested).label
27+
console.log(c.bold(`No roles chosen, defaulting to ${c.cyan(r)}`))
28+
cats.push(r)
2829
}
2930

3031
return roles

test/fixtures/add-search-doc/expected/one-model/search-docs/pizza.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"activeEvent": "false::boolean",
1515
"author": "'pizza'::text",
1616
"teams": "NULL::text[]",
17-
"roles": "'{\"$authenticated\"}'::text[]",
17+
"roles": "'{\"$everyone\"}'::text[]",
1818
"tags": "NULL::text[]",
1919
"language": "'ENG'::text",
2020
"rootAncestorId": "NULL::text",

test/fixtures/add-search-doc/expected/two-models/search-docs/pizza.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"activeEvent": "false::boolean",
1515
"author": "'pizza'::text",
1616
"teams": "NULL::text[]",
17-
"roles": "'{\"$authenticated\"}'::text[]",
17+
"roles": "'{\"$everyone\"}'::text[]",
1818
"tags": "NULL::text[]",
1919
"language": "'ENG'::text",
2020
"rootAncestorId": "NULL::text",

0 commit comments

Comments
 (0)