Commit 0a8f3ba4 authored by Douwe Maan's avatar Douwe Maan

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
parents 3d44ec3f 835d4487
......@@ -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
......@@ -56,11 +56,11 @@
= icon('skype')
- unless @user.linkedin.blank?
.profile-link-holder.middle-dot-divider
= link_to "https://www.linkedin.com/in/#{@user.linkedin}", title: "LinkedIn" do
= link_to linkedin_url(@user), title: "LinkedIn" do
= icon('linkedin-square')
- unless @user.twitter.blank?
.profile-link-holder.middle-dot-divider
= link_to "https://twitter.com/#{@user.twitter}", title: "Twitter" do
= link_to twitter_url(@user), title: "Twitter" do
= icon('twitter-square')
- unless @user.website_url.blank?
.profile-link-holder.middle-dot-divider
......
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