Merged pull request #55.
This commit is contained in:
@@ -149,9 +149,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, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
|
||||
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
|
||||
else
|
||||
userdata = user_params([:name, :skype, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
|
||||
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
|
||||
end
|
||||
if User.find_by(name: userdata[:name]) && User.find_by(name: userdata[:name]) != @user
|
||||
flash[:alert] = "You have entered a name that belongs to someone else. Please try another."
|
||||
|
||||
@@ -18,9 +18,11 @@ class User < ActiveRecord::Base
|
||||
validates_length_of :name, in: 2..30
|
||||
validates_length_of :about, maximum: 5000
|
||||
validates_length_of :ign, minimum: 1, maximum: 16
|
||||
validates_length_of :discord, minimum: 2, maximum: 37 # The maximum length of a name is 32, but you need the # and four numbers
|
||||
|
||||
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."}
|
||||
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
|
||||
validates :discord, uniqueness: {case_sensitive: false}, format: {with: /\A^(?!everyone|here|discordtag|.*```.*)([^@#:]{2,32}#[0-9]{4})$\z/i, message: "Discord name is invalid."}
|
||||
|
||||
validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."}
|
||||
|
||||
@@ -168,7 +170,7 @@ class User < ActiveRecord::Base
|
||||
self.ign.strip! if self.ign
|
||||
self.email.strip! if self.email
|
||||
self.about.strip! if self.about
|
||||
self.skype.strip! if self.skype
|
||||
self.discord.strip! if self.discord
|
||||
self.youtube.strip! if self.youtube
|
||||
self.twitter.strip! if self.twitter
|
||||
end
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>Skype username</td>
|
||||
<td>Discord username</td>
|
||||
<td>
|
||||
<%= f.text_field :skype, placeholder: "Skype username", disabled: !can_edit? %>
|
||||
<%= f.text_field :discord, placeholder: "Discord username", disabled: !can_edit? %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<% if !@user.confirmed? %>
|
||||
<% if @user.is?(current_user) || mod? %>
|
||||
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span>
|
||||
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
|
||||
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn blue", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
|
||||
<% else %>
|
||||
<span class="user-unconfirmed">This user hasn't confirmed their email yet!</span>
|
||||
<% end %>
|
||||
@@ -54,10 +54,10 @@
|
||||
<td><b>Role</b></td>
|
||||
<td><%= link_to @user.role, users_path(:role => @user.role.name) %></td>
|
||||
</tr>
|
||||
<% if current_user && !@user.skype.blank? %>
|
||||
<% if current_user && !@user.discord.blank? %>
|
||||
<tr>
|
||||
<td><b>Skype</b></td>
|
||||
<td><%= link_to @user.skype, "skype:#{@user.skype}?chat", target: "_blank" %></a></td>
|
||||
<td><b>Discord</b></td>
|
||||
<td><%= @user.discord %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %>
|
||||
|
||||
Reference in New Issue
Block a user