Commit d7ef6e97 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '241503-cablett-display-subscription-owners' into 'master'

Use namespace avatar instead of owner

See merge request gitlab-org/gitlab!78445
parents 0493811c c4289ef6
......@@ -103,8 +103,8 @@ module AvatarsHelper
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
......
......@@ -1513,6 +1513,9 @@ class Project < ApplicationRecord
# 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
......
......@@ -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
......
......@@ -55,7 +55,7 @@ RSpec.describe 'Project Subscriptions', :js do
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.')
......
......@@ -428,7 +428,7 @@ RSpec.describe AvatarsHelper do
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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment