Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def github_ruby_repositories_url

def social_links
links = {}
links[:website] = website if website.present?
links[:website] = ensure_protocol(website) if website.present?
links[:twitter] = "https://twitter.com/#{twitter}" if twitter.present?
links[:linkedin] = linkedin if linkedin.present?
links[:linkedin] = ensure_protocol(linkedin) if linkedin.present?
links[:github] = github_profile_url
links
end
Expand Down Expand Up @@ -245,6 +245,10 @@ def self.linkify_bio(text)

private

def ensure_protocol(url)
url.match?(%r{\A https?:// }x) ? url : "https://#{url}"
end

def precompute_bio_html
self.bio_html = self.class.linkify_bio(bio)
end
Expand Down