Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-09 21:09:32 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-09 21:09:32 +0300
commit1268cfeaf73a73c5593f13639530513716826e2b (patch)
tree2508ffb2fddaa666d99b4e5984d3340eb9194782 /spec/requests
parentbe769d5fcced48143e92f83c997b7d5ba14873e1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/graphql/work_item_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/work_item_spec.rb b/spec/requests/api/graphql/work_item_spec.rb
index f147240e1f2..6702224f303 100644
--- a/spec/requests/api/graphql/work_item_spec.rb
+++ b/spec/requests/api/graphql/work_item_spec.rb
@@ -570,6 +570,8 @@ RSpec.describe 'Query.work_item(id)', feature_category: :team_planning do
nodes {
id
body
+ maxAccessLevelOfAuthor
+ authorIsContributor
awardEmoji {
nodes {
name
@@ -614,7 +616,20 @@ RSpec.describe 'Query.work_item(id)', feature_category: :team_planning do
)
end
+ it 'returns author contributor status and max access level' do
+ all_widgets = graphql_dig_at(work_item_data, :widgets)
+ notes_widget = all_widgets.find { |x| x['type'] == 'NOTES' }
+ notes = graphql_dig_at(notes_widget['discussions'], :nodes).flat_map { |d| d['notes']['nodes'] }
+
+ expect(notes).to contain_exactly(
+ hash_including('maxAccessLevelOfAuthor' => 'Owner', 'authorIsContributor' => false)
+ )
+ end
+
it 'avoids N+1 queries' do
+ another_user = create(:user).tap { |u| note.resource_parent.add_developer(u) }
+ create(:note, project: note.project, noteable: work_item, author: another_user)
+
post_graphql(query, current_user: developer)
control = ActiveRecord::QueryRecorder.new { post_graphql(query, current_user: developer) }
@@ -623,8 +638,12 @@ RSpec.describe 'Query.work_item(id)', feature_category: :team_planning do
another_note = create(:note, project: work_item.project, noteable: work_item)
create(:award_emoji, awardable: another_note, name: 'star', user: guest)
+ another_user = create(:user).tap { |u| note.resource_parent.add_developer(u) }
+ note_with_different_user = create(:note, project: note.project, noteable: work_item, author: another_user)
+ create(:award_emoji, awardable: note_with_different_user, name: 'star', user: developer)
- expect { post_graphql(query, current_user: developer) }.not_to exceed_query_limit(control)
+ # TODO: Fix existing N+1 queries in https://gitlab.com/gitlab-org/gitlab/-/issues/414747
+ expect { post_graphql(query, current_user: developer) }.not_to exceed_query_limit(control).with_threshold(3)
expect_graphql_errors_to_be_empty
end
end