Commit 9b92f5d3 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Extract scoped issue availability check to a method

parent 0912e9e9
...@@ -801,21 +801,18 @@ module API ...@@ -801,21 +801,18 @@ module API
# EE-specific # EE-specific
# Default filtering configuration # Default filtering configuration
expose :milestone, expose :milestone, using: Entities::Milestone, if: -> (board, _) { scoped_issue_available?(board) }
using: Entities::Milestone, expose :assignee, using: Entities::UserBasic, if: -> (board, _) { scoped_issue_available?(board) }
if: -> (board, _) { board.parent.feature_available?(:scoped_issue_board) } expose :labels, using: Entities::LabelBasic, if: -> (board, _) { scoped_issue_available?(board) }
expose :assignee, expose :weight, if: -> (board, _) { scoped_issue_available?(board) }
using: Entities::UserBasic,
if: -> (board, _) { board.parent.feature_available?(:scoped_issue_board) }
expose :labels,
using: Entities::LabelBasic,
if: -> (board, _) { board.parent.feature_available?(:scoped_issue_board) }
expose :weight,
if: -> (board, _) { board.parent.feature_available?(:scoped_issue_board) }
expose :lists, using: Entities::List do |board| expose :lists, using: Entities::List do |board|
board.lists.destroyable board.lists.destroyable
end end
def scoped_issue_available?(board)
board.parent.feature_available?(:scoped_issue_board)
end
end end
class Compare < Grape::Entity class Compare < Grape::Entity
......
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