<%= inline_svg("external-link-logo.svg", class:"icon-img") %>
diff --git a/app/views/users/_profile.html.erb b/app/views/users/_profile.html.erb
index 22082bad2..3416fba78 100644
--- a/app/views/users/_profile.html.erb
+++ b/app/views/users/_profile.html.erb
@@ -138,6 +138,10 @@
<%= f.label :medium_url %>
<%= f.url_field :medium_url %>
+
+ <%= f.label :gitlab_url %>
+ <%= f.url_field :gitlab_url %>
+
<%= f.hidden_field :tab, value: @tab %>
diff --git a/db/migrate/20181111040732_add_gitlab_url_to_users.rb b/db/migrate/20181111040732_add_gitlab_url_to_users.rb
new file mode 100644
index 000000000..73dfccec7
--- /dev/null
+++ b/db/migrate/20181111040732_add_gitlab_url_to_users.rb
@@ -0,0 +1,5 @@
+class AddGitlabUrlToUsers < ActiveRecord::Migration[5.1]
+ def change
+ add_column :users, :gitlab_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 44779ac25..b33c6c097 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20181020195954) do
+ActiveRecord::Schema.define(version: 20181111040732) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -712,6 +712,7 @@ ActiveRecord::Schema.define(version: 20181020195954) do
t.integer "following_users_count", default: 0, null: false
t.datetime "github_created_at"
t.string "github_username"
+ t.string "gitlab_url"
t.jsonb "language_settings", default: {}, null: false
t.datetime "last_followed_at"
t.datetime "last_moderation_notification", default: "2017-01-01 05:00:00"
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index d9a8d287f..cfa5ad2c6 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -156,6 +156,18 @@ RSpec.describe User, type: :model do
expect(user).not_to be_valid
end
+ it "accepts valid https gitlab url" do
+ %w(jess jess/ je-ss je_ss).each do |username|
+ user.gitlab_url = "https://gitlab.com/#{username}"
+ expect(user).to be_valid
+ end
+ end
+
+ it "does not accept invalid gitlab url" do
+ user.gitlab_url = "ben.com"
+ expect(user).not_to be_valid
+ end
+
it "changes old_username if old_old_username properly if username changes" do
old_username = user.username
random_new_username = "username_#{rand(100000000)}"