Fix group project selection in IssuableFinder
This commit is contained in:
parent
8db1292139
commit
fd8d44ca61
3 changed files with 5 additions and 9 deletions
|
@ -80,9 +80,10 @@ class IssuableFinder
|
|||
@projects = project
|
||||
elsif current_user && params[:authorized_only].presence && !current_user_related?
|
||||
@projects = current_user.authorized_projects.reorder(nil)
|
||||
elsif group
|
||||
@projects = GroupProjectsFinder.new(group).execute(current_user).reorder(nil)
|
||||
else
|
||||
@projects = GroupProjectsFinder.new(group).execute(current_user).
|
||||
reorder(nil)
|
||||
@projects = ProjectsFinder.new.execute(current_user).reorder(nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -198,8 +199,7 @@ class IssuableFinder
|
|||
end
|
||||
|
||||
def by_group(items)
|
||||
items = items.of_group(group) if group
|
||||
|
||||
# Selection by group is already covered by `by_project` and `projects`
|
||||
items
|
||||
end
|
||||
|
||||
|
|
|
@ -33,9 +33,6 @@ class Issue < ActiveRecord::Base
|
|||
belongs_to :project
|
||||
validates :project, presence: true
|
||||
|
||||
scope :of_group,
|
||||
->(group) { where(project_id: group.projects.select(:id).reorder(nil)) }
|
||||
|
||||
scope :cared, ->(user) { where(assignee_id: user) }
|
||||
scope :open_for, ->(user) { opened.assigned_to(user) }
|
||||
scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
|
||||
|
@ -106,7 +103,7 @@ class Issue < ActiveRecord::Base
|
|||
|
||||
def related_branches
|
||||
return [] if self.project.empty_repo?
|
||||
|
||||
|
||||
self.project.repository.branch_names.select { |branch| branch.end_with?("-#{iid}") }
|
||||
end
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@ class MergeRequest < ActiveRecord::Base
|
|||
validate :validate_branches
|
||||
validate :validate_fork
|
||||
|
||||
scope :of_group, ->(group) { where("source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)", group_project_ids: group.projects.select(:id).reorder(nil)) }
|
||||
scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) }
|
||||
scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) }
|
||||
scope :by_milestone, ->(milestone) { where(milestone_id: milestone) }
|
||||
|
|
Loading…
Reference in a new issue