Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fetch user cloud role and pass it on in website links #8942

Merged
merged 7 commits into from
Mar 22, 2024

Conversation

MiloradFilipovic
Copy link
Contributor

@MiloradFilipovic MiloradFilipovic commented Mar 21, 2024

Summary

  • Fetching adding cloud role to /me reponse and passing it to website templates URL
  • Sending number of active workflows and role in template links
  • Showing a new welcome card for Sales users

How to test

Follow the steps from the Linear ticker

Related tickets and issues

https://linear.app/n8n/issue/ADO-2073/send-user-details-from-n8n-app

Review / Merge checklist

  • PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again.
    A feature is not complete without tests.

@MiloradFilipovic MiloradFilipovic self-assigned this Mar 21, 2024
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Mar 21, 2024
* master:
  fix(core): Ensure the generic OAuth2 API credential uses the OAuth2 credential test (#8941)
  fix(MySQL Node): Set paired items correctly in single query batch mode (#8940)
  docs: Fix the Microsoft OneDrive Trigger docs link (#8930)
cypress/e2e/29-templates.cy.ts Outdated Show resolved Hide resolved
role: this.usersStore.currentUserCloudInfo?.role,
active_workflow_count: this.workflowsStore.activeWorkflows.length,
});
window.open(url, '_blank');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use plain <a> tag instead of navigating programmatically. That way all native browser interactions work as well (right click, cmd+click, etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agree. Will update but the requirement is to open this in new tab so the link will have target="_blank"

@@ -1758,6 +1758,7 @@ export declare namespace Cloud {
username: string;
email: string;
hasEarlyAccess?: boolean;
role?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be easy to confuse with the new RBAC roles. Where is this data defined? We can either rename the property or add a more strict type for it, e.g. CloudRole or RoleAtCompany

type CloudRole = string;

export type UserAccount = {
  ...
  role?: CloudRole
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, but this interface is already in the Cloud namespace. Does this make it clearer?

Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

<n8n-card
hoverable
data-test-id="browse-sales-templates-card"
@click="trackCategoryLinkClick('Sales')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be on the <a> tag, but fine as is

Copy link

cypress bot commented Mar 22, 2024

1 flaky test on run #4443 ↗︎

0 343 12 0 Flakiness 1

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 MiloradFilipovic 🗃️ e2e/*
Project: n8n Commit: ba49f5edb3
Status: Passed Duration: 03:48 💡
Started: Mar 22, 2024 10:06 AM Ended: Mar 22, 2024 10:09 AM
Flakiness  cypress/e2e/5-ndv.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > should not retrieve remote options when required params throw errors Test Replay Screenshots Video

Review all test suite changes for PR #8942 ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@MiloradFilipovic MiloradFilipovic merged commit 666867a into master Mar 22, 2024
30 checks passed
@MiloradFilipovic MiloradFilipovic deleted the ADO-2073-fetch-cloud-role branch March 22, 2024 10:33
This was referenced Mar 27, 2024
@janober
Copy link
Member

janober commented Mar 27, 2024

Got released with n8n@1.35.0

@github-actions github-actions bot mentioned this pull request Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants