Pipeline slack message is missing author by triggered builds
Summary
When you trigger a build using the API, the resulting slack message is missing the "by" part. The !7506 (merged) fix was not good enough yet.
Steps to reproduce
Setup a build which notifies success to a slack channel and trigger a build using the API.
Expected behavior
Something filled in after the by in the slack message
Actual behavior
An empty part in the slack message.
Relevant logs and/or screenshots
Possible fixes
The "app/views/projects/ci/pipelines/_pipeline.html.haml" file contains:
%span by
- if pipeline.user
= user_avatar(user: pipeline.user, size: 20)
- else
%span.api.monospace API
So I guess "app/models/project_services/slack_service/pipeline_message.rb"
@user_name = data[:user] && data[:user][:name]
Should be changed into something like
@user_name = data[:user] ? data[:user][:name] : "API"
But this is a bit ugly, since you are putting this logic in at least two places now. Perhaps the pipeline user should be filled in by the API on triggering the pipeline?