Commit 634783feb0131794eb1ed797a8c70e1674f9ba9e

Authored by Andrey Kumanyaev
1 parent 1e3d2389

Rename scope "in_group" to "in_namespace"

app/models/project.rb
@@ -82,7 +82,7 @@ class Project < ActiveRecord::Base @@ -82,7 +82,7 @@ class Project < ActiveRecord::Base
82 scope :public_only, where(private_flag: false) 82 scope :public_only, where(private_flag: false)
83 scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) } 83 scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) }
84 scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) } 84 scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) }
85 - scope :in_group, ->(group) { where(namespace_id: group.id) } 85 + scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) }
86 scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") } 86 scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }
87 scope :personal, ->(user) { where(namespace_id: user.namespace_id) } 87 scope :personal, ->(user) { where(namespace_id: user.namespace_id) }
88 scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) } 88 scope :joined, ->(user) { where("namespace_id != ?", user.namespace_id) }
app/views/admin/groups/show.html.haml
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 %tr{class: "user_#{u.id}"} 76 %tr{class: "user_#{u.id}"}
77 %td.name= link_to u.name, admin_user_path(u) 77 %td.name= link_to u.name, admin_user_path(u)
78 %td.projects_access 78 %td.projects_access
79 - - u.projects.in_group(@group).each do |project| 79 + - u.projects.in_namespace(@group).each do |project|
80 - u_p = u.users_projects.in_project(project).first 80 - u_p = u.users_projects.in_project(project).first
81 = "#{project.name} (#{link_to u_p.project_access_human, edit_admin_team_member_path(u_p) })".html_safe 81 = "#{project.name} (#{link_to u_p.project_access_human, edit_admin_team_member_path(u_p) })".html_safe
82 %tr 82 %tr