Commit 6e5b1686 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

TeamManagement: Dont update permissions if it was not changed

parent e14718fb
...@@ -68,7 +68,7 @@ class DashboardController < ApplicationController ...@@ -68,7 +68,7 @@ class DashboardController < ApplicationController
end end
def event_filter def event_filter
filters = cookies['event_filter'].split(',') if cookies['event_filter'] filters = cookies['event_filter'].split(',') if cookies['event_filter'].present?
@event_filter ||= EventFilter.new(filters) @event_filter ||= EventFilter.new(filters)
end end
end end
...@@ -25,7 +25,7 @@ module Gitlab ...@@ -25,7 +25,7 @@ module Gitlab
def update_team_user_membership(team, member, options) def update_team_user_membership(team, member, options)
updates = {} updates = {}
if options[:default_projects_access] && options[:default_projects_access] != team.default_projects_access(member) if options[:default_projects_access] && options[:default_projects_access].to_s != team.default_projects_access(member).to_s
updates[:permission] = options[:default_projects_access] updates[:permission] = options[:default_projects_access]
end end
...@@ -33,19 +33,17 @@ module Gitlab ...@@ -33,19 +33,17 @@ module Gitlab
updates[:group_admin] = options[:group_admin].present? updates[:group_admin] = options[:group_admin].present?
end end
unless updates.blank? return true if updates.blank?
user_team_relationship = team.user_team_user_relationships.find_by_user_id(member)
if user_team_relationship.update_attributes(updates) user_team_relationship = team.user_team_user_relationships.find_by_user_id(member)
if updates[:permission]
rebuild_project_permissions_to_member(team, member) return false unless user_team_relationship.update_attributes(updates)
end
true if updates[:permission]
else rebuild_project_permissions_to_member(team, member)
false
end
else
true
end end
true
end end
def update_project_greates_access(team, project, permission) def update_project_greates_access(team, project, permission)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment