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
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-23 09:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-23 09:08:58 +0300
commit784a3db6274bf16a64d2cd947d42182c85cf605f (patch)
tree0bad03e81bdc16e8d5744877b2e3dec17e24a797 /app
parent89ff92639b7ad6499fb1e9470e4151fb112a904e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/graphql/types/group_type.rb14
-rw-r--r--app/graphql/types/project_type.rb14
2 files changed, 28 insertions, 0 deletions
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb
index 01b741b5a98..0bd0f251c1a 100644
--- a/app/graphql/types/group_type.rb
+++ b/app/graphql/types/group_type.rb
@@ -62,6 +62,10 @@ module Types
null: true,
description: 'Indicates if a group has email notifications disabled.'
+ field :max_access_level, Types::AccessLevelType,
+ null: false,
+ description: 'The maximum access level of the current user in the group.'
+
field :mentions_disabled,
type: GraphQL::Types::Boolean,
null: true,
@@ -375,6 +379,16 @@ module Types
end
end
+ def max_access_level
+ return Gitlab::Access::NO_ACCESS if current_user.nil?
+
+ BatchLoader::GraphQL.for(object.id).batch do |group_ids, loader|
+ current_user.max_member_access_for_group_ids(group_ids).each do |group_id, max_access_level|
+ loader.call(group_id, max_access_level)
+ end
+ end
+ end
+
private
def group
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index 7f49c717c78..aacd67e269e 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -110,6 +110,10 @@ module Types
null: true,
description: 'Indicates if the project has Large File Storage (LFS) enabled.'
+ field :max_access_level, Types::AccessLevelType,
+ null: false,
+ description: 'The maximum access level of the current user in the project.'
+
field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean,
null: true,
description: 'Indicates if no merge commits should be created and all merges should instead be ' \
@@ -823,6 +827,16 @@ module Types
}
end
+ def max_access_level
+ return Gitlab::Access::NO_ACCESS if current_user.nil?
+
+ BatchLoader::GraphQL.for(object.id).batch do |project_ids, loader|
+ current_user.max_member_access_for_project_ids(project_ids).each do |project_id, max_access_level|
+ loader.call(project_id, max_access_level)
+ end
+ end
+ end
+
private
def project