Skip to content

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

Open
wants to merge 1 commit into
base: features/user-groups
Choose a base branch
from

Conversation

aignatov-bio
Copy link
Contributor

@aignatov-bio aignatov-bio commented Jul 15, 2025

Jira ticket: SCI-12041

Handle project "visibility" property backward-compatibility on API

@aignatov-bio aignatov-bio force-pushed the ai-sci-12041-add-support-of-project-visibility-in-api branch from b40ad0f to 20c9b71 Compare July 15, 2025 16:58
project.team_assignments.create!(
team: project.team,
assignable: project,
user_role_id: UserRole.predefined.find_by(name: I18n.t('user_roles.predefined.viewer')).id,
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

same as in create

@aignatov-bio aignatov-bio force-pushed the ai-sci-12041-add-support-of-project-visibility-in-api branch from 20c9b71 to 28dab56 Compare July 22, 2025 12:07
end

def update
@project.assign_attributes(project_params)
has_team_assignment = @project.team_assignments.any?
Copy link
Contributor

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!
Copy link
Contributor

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?

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.

3 participants