Commit 34d050f6 authored by Felipe Artur's avatar Felipe Artur

Code improvements

parent d700c6f0
...@@ -7,7 +7,6 @@ class Board < ActiveRecord::Base ...@@ -7,7 +7,6 @@ class Board < ActiveRecord::Base
validates :name, presence: true validates :name, presence: true
# if block needed only for EE which has group boards feature
validates :project, presence: true, if: -> { respond_to?(:group_id) && !group } validates :project, presence: true, if: -> { respond_to?(:group_id) && !group }
def backlog_list def backlog_list
......
...@@ -11,7 +11,7 @@ module RelativePositioning ...@@ -11,7 +11,7 @@ module RelativePositioning
end end
def project_ids def project_ids
project.id [project.id]
end end
def max_relative_position def max_relative_position
......
- parent = board.parent - parent = board.parent
- milestone_filter_opts = { format: :json } - milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.is_group_board? - milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
%boards-selector{ "inline-template" => true, %boards-selector{ "inline-template" => true,
":current-board" => current_board_json, ":current-board" => current_board_json,
......
- milestone_filter_opts = { format: :json } - milestone_filter_opts = { format: :json }
- milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.is_group_board? - milestone_filter_opts = milestone_filter_opts.merge(only_group_milestones: true) if board.group_board?
.block.milestone .block.milestone
.title .title
......
# Group issue board # Group issue board
> Introduced in GitLab 9.5. > Introduced in GitLab 10.0.
Group issue boards help users manage teams in organizations Group issue boards help users manage teams in organizations
that have a team-centered or product-centered approach which spans that have a team-centered or product-centered approach which spans
...@@ -8,7 +8,7 @@ many projects. ...@@ -8,7 +8,7 @@ many projects.
![Group Issue Board](img/group_issue_board.png) ![Group Issue Board](img/group_issue_board.png)
The design and functionality are the same of [project boards](../project/issue_board.md) with some small differences: The design and functionality are the same as [project boards](../project/issue_board.md) with some small differences:
* In a group board all issues within group projects will be displayed * In a group board all issues within group projects will be displayed
on backlog or closed lists. Users don't need to filter them by project on search bar. on backlog or closed lists. Users don't need to filter them by project on search bar.
......
...@@ -2,15 +2,13 @@ module EE ...@@ -2,15 +2,13 @@ module EE
module Boards module Boards
module IssuesController module IssuesController
def issues_finder def issues_finder
if board.is_group_board? return super unless board.group_board?
IssuesFinder.new(current_user, group_id: board_parent.id)
else IssuesFinder.new(current_user, group_id: board_parent.id)
super
end
end end
def project def project
@project ||= board.is_group_board? ? super : board.parent @project ||= board.group_board? ? super : board.parent
end end
end end
end end
......
...@@ -3,13 +3,13 @@ module EE ...@@ -3,13 +3,13 @@ module EE
# Shared authorizations between projects and groups which # Shared authorizations between projects and groups which
# have different policies on EE. # have different policies on EE.
def authorize_read_list def authorize_read_list
ability = board.is_group_board? ? :read_group : :read_list ability = board.group_board? ? :read_group : :read_list
authorize_action_for!(board.parent, ability) authorize_action_for!(board.parent, ability)
end end
def authorize_read_issue def authorize_read_issue
ability = board.is_group_board? ? :read_group : :read_issue ability = board.group_board? ? :read_group : :read_issue
authorize_action_for!(board.parent, ability) authorize_action_for!(board.parent, ability)
end end
......
...@@ -6,7 +6,7 @@ module EE ...@@ -6,7 +6,7 @@ module EE
end end
def build_issue_link_base def build_issue_link_base
return super unless @board.is_group_board? return super unless @board.group_board?
"/#{@board.group.path}/:project_path/issues" "/#{@board.group.path}/:project_path/issues"
end end
...@@ -17,7 +17,7 @@ module EE ...@@ -17,7 +17,7 @@ module EE
def board_path(board) def board_path(board)
@board_path ||= begin @board_path ||= begin
if board.is_group_board? if board.group_board?
group_board_path(current_board_parent, board) group_board_path(current_board_parent, board)
else else
super(board) super(board)
......
...@@ -12,11 +12,9 @@ module EE ...@@ -12,11 +12,9 @@ module EE
end end
def project_ids def project_ids
if has_group_boards? return super unless has_group_boards?
board_group.projects.pluck(:id)
else board_group.projects.select(:id)
super
end
end end
end end
end end
...@@ -23,7 +23,7 @@ module EE ...@@ -23,7 +23,7 @@ module EE
@parent ||= group || project @parent ||= group || project
end end
def is_group_board? def group_board?
group_id.present? group_id.present?
end end
......
...@@ -3,7 +3,7 @@ module EE ...@@ -3,7 +3,7 @@ module EE
module Lists module Lists
module CreateService module CreateService
def available_labels_for(board) def available_labels_for(board)
if board.is_group_board? if board.group_board?
parent.labels parent.labels
else else
super super
......
...@@ -5,7 +5,7 @@ module EE ...@@ -5,7 +5,7 @@ module EE
label_ids = label_ids =
if moving_to_list.movable? if moving_to_list.movable?
moving_from_list.label_id moving_from_list.label_id
elsif board.is_group_board? elsif board.group_board?
::Label.on_group_boards(parent.id).pluck(:label_id) ::Label.on_group_boards(parent.id).pluck(:label_id)
else else
::Label.on_project_boards(parent.id).pluck(:label_id) ::Label.on_project_boards(parent.id).pluck(:label_id)
......
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