Commit 28cff5c9 authored by James Ramsay's avatar James Ramsay Committed by Michelle Gill

Commit author for suggestions is note author

Git differentiates the author and committer so that the person who
writes the change can be acknowledged even though someone else committed
it. Suggestions may be proposed by a different person to who applies the
change. If this information is lost, the provenance of the change can be
hard to discern.
parent 0c0f7bb9
......@@ -36,12 +36,18 @@ module Suggestions
.track_apply_suggestion_action(user: current_user)
end
def author
Gitlab::Git::User.from_gitlab(suggestion_set.authors.first) if suggestion_set.authors.one?
end
def multi_service
params = {
commit_message: commit_message,
branch_name: suggestion_set.branch,
start_branch: suggestion_set.branch,
actions: suggestion_set.actions
actions: suggestion_set.actions,
author_name: author&.name,
author_email: author&.email
}
::Files::MultiService.new(suggestion_set.project, current_user, params)
......
......@@ -39,6 +39,10 @@ module Gitlab
@file_paths ||= suggestions.map(&:file_path).uniq
end
def authors
suggestions.map { |suggestion| suggestion.note.author }.uniq
end
private
def first_suggestion
......
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