Commit a69249d9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'author_attributes_clean' into 'master'

Author attributes clean

See merge request !1254
parents 7e3f49ba ced24383
...@@ -87,8 +87,8 @@ module CommitsHelper ...@@ -87,8 +87,8 @@ module CommitsHelper
# avatar: true will prepend the avatar image # avatar: true will prepend the avatar image
# size: size of the avatar image in px # size: size of the avatar image in px
def commit_person_link(commit, options = {}) def commit_person_link(commit, options = {})
source_name = commit.send "#{options[:source]}_name".to_sym source_name = clean(commit.send "#{options[:source]}_name".to_sym)
source_email = commit.send "#{options[:source]}_email".to_sym source_email = clean(commit.send "#{options[:source]}_email".to_sym)
user = User.find_for_commit(source_email, source_name) user = User.find_for_commit(source_email, source_name)
person_name = user.nil? ? source_name : user.name person_name = user.nil? ? source_name : user.name
...@@ -124,4 +124,8 @@ module CommitsHelper ...@@ -124,4 +124,8 @@ module CommitsHelper
def truncate_sha(sha) def truncate_sha(sha)
Commit.truncate_sha(sha) Commit.truncate_sha(sha)
end end
def clean(string)
Sanitize.clean(string, remove_contents: true)
end
end end
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