Skip to content

Conversation

@louispt1
Copy link
Contributor

@louispt1 louispt1 commented Oct 29, 2025

This PR:

  • Fixed bug in ScenarioUser.couple_existing_user which was looking up by user_id rather than user_email
  • Expanded test coverage: added spec covering the user coupling logic more fulsomely

Motivation:

Users added as collaborators via MyETM were not being properly linked to their accounts in ETEngine. The couple_existing_user hook never actually coupled users because it looked up User.find_by(id: user_id)
when user_id was nil. This meant:

  • Existing users added by email weren't immediately coupled to their account
  • Collaboration permissions weren't working across MyETM and ETEngine

Testing

Added spec to check:

  • Existing users are automatically coupled when added by email
  • Non-existent users remain pending with user_email set
  • Duplicate user detection works correctly via unique indices
  • User signup triggers automatic coupling of pending ScenarioUser records

Open questions:

  • Do we want to show pending users (as in, scenario user with email but no id) on the etengine inspect scenario view?

Goes with this MyETM PR

Copy link
Member

@noracato noracato left a comment

Choose a reason for hiding this comment

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

Nice catch!

@noracato noracato merged commit b08e275 into master Oct 30, 2025
1 check passed
@noracato noracato deleted the scenario-users branch October 30, 2025 09:40
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.

[BUG - Dev] Scenario Users not being added correctly

3 participants