-
Notifications
You must be signed in to change notification settings - Fork 107
Handle project "visibility" property backward-compatibility on API [SCI-12041] #8664
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
base: features/user-groups
Are you sure you want to change the base?
Conversation
b40ad0f
to
20c9b71
Compare
project.team_assignments.create!( | ||
team: project.team, | ||
assignable: project, | ||
user_role_id: UserRole.predefined.find_by(name: I18n.t('user_roles.predefined.viewer')).id, |
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.
don't we have find_predefined_viewer_role helper?
if project_params[:visibility] == 'visible' | ||
project.team_assignments.create!( | ||
team: project.team, | ||
assignable: project, |
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.
isn't it already prefilled?
elsif project_params[:visibility] == 'visible' && !has_team_assignment | ||
@project.team_assignments.create!( | ||
team: @project.team, | ||
assignable: @project, |
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.
same as in create
20c9b71
to
28dab56
Compare
end | ||
|
||
def update | ||
@project.assign_attributes(project_params) | ||
has_team_assignment = @project.team_assignments.any? |
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.
don't you need to filter by team?
@project.save! | ||
|
||
if project_params[:visibility] == 'hidden' && has_team_assignment | ||
@project.team_assignments.find_by(assignable: @project).destroy! |
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.
why are you looking by assignable if it is already collection belonging the specific project?
Jira ticket: SCI-12041
Handle project "visibility" property backward-compatibility on API