diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-16 14:23:09 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-05-16 14:23:09 +0000 |
commit | 0a8f3ba4d2fae41d232246b40f27e9d188e6f981 (patch) | |
tree | 71857cb43d45bdc4315783120af42398d7d96232 /app/helpers | |
parent | 3d44ec3f4aa7180f2226f09064abe281c6b9d7be (diff) | |
parent | 835d4487fb7a67ff0f0254ee4120bcdf12be5a07 (diff) | |
download | gitlab-ce-0a8f3ba4d2fae41d232246b40f27e9d188e6f981.tar.gz |
Merge branch '31386-profile-fix-externallinks' into 'master'
Resolve "Make Twitter Link on Profile page useable by fixing wrong target URL's"
Closes #31386
See merge request !10931
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 97cf4863ddc..e5e64650708 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -278,4 +278,22 @@ module ApplicationHelper def show_user_callout? cookies[:user_callout_dismissed] == 'true' end + + def linkedin_url(user) + name = user.linkedin + if name =~ %r{\Ahttps?:\/\/(www\.)?linkedin\.com\/in\/} + name + else + "https://www.linkedin.com/in/#{name}" + end + end + + def twitter_url(user) + name = user.twitter + if name =~ %r{\Ahttps?:\/\/(www\.)?twitter\.com\/} + name + else + "https://www.twitter.com/#{name}" + end + end end |