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

Move invite accept to before personal team create #4397

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

hardillb
Copy link
Contributor

fixes #4333

Description

We should only create a personal team for a new user if they have not been invited to a team.

The logic was already present to do this, we just were accepting the invites after creating the team...

Related Issue(s)

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.35%. Comparing base (dd070d7) to head (d32508f).
Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4397      +/-   ##
==========================================
+ Coverage   78.34%   78.35%   +0.01%     
==========================================
  Files         293      293              
  Lines       13571    13571              
  Branches     3052     3052              
==========================================
+ Hits        10632    10634       +2     
+ Misses       2939     2937       -2     
Flag Coverage Δ
backend 78.35% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joepavitt joepavitt merged commit 87e8be6 into main Aug 23, 2024
13 of 14 checks passed
@joepavitt joepavitt deleted the 4333-only-create-team-if-no-teams branch August 23, 2024 16:18
@knolleary
Copy link
Member

This PR has broken the tests in an unusual way. Viewing the Backend Tests log output, mocha reports two tests have failed - yet it exits with rc=0, so the action reports a pass.

  1609 passing (11m)
  24 pending
  2 failing

The 2 failing tests are closely related to the behaviour this PR has changed. I'm still investigating just how it managed to break the tests in a way that caused mocha not to report the failure - but when I try running test/unit/forge/routes/auth/index_spec.js locally since this PR was merged, the tests hang completely until I get an out of memory error.

@knolleary
Copy link
Member

Ok - so the tests that are now silently failing are ones related to ensuring, if a user accepts an invite when registering, that the personal instance gets created in their personal team, not the team they were invited to.

However, this PR means the personal team no longer gets created so the whole test is invalid.

What is very strange is the test should be failing due to the line:

teams.should.have.length(2)

because teams now only has length of 1. But this line is just hanging; it doesn't throw, it doesn't pass, it just hangs.

Changing it to teams.length.should.equal(2) makes the test failure properly... but that is odd. Maybe some iteraction between collection objects return by sequelize and should.js.

Regardless, this PR should have had tests adding to verify the personal team didn't get created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set default team based on team invitations if present
3 participants