diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 49d0df64b..88ab65b94 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -49,6 +49,7 @@ module Admin medium_url gitlab_url linkedin_url + twitch_url ] accessible << %i[password password_confirmation] if params[:user][:password].present? verify_usernames params.require(:user).permit(accessible) diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb index 025c97d90..fcddce779 100644 --- a/app/dashboards/user_dashboard.rb +++ b/app/dashboards/user_dashboard.rb @@ -38,6 +38,7 @@ class UserDashboard < Administrate::BaseDashboard medium_url: Field::String, gitlab_url: Field::String, linkedin_url: Field::String, + twitch_url: Field::String, feed_admin_publish_permission: Field::Boolean, feed_mark_canonical: Field::Boolean, saw_onboarding: Field::Boolean, @@ -83,6 +84,7 @@ class UserDashboard < Administrate::BaseDashboard medium_url gitlab_url linkedin_url + twitch_url bg_color_hex text_color_hex reputation_modifier diff --git a/app/models/user.rb b/app/models/user.rb index 1cc8811ce..901120530 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -92,6 +92,9 @@ class User < ApplicationRecord validates :gitlab_url, allow_blank: true, format: /\A(http(s)?:\/\/)?(www.gitlab.com|gitlab.com)\/.*\Z/ + validates :twitch_url, + allow_blank: true, + format: /\A(http(s)?:\/\/)?(www.twitch.tv|twitch.tv)\/.*\Z/ validates :shirt_gender, inclusion: { in: %w[unisex womens], message: "%{value} is not a valid shirt style" }, diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index ada727199..dbcae75f8 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -116,6 +116,7 @@ class UserPolicy < ApplicationPolicy stackoverflow_url summary text_color_hex + twitch_url username website_url export_requested] diff --git a/app/services/moderator/banish_user.rb b/app/services/moderator/banish_user.rb index a0e853530..8adac1bfc 100644 --- a/app/services/moderator/banish_user.rb +++ b/app/services/moderator/banish_user.rb @@ -50,7 +50,7 @@ module Moderator location: "", education: "", employer_name: "", employer_url: "", employment_title: "", mostly_work_with: "", currently_learning: "", currently_hacking_on: "", available_for: "", email_public: false, facebook_url: nil, dribbble_url: nil, medium_url: nil, stackoverflow_url: nil, - behance_url: nil, linkedin_url: nil, gitlab_url: nil, mastodon_url: nil + behance_url: nil, linkedin_url: nil, gitlab_url: nil, mastodon_url: nil, twitch_url: nil ) user.update_columns(profile_image: "https://thepracticaldev.s3.amazonaws.com/i/99mvlsfu5tfj9m7ku25d.png") diff --git a/app/views/users/_profile.html.erb b/app/views/users/_profile.html.erb index 6d66d62ae..fbb416fb4 100644 --- a/app/views/users/_profile.html.erb +++ b/app/views/users/_profile.html.erb @@ -103,7 +103,7 @@
<%= f.label :currently_learning, "I'm getting into" %> - <%= f.text_area :currently_learning, placeholder: "What are you learning right now? what are the new tools and languages you're picking up in #{Time.new.year}?", maxlength: 500 %> + <%= f.text_area :currently_learning, placeholder: "What are you learning right now? what are the new tools and languages you're picking up in #{Time.zone.now.year}?", maxlength: 500 %>
<%= f.label :currently_hacking_on, "My projects and hacks" %> @@ -145,6 +145,10 @@
<%= f.label :mastodon_url, "Mastodon URL" %> <%= f.url_field :mastodon_url %> +
+
+ <%= f.label :twitch_url, "Twitch URL" %> + <%= f.url_field :twitch_url %>
diff --git a/app/views/users/_profile_header.html.erb b/app/views/users/_profile_header.html.erb index 21c601e0c..0560c71bf 100644 --- a/app/views/users/_profile_header.html.erb +++ b/app/views/users/_profile_header.html.erb @@ -24,7 +24,7 @@

- <%= @user.summary.present? ? @user.summary : ["404 bio not found"].sample %> + <%= @user.summary.presence || ["404 bio not found"].sample %>