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 ...@@ -103,8 +103,8 @@ module AvatarsHelper
end end
def avatar_without_link(resource, options = {}) def avatar_without_link(resource, options = {})
if resource.is_a?(User) if resource.is_a?(Namespaces::UserNamespace)
user_avatar_without_link(options.merge(user: resource)) user_avatar_without_link(options.merge(user: resource.first_owner))
elsif resource.is_a?(Group) elsif resource.is_a?(Group)
group_icon(resource, options.merge(class: 'avatar')) group_icon(resource, options.merge(class: 'avatar'))
end end
......
...@@ -1513,6 +1513,9 @@ class Project < ApplicationRecord ...@@ -1513,6 +1513,9 @@ class Project < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass # rubocop: enable CodeReuse/ServiceClass
def owner 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) group || namespace.try(:owner)
end end
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
= link_to project.name, project_path(project) = link_to project.name, project_path(project)
%td %td
.gl-display-flex.gl-align-items-center .gl-display-flex.gl-align-items-center
= avatar_without_link(project.owner, size: 32) = avatar_without_link(project.namespace, size: 32)
= project.owner.name = project.namespace.name
- if is_upstream_mode - if is_upstream_mode
%td.gl-text-right %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 = 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 ...@@ -55,7 +55,7 @@ RSpec.describe 'Project Subscriptions', :js do
end end
expect(page).to have_content(upstream_project.name) 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 end
expect(page).to have_content('Subscription successfully created.') expect(page).to have_content('Subscription successfully created.')
......
...@@ -428,7 +428,7 @@ RSpec.describe AvatarsHelper do ...@@ -428,7 +428,7 @@ RSpec.describe AvatarsHelper do
subject { helper.avatar_without_link(resource, options) } subject { helper.avatar_without_link(resource, options) }
context 'with users' do context 'with users' do
let(:resource) { user } let(:resource) { user.namespace }
it 'displays user avatar' do it 'displays user avatar' do
is_expected.to eq tag( 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