Commit 6e5b1686f4431386aab23cea64564718b62b3cb0
1 parent
e14718fb
Exists in
master
and in
4 other branches
TeamManagement: Dont update permissions if it was not changed
Showing
2 changed files
with
12 additions
and
14 deletions
Show diff stats
app/controllers/dashboard_controller.rb
@@ -68,7 +68,7 @@ class DashboardController < ApplicationController | @@ -68,7 +68,7 @@ class DashboardController < ApplicationController | ||
68 | end | 68 | end |
69 | 69 | ||
70 | def event_filter | 70 | def event_filter |
71 | - filters = cookies['event_filter'].split(',') if cookies['event_filter'] | 71 | + filters = cookies['event_filter'].split(',') if cookies['event_filter'].present? |
72 | @event_filter ||= EventFilter.new(filters) | 72 | @event_filter ||= EventFilter.new(filters) |
73 | end | 73 | end |
74 | end | 74 | end |
lib/gitlab/user_team_manager.rb
@@ -25,7 +25,7 @@ module Gitlab | @@ -25,7 +25,7 @@ module Gitlab | ||
25 | def update_team_user_membership(team, member, options) | 25 | def update_team_user_membership(team, member, options) |
26 | updates = {} | 26 | updates = {} |
27 | 27 | ||
28 | - if options[:default_projects_access] && options[:default_projects_access] != team.default_projects_access(member) | 28 | + if options[:default_projects_access] && options[:default_projects_access].to_s != team.default_projects_access(member).to_s |
29 | updates[:permission] = options[:default_projects_access] | 29 | updates[:permission] = options[:default_projects_access] |
30 | end | 30 | end |
31 | 31 | ||
@@ -33,19 +33,17 @@ module Gitlab | @@ -33,19 +33,17 @@ module Gitlab | ||
33 | updates[:group_admin] = options[:group_admin].present? | 33 | updates[:group_admin] = options[:group_admin].present? |
34 | end | 34 | end |
35 | 35 | ||
36 | - unless updates.blank? | ||
37 | - user_team_relationship = team.user_team_user_relationships.find_by_user_id(member) | ||
38 | - if user_team_relationship.update_attributes(updates) | ||
39 | - if updates[:permission] | ||
40 | - rebuild_project_permissions_to_member(team, member) | ||
41 | - end | ||
42 | - true | ||
43 | - else | ||
44 | - false | ||
45 | - end | ||
46 | - else | ||
47 | - true | 36 | + return true if updates.blank? |
37 | + | ||
38 | + user_team_relationship = team.user_team_user_relationships.find_by_user_id(member) | ||
39 | + | ||
40 | + return false unless user_team_relationship.update_attributes(updates) | ||
41 | + | ||
42 | + if updates[:permission] | ||
43 | + rebuild_project_permissions_to_member(team, member) | ||
48 | end | 44 | end |
45 | + | ||
46 | + true | ||
49 | end | 47 | end |
50 | 48 | ||
51 | def update_project_greates_access(team, project, permission) | 49 | def update_project_greates_access(team, project, permission) |