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
Do not invite manager as member when creating a team. #3308
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,10 @@ def test_profile_shows_progress | |
|
||
def test_display_team_invites_only_in_users_own_profile | ||
new_user = create_user(username: 'new_user', github_id: 456) | ||
attributes = { slug: 'some-team', name: 'Some Name', usernames: 'new_user' } | ||
Team.by(@user).defined_with(attributes, @user).save! | ||
|
||
team = Team.by(@user).defined_with({ slug: 'some-team', name: 'Some Name' }, @user) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's probably a good reason, but why does this* need to change? It seems like creating a team with existing members is a useful thing to be able to do in one shot. * In all these files, not specifically here in profile_test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I would say yes, but we would need to wrap things in a transaction and start rescuing from everywhere. The alternative would be checking inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you create the invitations using an It's probably not the responsibility of a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, but I don't really like the idea that just because it is already doing too much we can just add more behaviour into the object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Welcome back @kytrinyx :) Can I have fresh eyes on this? I like the current state of the code, but a new abstraction for creating a team and inviting members would also be valuable, I just can't come up with a good name for this "service". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, yes (sorry! it's taken forever to catch up with everything). Looking now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like the idea of an after save, I do like the current state of the code, and agree that a new abstraction would be even better. If we could name it. I honestly can't think of anything. |
||
team.save! | ||
team.invite_with_usernames(new_user.username, @user) | ||
|
||
with_login(@user) do | ||
visit "/#{new_user.username}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a place where
options[:users]
were being used, so I dropped it. Thoughts on this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's probably left-over from something.