Commit 0cf37693 authored by charlie ablett's avatar charlie ablett

Modifies a settings page call - removes project.owner

Update tests
parent 1673727e
...@@ -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/gitlab-org/gitlab/-/issues/241503
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