Fix few bugs and tests after refactoring ownership logic
This commit is contained in:
parent
00a1f5bc2c
commit
d431e43392
19 changed files with 58 additions and 61 deletions
|
@ -80,7 +80,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
# Scopes
|
||||
scope :public_only, where(private_flag: false)
|
||||
scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.projects.map(&:id) ) }
|
||||
scope :without_user, ->(user) { where("id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) }
|
||||
scope :not_in_group, ->(group) { where("id NOT IN (:ids)", ids: group.project_ids ) }
|
||||
scope :in_namespace, ->(namespace) { where(namespace_id: namespace.id) }
|
||||
scope :sorted_by_activity, ->() { order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue