Skip to content

Resolve "Align Team add_X methods with add_user"

What does this MR do?

Closes #261970 (closed)

The #add_X methods such as #add_developer are just a friendly shortcut to calling #add_user with the specified role. However, #add_user params have moved beyond what the #add_X methods pass through. This MR will align the params.

I have also made a DRY refactor and placed the #add_X methods from both ProjectTeam and Group models in to a concern. The method signatures we're not quite the same in these models:

ProjectTeam

def add_guest(user, current_user: nil)

Group

def add_guest(user, current_user = nil)

Fortunately these signatures can be made compatible:

def add_guest(user, current_user = nil, **params)
  params[:current_user] ||= current_user
  add_user(user, role, params)
end

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Alex Pooley

Merge request reports