Commit e0ce5f4e authored by charlie ablett's avatar charlie ablett

Apply reviewer feedback

- Tweak description
- remove debug line
parent 20c126c5
......@@ -1825,7 +1825,7 @@ Represents an epic board list.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `collapsed` | Boolean | Indicates if list is collapsed for this user. |
| `collapsed` | Boolean | Indicates if this list is collapsed for this user. |
| `epics` | EpicConnection | List epics. |
| `id` | BoardsEpicListID! | Global ID of the board list. |
| `label` | Label | Label of the list. |
......
......@@ -29,6 +29,11 @@ module Resolvers
private
def load_preferences?(lookahead)
lookahead&.selection(:edges)&.selection(:node)&.selects?(:collapsed) ||
lookahead&.selection(:nodes)&.selects?(:collapsed)
end
def authorize!
Ability.allowed?(context[:current_user], :read_epic_board_list, epic_board.group) || raise_resource_not_available_error!
end
......
......@@ -25,7 +25,7 @@ module Types
description: 'Label of the list.'
field :collapsed, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if list is collapsed for this user.'
description: 'Indicates if this list is collapsed for this user.'
field :epics, Types::EpicType.connection_type, null: true,
resolver: Resolvers::Boards::BoardListEpicsResolver,
......
......@@ -57,15 +57,15 @@ RSpec.describe 'get list of epics for an epic board list' do
describe 'field values' do
def query(params = {})
graphql_query_for(:group, { full_path: group.full_path },
<<~BOARDS
epicBoard(id: "#{board.to_global_id}") {
lists(id: "#{list.to_global_id}") {
nodes {
#{all_graphql_fields_for('epic_list'.classify)}
<<~BOARDS
epicBoard(id: "#{board.to_global_id}") {
lists(id: "#{list.to_global_id}") {
nodes {
#{all_graphql_fields_for('epic_list'.classify)}
}
}
}
}
BOARDS
BOARDS
)
end
......@@ -73,9 +73,8 @@ RSpec.describe 'get list of epics for an epic board list' do
board.epic_lists.first.update_preferences_for(current_user, collapsed: true)
post_graphql(query, current_user: current_user)
pp graphql_dig_at(graphql_data, 'group', 'epicBoard', 'lists', 'nodes', 0)
expect(graphql_dig_at(graphql_data, 'group', 'epicBoard', 'lists', 'nodes', 0, 'collapsed')).to eq list.collapsed?(current_user)
expect(graphql_dig_at(graphql_data, 'group', 'epicBoard', 'lists', 'nodes', 0, 'collapsed')).to eq(true)
end
end
end
......@@ -10,7 +10,7 @@ RSpec.shared_examples 'list_preferences_for user' do |list_factory, list_id, pre
it 'returns not persisted preferences' do
preferences = subject.preferences_for(nil)
expect(preferences.persisted?).to eq(false)
expect(preferences).not_to be_persisted
expect(preferences.send(list_id)).to eq(subject.id)
expect(preferences.user_id).to be_nil
end
......@@ -33,7 +33,7 @@ RSpec.shared_examples 'list_preferences_for user' do |list_factory, list_id, pre
it 'returns not persisted preferences' do
preferences = subject.preferences_for(user)
expect(preferences.persisted?).to eq(false)
expect(preferences).not_to be_persisted
expect(preferences.user_id).to eq(user.id)
expect(preferences.send(list_id)).to eq(subject.id)
end
......
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