<%= inline_svg("facebook-logo.svg", class:"icon-img") %>
diff --git a/app/views/users/_profile.html.erb b/app/views/users/_profile.html.erb
index 3416fba78..443e1269c 100644
--- a/app/views/users/_profile.html.erb
+++ b/app/views/users/_profile.html.erb
@@ -142,6 +142,10 @@
<%= f.label :gitlab_url %>
<%= f.url_field :gitlab_url %>
+
+ <%= f.label :mastodon_url %>
+ <%= f.url_field :mastodon_url %>
+
<%= f.hidden_field :tab, value: @tab %>
diff --git a/db/migrate/20181117145537_add_mastodon_url_to_users.rb b/db/migrate/20181117145537_add_mastodon_url_to_users.rb
new file mode 100644
index 000000000..b19bd55c0
--- /dev/null
+++ b/db/migrate/20181117145537_add_mastodon_url_to_users.rb
@@ -0,0 +1,5 @@
+class AddMastodonUrlToUsers < ActiveRecord::Migration[5.1]
+ def change
+ add_column :users, :mastodon_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index b45953acb..fd82cbac2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -800,6 +800,7 @@ ActiveRecord::Schema.define(version: 20181129222416) do
t.string "username"
t.string "website_url"
t.datetime "workshop_expiration"
+ t.string "mastodon_url"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["language_settings"], name: "index_users_on_language_settings", using: :gin
t.index ["organization_id"], name: "index_users_on_organization_id"
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8ec7506ce..e8706f68a 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -59,6 +59,21 @@ RSpec.describe User, type: :model do
expect(user).not_to be_valid
end
+ it "accepts valid https mastodon url" do
+ user.mastodon_url = "https://mastodon.social/@test"
+ expect(user).to be_valid
+ end
+
+ it "does not accept a non whitelisted mastodon instance" do
+ user.mastodon_url = "https://SpammyMcSpamface.com/"
+ expect(user).not_to be_valid
+ end
+
+ it "does not accept invalid mastodon url" do
+ user.mastodon_url = "mastodon.social/@test"
+ expect(user).not_to be_valid
+ end
+
it "accepts valid http website url" do
user.website_url = "http://ben.com"
expect(user).to be_valid