diff options
author | MrYummy <elemental428@gmail.com> | 2017-06-20 16:22:56 +0200 |
---|---|---|
committer | MrYummy <elemental428@gmail.com> | 2017-06-20 16:22:56 +0200 |
commit | 8dc051ea46ba46c0e2798495f40bfa3e2bb83074 (patch) | |
tree | cfd8216888ddac2de40a817630d4cf0b855ad17f | |
parent | 992406a20b90d47d1ef8a9b4f8d0c599590a1171 (diff) |
Added ban reason and expiration date to user pages
-rw-r--r-- | app/controllers/users_controller.rb | 2 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5dc0e80..702d1e3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -30,6 +30,8 @@ class UsersController < ApplicationController end def show + user = User.find(params[:id]) + @ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"] == user.uuid} end # SIGNUP diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e371a09..eb14575 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -15,11 +15,12 @@ <h1><%= @user.name %></h1> <div class="clear"></div> - - <% if @user.banned? %> - <span class="user-banned">This user is banned!</span> + <% if @ban_json %> + <span class="user-banned">This used is banned for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span> + <% elsif @user.banned? %> + <span class="user-banned">This user is banned!</span> <% end %> - + <br> <% if !@user.confirmed? %> <% if @user.is?(current_user) || mod? %> <span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span> |