From b4af851ad01ffd43a182a99f21f572276326502d Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Fri, 10 Nov 2017 14:29:19 -0500 Subject: Made messages shown on user profile pages more accurate based on who is viewing. --- app/controllers/users_controller.rb | 6 +++++- app/views/users/show.html.erb | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 66b07fd..ed1c2a6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -19,7 +19,11 @@ class UsersController < ApplicationController begin @ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid} rescue - flash.now[:alert] = "An error occured while checking if this user is banned from the server!" + if @user.is?(current_user) + flash.now[:alert] = "An error occured while checking if you are banned from the server!" + else + flash.now[:alert] = "An error occured while checking if this user is banned from the server!" + end @ban_json = nil end end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index cafe726..fb0c174 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -16,16 +16,27 @@
<% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %> - This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%> + <% if @user.is?(current_user) %> + You are banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%> + <% else %> + This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%> + <% end %> <% end %> <% if @user.banned? %> + <% if @user.is?(current_user) %> + You are banned on the website! + <% else %> This user is banned on the website! + <% end %> <% end %>
<% if !@user.confirmed? %> - <% if @user.is?(current_user) || mod? %> - Please confirm your email <%= @user.email %> ! + <% if @user.is?(current_user) %> + You haven't confirmed your email "<%= @user.email %>" yet! <%= 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?"} %> + <% elsif mod? %> + This user hasn't confirmed their email "<%= @user.email %>" yet! + <%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block" %> <% else %> This user hasn't confirmed their email yet! <% end %> -- cgit v1.2.3