Added mastodon and mastodon_instance settings to user profiles
This commit is contained in:
@@ -137,9 +137,9 @@ class UsersController < ApplicationController
|
||||
def update
|
||||
if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?)
|
||||
if mod?
|
||||
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
|
||||
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :mastodon, :mastodon_instance, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
|
||||
else
|
||||
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
|
||||
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :mastodon, :mastodon_instance, :about, :header_scroll, :utc_time, :dark])
|
||||
end
|
||||
if userdata[:role]
|
||||
role = Role.get(userdata[:role])
|
||||
|
||||
@@ -167,6 +167,8 @@ class User < ActiveRecord::Base
|
||||
self.email.strip! if self.email
|
||||
self.about.strip! if self.about
|
||||
self.skype.strip! if self.skype
|
||||
self.mastodon.strip! if self.mastodon
|
||||
self.mastodon_instance.strip! if self.mastodon_instance
|
||||
self.youtube.strip! if self.youtube
|
||||
self.twitter.strip! if self.twitter
|
||||
end
|
||||
|
||||
@@ -54,6 +54,13 @@
|
||||
<%= f.select :skype_public, [["Staff only", false], ["All users", true]], {}, { disabled: !can_edit? } %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mastodon</td>
|
||||
<td style="display:inline;padding:0px">
|
||||
<%= f.text_field :mastodon, placeholder: "Mastodon username", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)), style: "width:49%;float:left;margin-right:2%" %>
|
||||
<%= f.text_field :mastodon_instance, placeholder: "Mastodon instance", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)), style: "width:49%" %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>YouTube Channel ID</td>
|
||||
<td>
|
||||
|
||||
@@ -58,6 +58,17 @@
|
||||
<td><%= link_to @user.skype, "skype:#{@user.skype}?chat", target: "_blank" %></a></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@user.mastodon.blank? %>
|
||||
<tr>
|
||||
<td><b>Mastodon</b></td>
|
||||
<td>
|
||||
<% if @user.mastodon_instance %>
|
||||
<%= link_to "@#{@user.mastodon}", "https://#{CGI.escape(@user.mastodon_instance)}/@#{CGI.escape(@user.mastodon)}", :target => "_blank" %></td>
|
||||
<% else %>
|
||||
<%= @user.mastodon %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %>
|
||||
<tr>
|
||||
<td><b>YouTube</b></td>
|
||||
|
||||
Reference in New Issue
Block a user