Skip to content

Change Author to Owner for CICD attributes

Summary

On the /-/settings/ci_cd page when there are Pipeline subscriptions controls where you can subscribe to other project pipelines:

image

When we are displaying the list of subscriptions we show the project's owner as Author and with user_avatar_without_link we show an avatar for it. The problem is that a project's owner is most likely a group, not a user leading to issues like #300739 (comment 499989481) when someone changes the user_avatar_without_link method. This is bad because the method name suggests that it's argument is always a User instance and it can be customized with user specific attributes.

Proposal

Change Author to Owner and use an appropriate avatar method based on the owner's class:

image

diff --git a/ee/app/views/projects/settings/subscriptions/_index.html.haml b/ee/app/views/projects/settings/subscriptions/_index.html.haml
index 5635a0db356..03e02ac177e 100644
--- a/ee/app/views/projects/settings/subscriptions/_index.html.haml
+++ b/ee/app/views/projects/settings/subscriptions/_index.html.haml
@@ -19,7 +19,7 @@
       %thead
         %tr
           %th= _("Project")
-          %th= _("Author")
+          %th= _("Owner")
           %th
       %tbody
         - @project.upstream_project_subscriptions.each do |subscription|
diff --git a/ee/app/views/projects/settings/subscriptions/_project.html.haml b/ee/app/views/projects/settings/subscriptions/_project.html.haml
index e8e450d8930..96a7a32ab67 100644
--- a/ee/app/views/projects/settings/subscriptions/_project.html.haml
+++ b/ee/app/views/projects/settings/subscriptions/_project.html.haml
@@ -3,7 +3,7 @@
   %td
     = project.name
   %td
-    = user_avatar_without_link(user: project.owner, size: 32)
+    = project.owner.is_a?(User) ? user_avatar_without_link(user: project.owner, size: 32) : group_icon(project.owner)
     = project.owner.name
   %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

We should add an E2E spec for this scenario as well.

Edited by Jackie Porter