diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index dd852a68682dff72b591850c73b4e4f43155b662..2d754bd99e900a510891a5903680e9147ba15fe7 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -103,8 +103,8 @@ def user_avatar(options = {}) end def avatar_without_link(resource, options = {}) - if resource.is_a?(User) - user_avatar_without_link(options.merge(user: resource)) + if resource.is_a?(Namespaces::UserNamespace) + user_avatar_without_link(options.merge(user: resource.first_owner)) elsif resource.is_a?(Group) group_icon(resource, options.merge(class: 'avatar')) end diff --git a/app/models/project.rb b/app/models/project.rb index f2b3db684ae8ad499a202e1c4785ea1631a1796d..649ad9000806a5d94a22eb743c7b7f9e9ab825a1 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1513,6 +1513,9 @@ def send_move_instructions(old_path_with_namespace) # rubocop: enable CodeReuse/ServiceClass def owner + # This will be phased out and replaced with `owners` relationship + # backed by memberships with direct/inherited Owner access roles + # See https://gitlab.com/groups/gitlab-org/-/epics/7405 group || namespace.try(:owner) end diff --git a/ee/app/views/projects/settings/subscriptions/_project.html.haml b/ee/app/views/projects/settings/subscriptions/_project.html.haml index 676967615311a4465d45c7d1458ab4946e73a0cf..d42913d116b8f2296ad5f7fd1d110af2b324981a 100644 --- a/ee/app/views/projects/settings/subscriptions/_project.html.haml +++ b/ee/app/views/projects/settings/subscriptions/_project.html.haml @@ -5,8 +5,8 @@ = link_to project.name, project_path(project) %td .gl-display-flex.gl-align-items-center - = avatar_without_link(project.owner, size: 32) - = project.owner.name + = avatar_without_link(project.namespace, size: 32) + = project.namespace.name - if is_upstream_mode %td.gl-text-right = link_to project_subscription_path(@project, subscription.id), method: :delete, data: { toggle: 'tooltip', title: tooltip, container: 'body', testid: 'delete-subscription' }, class: "gl-button btn btn-danger" do diff --git a/ee/spec/features/projects/settings/pipeline_subscriptions_spec.rb b/ee/spec/features/projects/settings/pipeline_subscriptions_spec.rb index fe90126eadfaa1775f7ef9342fdef2fec1320d96..aab144997c07d03abb184dee012b9ac5579826a0 100644 --- a/ee/spec/features/projects/settings/pipeline_subscriptions_spec.rb +++ b/ee/spec/features/projects/settings/pipeline_subscriptions_spec.rb @@ -55,7 +55,7 @@ end expect(page).to have_content(upstream_project.name) - expect(page).to have_content(upstream_project.owner.name) + expect(page).to have_content(upstream_project.namespace.name) end expect(page).to have_content('Subscription successfully created.') diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb index 7190f2fcd4afc65132a3bb60a4850b2bf52d5d58..a6195e47c303368dd9ee87225114a91f2c43318f 100644 --- a/spec/helpers/avatars_helper_spec.rb +++ b/spec/helpers/avatars_helper_spec.rb @@ -428,7 +428,7 @@ subject { helper.avatar_without_link(resource, options) } context 'with users' do - let(:resource) { user } + let(:resource) { user.namespace } it 'displays user avatar' do is_expected.to eq tag(