From 0489b9c7bf39bf4a6cc366616d69050b1a76df91 Mon Sep 17 00:00:00 2001 From: Phil Hughes <me@iamphill.com> Date: Mon, 24 Feb 2020 12:15:01 +0000 Subject: [PATCH] Fixed last commit widget not showing with Gravatar disabled Closes https://gitlab.com/gitlab-org/gitlab/issues/207723 --- app/graphql/types/user_type.rb | 2 +- .../ph-207723-userTypeGravatarDisabled.yml | 5 +++++ doc/api/graphql/reference/gitlab_schema.graphql | 2 +- doc/api/graphql/reference/gitlab_schema.json | 10 +++------- doc/api/graphql/reference/index.md | 2 +- spec/features/projects/tree/tree_show_spec.rb | 17 +++++++++++++++++ 6 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 changelogs/unreleased/ph-207723-userTypeGravatarDisabled.yml diff --git a/app/graphql/types/user_type.rb b/app/graphql/types/user_type.rb index 3943c891335..e530641d6ae 100644 --- a/app/graphql/types/user_type.rb +++ b/app/graphql/types/user_type.rb @@ -14,7 +14,7 @@ module Types description: 'Human-readable name of the user' field :username, GraphQL::STRING_TYPE, null: false, description: 'Username of the user. Unique within this instance of GitLab' - field :avatar_url, GraphQL::STRING_TYPE, null: false, + field :avatar_url, GraphQL::STRING_TYPE, null: true, description: "URL of the user's avatar" field :web_url, GraphQL::STRING_TYPE, null: false, description: 'Web URL of the user' diff --git a/changelogs/unreleased/ph-207723-userTypeGravatarDisabled.yml b/changelogs/unreleased/ph-207723-userTypeGravatarDisabled.yml new file mode 100644 index 00000000000..047d3aee506 --- /dev/null +++ b/changelogs/unreleased/ph-207723-userTypeGravatarDisabled.yml @@ -0,0 +1,5 @@ +--- +title: Fixed last commit widget when Gravatar is disabled +merge_request: +author: +type: fixed diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 8b403cb3363..4c12465f5b0 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -8003,7 +8003,7 @@ type User { """ URL of the user's avatar """ - avatarUrl: String! + avatarUrl: String """ Human-readable name of the user diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index 73fe8cfa65d..209b6da5ab2 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -6171,13 +6171,9 @@ ], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } + "kind": "SCALAR", + "name": "String", + "ofType": null }, "isDeprecated": false, "deprecationReason": null diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index ab1efa6c5c1..2b17b86b1d0 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1287,7 +1287,7 @@ Autogenerated return type of UpdateSnippet | Name | Type | Description | | --- | ---- | ---------- | -| `avatarUrl` | String! | URL of the user's avatar | +| `avatarUrl` | String | URL of the user's avatar | | `name` | String! | Human-readable name of the user | | `userPermissions` | UserPermissions! | Permissions for the current user on the resource | | `username` | String! | Username of the user. Unique within this instance of GitLab | diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb index 180ffac4d4d..23b13858096 100644 --- a/spec/features/projects/tree/tree_show_spec.rb +++ b/spec/features/projects/tree/tree_show_spec.rb @@ -5,11 +5,14 @@ require 'spec_helper' describe 'Projects tree', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } + let(:gravatar_enabled) { true } # This commit has a known state on the master branch of gitlab-test let(:test_sha) { '7975be0116940bf2ad4321f79d02a55c5f7779aa' } before do + stub_application_setting(gravatar_enabled: gravatar_enabled) + project.add_maintainer(user) sign_in(user) end @@ -34,6 +37,20 @@ describe 'Projects tree', :js do expect(page).not_to have_selector('.flash-alert') end + context 'gravatar disabled' do + let(:gravatar_enabled) { false } + + it 'renders last commit' do + visit project_tree_path(project, test_sha) + wait_for_requests + + page.within('.project-last-commit') do + expect(page).to have_selector('.user-avatar-link') + expect(page).to have_content('Merge branch') + end + end + end + context 'for signed commit' do it 'displays a GPG badge' do visit project_tree_path(project, '33f3729a45c02fc67d00adb1b8bca394b0e761d9') -- 2.30.9