diff --git a/app/assets/javascripts/repository/queries/getFiles.query.graphql b/app/assets/javascripts/repository/queries/getFiles.query.graphql index 2aaf5066b4ac07ffaac866e5b814414bf9924e03..feb89df04925f504a52d86c8616aec842a57d94a 100644 --- a/app/assets/javascripts/repository/queries/getFiles.query.graphql +++ b/app/assets/javascripts/repository/queries/getFiles.query.graphql @@ -45,6 +45,7 @@ query getFiles( edges { node { ...TreeEntry + mode webUrl lfsOid } diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb index 22349203519c6a3004bdfe16a47dc68ac1cf28a5..36cae756a0d2ac2bfc20bc36d4cba757cdb1c708 100644 --- a/app/graphql/types/tree/blob_type.rb +++ b/app/graphql/types/tree/blob_type.rb @@ -17,6 +17,8 @@ class BlobType < BaseObject resolve: -> (blob, args, ctx) do Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(blob.repository, blob.id).find end + field :mode, GraphQL::STRING_TYPE, null: true, + description: 'Blob mode in numeric format' # rubocop: enable Graphql/AuthorizeTypes end end diff --git a/changelogs/unreleased/symlink-icon-graphql-file-mode.yml b/changelogs/unreleased/symlink-icon-graphql-file-mode.yml new file mode 100644 index 0000000000000000000000000000000000000000..b84fb22c24b071c643b0e4a41f0cd62933b42721 --- /dev/null +++ b/changelogs/unreleased/symlink-icon-graphql-file-mode.yml @@ -0,0 +1,5 @@ +--- +title: Expose blob mode in GraphQL for repository files +merge_request: 36488 +author: +type: other diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 087559f204c0c8ca589af2347d597043598308b3..644d9f8f7f2951b17d3e75d44a6b6ebf69b9ee82 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -793,6 +793,11 @@ type Blob implements Entry { """ lfsOid: String + """ + Blob mode in numeric format + """ + mode: String + """ Name of the entry """ diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 6c0c81852a4feb62f49770a44b539ca3d2a040c0..8213604ed9956dcd70fd3a164c85f478f81d2c19 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -2056,6 +2056,20 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "mode", + "description": "Blob mode in numeric format", + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "name", "description": "Name of the entry", diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index 4327c13d775fc40670ba461930470f11d534c79f..66e96148d44109133b2152e6b7b438abc20937ac 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -160,6 +160,7 @@ Autogenerated return type of AwardEmojiToggle | `flatPath` | String! | Flat path of the entry | | `id` | ID! | ID of the entry | | `lfsOid` | String | LFS ID of the blob | +| `mode` | String | Blob mode in numeric format | | `name` | String! | Name of the entry | | `path` | String! | Path of the entry | | `sha` | String! | Last commit sha for the entry | diff --git a/spec/graphql/types/tree/blob_type_spec.rb b/spec/graphql/types/tree/blob_type_spec.rb index 2c9089de3dd15790eed39a82a793268461c3fcab..73d61d4860cfe5cdc57fdb2d604bad3579dcc411 100644 --- a/spec/graphql/types/tree/blob_type_spec.rb +++ b/spec/graphql/types/tree/blob_type_spec.rb @@ -5,5 +5,5 @@ RSpec.describe Types::Tree::BlobType do specify { expect(described_class.graphql_name).to eq('Blob') } - specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) } + specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid, :mode) } end