From 8dc051ea46ba46c0e2798495f40bfa3e2bb83074 Mon Sep 17 00:00:00 2001 From: MrYummy Date: Tue, 20 Jun 2017 16:22:56 +0200 Subject: Added ban reason and expiration date to user pages --- app/controllers/users_controller.rb | 2 ++ 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 @@

<%= @user.name %>

- - <% if @user.banned? %> - This user is banned! + <% if @ban_json %> + This used is banned for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%> + <% elsif @user.banned? %> + This user is banned! <% end %> - +
<% if !@user.confirmed? %> <% if @user.is?(current_user) || mod? %> Please confirm your email <%= @user.email %> ! -- cgit v1.2.3