Skip to content

Commit

Permalink
🐛 Fixing the onboarding threshold logic so sticky notes are skipped w…
Browse files Browse the repository at this point in the history
…hen counting nodes.
  • Loading branch information
MiloradFilipovic committed May 16, 2022
1 parent cb504fe commit bbfeb44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/src/WorkflowHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ export async function getSharedWorkflowIds(user: User): Promise<number[]> {
*/
export async function isBelowOnboardingThreshold(user: User): Promise<boolean> {
let belowThreshold = true;
const skippedTypes = ['n8n-nodes-base.start', 'n8n-nodes-base.stickyNote']

const workflowOwnerRole = await Db.collections.Role.findOne({
name: 'owner',
Expand All @@ -626,7 +627,7 @@ export async function isBelowOnboardingThreshold(user: User): Promise<boolean> {
// valid workflow: 2+ nodes without start node
const validWorkflowCount = workflows.reduce((counter, workflow) => {
if (counter <= 2 && workflow.nodes.length > 2) {
const nodes = workflow.nodes.filter((node) => node.type !== 'n8n-nodes-base.start');
const nodes = workflow.nodes.filter((node) => !skippedTypes.includes(node.type));
if (nodes.length >= 2) {
return counter + 1;
}
Expand Down

0 comments on commit bbfeb44

Please sign in to comment.