From 7b2af50f4a12da6f18c4b5d89ee1264e252c6da9 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 11 Apr 2018 11:42:33 +0800 Subject: [PATCH 1/1] Refactor @this_user to @user Historically we used @user for the currently logged in user, but this was changed to `current_user` in 2017. --- app/controllers/application_controller.rb | 8 +- app/controllers/diary_entry_controller.rb | 14 ++-- app/controllers/message_controller.rb | 6 +- app/controllers/notes_controller.rb | 10 +-- app/controllers/user_blocks_controller.rb | 10 +-- app/controllers/user_controller.rb | 28 +++---- app/controllers/user_roles_controller.rb | 24 +++--- app/views/diary_entry/_diary_entry.html.erb | 2 +- app/views/diary_entry/comments.html.erb | 2 +- app/views/diary_entry/list.html.erb | 12 +-- app/views/user/_contact.html.erb | 4 +- app/views/user/api_read.builder | 54 ++++++------- app/views/user/view.html.erb | 90 ++++++++++----------- app/views/user_blocks/blocks_by.html.erb | 6 +- app/views/user_blocks/blocks_on.html.erb | 6 +- app/views/user_blocks/new.html.erb | 10 +-- 16 files changed, 143 insertions(+), 143 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c354b5386..9951d29ae 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -175,7 +175,7 @@ class ApplicationController < ActionController::Base end def authorize(realm = "Web Password", errormessage = "Couldn't authenticate you") - # make the @user object from any auth sources we have + # make the current_user object from any auth sources we have setup_user_auth # handle authenticate pass/fail @@ -377,9 +377,9 @@ class ApplicationController < ActionController::Base end ## - # ensure that there is a "this_user" instance variable - def lookup_this_user - render_unknown_user params[:display_name] unless @this_user = User.active.find_by(:display_name => params[:display_name]) + # ensure that there is a "user" instance variable + def lookup_user + render_unknown_user params[:display_name] unless @user = User.active.find_by(:display_name => params[:display_name]) end ## diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index 7f5f4fb3a..a3378a4c9 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -4,7 +4,7 @@ class DiaryEntryController < ApplicationController before_action :authorize_web before_action :set_locale before_action :require_user, :only => [:new, :edit, :comment, :hide, :hidecomment, :subscribe, :unsubscribe] - before_action :lookup_this_user, :only => [:view, :comments] + before_action :lookup_user, :only => [:view, :comments] before_action :check_database_readable before_action :check_database_writable, :only => [:new, :edit, :comment, :hide, :hidecomment, :subscribe, :unsubscribe] before_action :require_administrator, :only => [:hide, :hidecomment] @@ -101,11 +101,11 @@ class DiaryEntryController < ApplicationController def list if params[:display_name] - @this_user = User.active.find_by(:display_name => params[:display_name]) + @user = User.active.find_by(:display_name => params[:display_name]) - if @this_user - @title = t "diary_entry.list.user_title", :user => @this_user.display_name - @entries = @this_user.diary_entries + if @user + @title = t "diary_entry.list.user_title", :user => @user.display_name + @entries = @user.diary_entries else render_unknown_user params[:display_name] return @@ -181,7 +181,7 @@ class DiaryEntryController < ApplicationController end def view - @entry = @this_user.diary_entries.visible.where(:id => params[:id]).first + @entry = @user.diary_entries.visible.where(:id => params[:id]).first if @entry @title = t "diary_entry.view.title", :user => params[:display_name], :title => @entry.title else @@ -205,7 +205,7 @@ class DiaryEntryController < ApplicationController def comments @comment_pages, @comments = paginate(:diary_comments, :conditions => { - :user_id => @this_user, + :user_id => @user, :visible => true }, :order => "created_at DESC", diff --git a/app/controllers/message_controller.rb b/app/controllers/message_controller.rb index 3952b67ca..d167755d4 100644 --- a/app/controllers/message_controller.rb +++ b/app/controllers/message_controller.rb @@ -4,7 +4,7 @@ class MessageController < ApplicationController before_action :authorize_web before_action :set_locale before_action :require_user - before_action :lookup_this_user, :only => [:new] + before_action :lookup_user, :only => [:new] before_action :check_database_readable before_action :check_database_writable, :only => [:new, :reply, :mark] before_action :allow_thirdparty_images, :only => [:new, :read] @@ -19,7 +19,7 @@ class MessageController < ApplicationController flash[:error] = t "message.new.limit_exceeded" else @message = Message.new(message_params) - @message.recipient = @this_user + @message.recipient = @user @message.sender = current_user @message.sent_on = Time.now.getutc @@ -31,7 +31,7 @@ class MessageController < ApplicationController end end - @message ||= Message.new(message_params.merge(:recipient => @this_user)) + @message ||= Message.new(message_params.merge(:recipient => @user)) @title = t "message.new.title" end diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index a51d70f90..b1dd6d162 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -278,14 +278,14 @@ class NotesController < ApplicationController # Display a list of notes by a specified user def mine if params[:display_name] - if @this_user = User.active.find_by(:display_name => params[:display_name]) + if @user = User.active.find_by(:display_name => params[:display_name]) @params = params.permit(:display_name) - @title = t "note.mine.title", :user => @this_user.display_name - @heading = t "note.mine.heading", :user => @this_user.display_name - @description = t "note.mine.subheading", :user => render_to_string(:partial => "user", :object => @this_user) + @title = t "note.mine.title", :user => @user.display_name + @heading = t "note.mine.heading", :user => @user.display_name + @description = t "note.mine.subheading", :user => render_to_string(:partial => "user", :object => @user) @page = (params[:page] || 1).to_i @page_size = 10 - @notes = @this_user.notes + @notes = @user.notes @notes = @notes.visible unless current_user && current_user.moderator? @notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author).to_a else diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index c41501367..4a55c9ba2 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -5,7 +5,7 @@ class UserBlocksController < ApplicationController before_action :set_locale before_action :require_user, :only => [:new, :create, :edit, :update, :revoke] before_action :require_moderator, :only => [:new, :create, :edit, :update, :revoke] - before_action :lookup_this_user, :only => [:new, :create, :blocks_on, :blocks_by] + before_action :lookup_user, :only => [:new, :create, :blocks_on, :blocks_by] before_action :lookup_user_block, :only => [:show, :edit, :update, :revoke] before_action :require_valid_params, :only => [:create, :update] before_action :check_database_readable @@ -37,7 +37,7 @@ class UserBlocksController < ApplicationController def create if @valid_params @user_block = UserBlock.new( - :user => @this_user, + :user => @user, :creator => current_user, :reason => params[:user_block][:reason], :ends_at => Time.now.getutc + @block_period.hours, @@ -45,7 +45,7 @@ class UserBlocksController < ApplicationController ) if @user_block.save - flash[:notice] = t("user_block.create.flash", :name => @this_user.display_name) + flash[:notice] = t("user_block.create.flash", :name => @user.display_name) redirect_to @user_block else render :action => "new" @@ -92,7 +92,7 @@ class UserBlocksController < ApplicationController @params = params.permit(:display_name) @user_blocks_pages, @user_blocks = paginate(:user_blocks, :include => [:user, :creator, :revoker], - :conditions => { :user_id => @this_user.id }, + :conditions => { :user_id => @user.id }, :order => "user_blocks.ends_at DESC", :per_page => 20) end @@ -103,7 +103,7 @@ class UserBlocksController < ApplicationController @params = params.permit(:display_name) @user_blocks_pages, @user_blocks = paginate(:user_blocks, :include => [:user, :creator, :revoker], - :conditions => { :creator_id => @this_user.id }, + :conditions => { :creator_id => @user.id }, :order => "user_blocks.ends_at DESC", :per_page => 20) end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 0c3ad0b05..54e2fa9c0 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -377,7 +377,7 @@ class UserController < ApplicationController end def api_read - if @this_user.visible? + if @user.visible? render :action => :api_read, :content_type => "text/xml" else head :gone @@ -385,7 +385,7 @@ class UserController < ApplicationController end def api_details - @this_user = current_user + @user = current_user render :action => :api_read, :content_type => "text/xml" end @@ -398,11 +398,11 @@ class UserController < ApplicationController end def view - @this_user = User.find_by(:display_name => params[:display_name]) + @user = User.find_by(:display_name => params[:display_name]) - if @this_user && - (@this_user.visible? || (current_user && current_user.administrator?)) - @title = @this_user.display_name + if @user && + (@user.visible? || (current_user && current_user.administrator?)) + @title = @user.display_name else render_unknown_user params[:display_name] end @@ -462,15 +462,15 @@ class UserController < ApplicationController ## # sets a user's status def set_status - @this_user.status = params[:status] - @this_user.save + @user.status = params[:status] + @user.save redirect_to :action => "view", :display_name => params[:display_name] end ## # delete a user, marking them as deleted and removing personal data def delete - @this_user.delete + @user.delete redirect_to :action => "view", :display_name => params[:display_name] end @@ -761,17 +761,17 @@ class UserController < ApplicationController end ## - # ensure that there is a "this_user" instance variable + # ensure that there is a "user" instance variable def lookup_user_by_id - @this_user = User.find(params[:id]) + @user = User.find(params[:id]) end ## - # ensure that there is a "this_user" instance variable + # ensure that there is a "user" instance variable def lookup_user_by_name - @this_user = User.find_by(:display_name => params[:display_name]) + @user = User.find_by(:display_name => params[:display_name]) rescue ActiveRecord::RecordNotFound - redirect_to :action => "view", :display_name => params[:display_name] unless @this_user + redirect_to :action => "view", :display_name => params[:display_name] unless @user end ## diff --git a/app/controllers/user_roles_controller.rb b/app/controllers/user_roles_controller.rb index 37d4da00e..732a2bb2c 100644 --- a/app/controllers/user_roles_controller.rb +++ b/app/controllers/user_roles_controller.rb @@ -3,25 +3,25 @@ class UserRolesController < ApplicationController before_action :authorize_web before_action :require_user - before_action :lookup_this_user + before_action :lookup_user before_action :require_administrator before_action :require_valid_role before_action :not_in_role, :only => [:grant] before_action :in_role, :only => [:revoke] def grant - @this_user.roles.create(:role => @role, :granter => current_user) - redirect_to user_path(@this_user) + @user.roles.create(:role => @role, :granter => current_user) + redirect_to user_path(@user) end def revoke # checks that administrator role is not revoked from current user - if current_user == @this_user && @role == "administrator" + if current_user == @user && @role == "administrator" flash[:error] = t("user_role.filter.not_revoke_admin_current_user") else - UserRole.where(:user_id => @this_user.id, :role => @role).delete_all + UserRole.where(:user_id => @user.id, :role => @role).delete_all end - redirect_to user_path(@this_user) + redirect_to user_path(@user) end private @@ -32,7 +32,7 @@ class UserRolesController < ApplicationController def require_administrator unless current_user.administrator? flash[:error] = t "user_role.filter.not_an_administrator" - redirect_to user_path(@this_user) + redirect_to user_path(@user) end end @@ -43,25 +43,25 @@ class UserRolesController < ApplicationController @role = params[:role] unless UserRole::ALL_ROLES.include?(@role) flash[:error] = t("user_role.filter.not_a_role", :role => @role) - redirect_to user_path(@this_user) + redirect_to user_path(@user) end end ## # checks that the user doesn't already have this role def not_in_role - if @this_user.has_role? @role + if @user.has_role? @role flash[:error] = t("user_role.filter.already_has_role", :role => @role) - redirect_to user_path(@this_user) + redirect_to user_path(@user) end end ## # checks that the user already has this role def in_role - unless @this_user.has_role? @role + unless @user.has_role? @role flash[:error] = t("user_role.filter.doesnt_have_role", :role => @role) - redirect_to user_path(@this_user) + redirect_to user_path(@user) end end end diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entry/_diary_entry.html.erb index 763915e46..46565869e 100644 --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entry/_diary_entry.html.erb @@ -1,6 +1,6 @@
- <% if !@this_user %> + <% if !@user %> <%= user_thumbnail diary_entry.user %> <% end %> diff --git a/app/views/diary_entry/comments.html.erb b/app/views/diary_entry/comments.html.erb index 9dc800cff..4e0350896 100644 --- a/app/views/diary_entry/comments.html.erb +++ b/app/views/diary_entry/comments.html.erb @@ -1,5 +1,5 @@ <% content_for :heading do %> -

<%= t('diary_entry.comments.has_commented_on', :display_name => @this_user.display_name) %>

+

<%= t('diary_entry.comments.has_commented_on', :display_name => @user.display_name) %>

<% end %> diff --git a/app/views/diary_entry/list.html.erb b/app/views/diary_entry/list.html.erb index d6af432fb..e6e304ead 100644 --- a/app/views/diary_entry/list.html.erb +++ b/app/views/diary_entry/list.html.erb @@ -1,7 +1,7 @@ <% content_for :heading do %> -
id="userinformation"<% end %> > - <% if @this_user %> - <%= user_image @this_user %> +
id="userinformation"<% end %> > + <% if @user %> + <%= user_image @user %> <% end %>

<%= h(@title) %>

@@ -10,8 +10,8 @@
  • <%= rss_link_to :action => 'rss', :language => params[:language] %>
  • <% end -%> - <% if @this_user %> - <%= if_user(@this_user) do %> + <% if @user %> + <%= if_user(@user) do %>
  • <%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('diary_entry.list.new_title')} %>
  • <% end %> <% else %> @@ -28,7 +28,7 @@ <% else %>

    <%= t 'diary_entry.list.recent_entries' %>

    - <% if @this_user %> + <% if @user %> <%= render :partial => 'diary_entry', :collection => @entries %> <% else %> <%= render :partial => 'diary_list_entry', :collection => @entries %> diff --git a/app/views/user/_contact.html.erb b/app/views/user/_contact.html.erb index bb1dff0dc..2697d0302 100644 --- a/app/views/user/_contact.html.erb +++ b/app/views/user/_contact.html.erb @@ -11,8 +11,8 @@

    <%= link_to h(contact.display_name), user_path(contact) %> - <% if @this_user.home_lon and @this_user.home_lat and contact.home_lon and contact.home_lat %> - <% distance = @this_user.distance(contact) %> + <% if @user.home_lon and @user.home_lat and contact.home_lon and contact.home_lat %> + <% distance = @user.distance(contact) %> <% if distance < 1 %> (<%= t 'user.view.m away', :count => (distance * 1000).round %>) <% else %> diff --git a/app/views/user/api_read.builder b/app/views/user/api_read.builder index fe5af4bcf..4ed8c9e94 100644 --- a/app/views/user/api_read.builder +++ b/app/views/user/api_read.builder @@ -1,46 +1,46 @@ xml.instruct! :xml, :version => "1.0" xml.osm("version" => API_VERSION, "generator" => GENERATOR) do - xml.tag! "user", :id => @this_user.id, - :display_name => @this_user.display_name, - :account_created => @this_user.creation_time.xmlschema do - xml.tag! "description", @this_user.description if @this_user.description - if current_user && current_user == @this_user - xml.tag! "contributor-terms", :agreed => @this_user.terms_agreed.present?, - :pd => @this_user.consider_pd + xml.tag! "user", :id => @user.id, + :display_name => @user.display_name, + :account_created => @user.creation_time.xmlschema do + xml.tag! "description", @user.description if @user.description + if current_user && current_user == @user + xml.tag! "contributor-terms", :agreed => @user.terms_agreed.present?, + :pd => @user.consider_pd else - xml.tag! "contributor-terms", :agreed => @this_user.terms_agreed.present? + xml.tag! "contributor-terms", :agreed => @user.terms_agreed.present? end - xml.tag! "img", :href => user_image_url(@this_user, :size => 256) if @this_user.image.file? || @this_user.image_use_gravatar + xml.tag! "img", :href => user_image_url(@user, :size => 256) if @user.image.file? || @user.image_use_gravatar xml.tag! "roles" do - @this_user.roles.each do |role| + @user.roles.each do |role| xml.tag! role.role end end - xml.tag! "changesets", :count => @this_user.changesets.size - xml.tag! "traces", :count => @this_user.traces.size + xml.tag! "changesets", :count => @user.changesets.size + xml.tag! "traces", :count => @user.traces.size xml.tag! "blocks" do - xml.tag! "received", :count => @this_user.blocks.size, - :active => @this_user.blocks.active.size - if @this_user.moderator? - xml.tag! "issued", :count => @this_user.blocks_created.size, - :active => @this_user.blocks_created.active.size + xml.tag! "received", :count => @user.blocks.size, + :active => @user.blocks.active.size + if @user.moderator? + xml.tag! "issued", :count => @user.blocks_created.size, + :active => @user.blocks_created.active.size end end - if current_user && current_user == @this_user - if @this_user.home_lat && @this_user.home_lon - xml.tag! "home", :lat => @this_user.home_lat, - :lon => @this_user.home_lon, - :zoom => @this_user.home_zoom + if current_user && current_user == @user + if @user.home_lat && @user.home_lon + xml.tag! "home", :lat => @user.home_lat, + :lon => @user.home_lon, + :zoom => @user.home_zoom end - if @this_user.languages + if @user.languages xml.tag! "languages" do - @this_user.languages.split(",") { |lang| xml.tag! "lang", lang } + @user.languages.split(",") { |lang| xml.tag! "lang", lang } end end xml.tag! "messages" do - xml.tag! "received", :count => @this_user.messages.size, - :unread => @this_user.new_messages.size - xml.tag! "sent", :count => @this_user.sent_messages.size + xml.tag! "received", :count => @user.messages.size, + :unread => @user.new_messages.size + xml.tag! "sent", :count => @user.sent_messages.size end end end diff --git a/app/views/user/view.html.erb b/app/views/user/view.html.erb index 119fe10a4..fedbad80e 100644 --- a/app/views/user/view.html.erb +++ b/app/views/user/view.html.erb @@ -1,9 +1,9 @@ <% content_for :heading do %>

    - <%= user_image @this_user %> + <%= user_image @user %>
    -

    <%= @this_user.display_name %><%= role_icons(@this_user) %>

    - <% if current_user and @this_user.id == current_user.id %> +

    <%= @user.display_name %><%= role_icons(@user) %>

    + <% if current_user and @user.id == current_user.id %>
    • @@ -49,56 +49,56 @@
      • - <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %> - <%= number_with_delimiter(@this_user.changesets.size) %> + <%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %> + <%= number_with_delimiter(@user.changesets.size) %>
      • <%= link_to t('user.view.notes'), :controller => 'notes', :action=> 'mine' %>
      • - <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @this_user.display_name %> - <%= number_with_delimiter(@this_user.traces.size) %> + <%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @user.display_name %> + <%= number_with_delimiter(@user.traces.size) %>
      • - <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @this_user.display_name %> + <%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => @user.display_name %>
      • - <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %> - <%= number_with_delimiter(@this_user.diary_entries.size) %> + <%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @user.display_name %> + <%= number_with_delimiter(@user.diary_entries.size) %>
      • - <%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %> + <%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @user.display_name %>
      • - <% if current_user and current_user.is_friends_with?(@this_user) %> - <%= link_to t('user.view.remove as friend'), remove_friend_path(:display_name => @this_user.display_name), :method => :post %> + <% if current_user and current_user.is_friends_with?(@user) %> + <%= link_to t('user.view.remove as friend'), remove_friend_path(:display_name => @user.display_name), :method => :post %> <% elsif current_user %> - <%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @this_user.display_name), :method => :post %> + <%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @user.display_name), :method => :post %> <% else %> - <%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @this_user.display_name) %> + <%= link_to t('user.view.add as friend'), make_friend_path(:display_name => @user.display_name) %> <% end %>
      • - <% if @this_user.blocks.exists? %> + <% if @user.blocks.exists? %>
      • - <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @this_user.display_name %> - <%= number_with_delimiter(@this_user.blocks.active.size) %> + <%= link_to t('user.view.block_history'), :controller => 'user_blocks', :action => 'blocks_on', :display_name => @user.display_name %> + <%= number_with_delimiter(@user.blocks.active.size) %>
      • <% end %> - <% if @this_user.moderator? and @this_user.blocks_created.exists? %> + <% if @user.moderator? and @user.blocks_created.exists? %>
      • - <%= link_to t('user.view.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @this_user.display_name %> - <%= number_with_delimiter(@this_user.blocks_created.active.size) %> + <%= link_to t('user.view.moderator_history'), :controller => 'user_blocks', :action => 'blocks_by', :display_name => @user.display_name %> + <%= number_with_delimiter(@user.blocks_created.active.size) %>
      • <% end %> <% if current_user and current_user.moderator? %>
      • - <%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @this_user.display_name %> + <%= link_to t('user.view.create_block'), :controller => 'user_blocks', :action => 'new', :display_name => @user.display_name %>
      • <% end %> @@ -109,30 +109,30 @@ <% if current_user and current_user.administrator? %>
          - <% if ["active", "confirmed"].include? @this_user.status %> + <% if ["active", "confirmed"].include? @user.status %>
        • - <%= link_to t('user.view.deactivate_user'), set_status_user_path(:status => 'pending', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <%= link_to t('user.view.deactivate_user'), set_status_user_path(:status => 'pending', :display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %>
        • - <% elsif ["pending"].include? @this_user.status %> + <% elsif ["pending"].include? @user.status %>
        • - <%= link_to t('user.view.activate_user'), set_status_user_path(:status => 'active', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <%= link_to t('user.view.activate_user'), set_status_user_path(:status => 'active', :display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %>
        • <% end %> - <% if ["active", "suspended"].include? @this_user.status %> + <% if ["active", "suspended"].include? @user.status %>
        • - <%= link_to t('user.view.confirm_user'), set_status_user_path(:status => 'confirmed', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <%= link_to t('user.view.confirm_user'), set_status_user_path(:status => 'confirmed', :display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %>
        • <% end %>
        • - <% if ["pending", "active", "confirmed", "suspended"].include? @this_user.status %> - <%= link_to t('user.view.hide_user'), set_status_user_path(:status => 'deleted', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <% if ["pending", "active", "confirmed", "suspended"].include? @user.status %> + <%= link_to t('user.view.hide_user'), set_status_user_path(:status => 'deleted', :display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %> <% else %> - <%= link_to t('user.view.unhide_user'), set_status_user_path(:status => 'active', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <%= link_to t('user.view.unhide_user'), set_status_user_path(:status => 'active', :display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %>
        • <% end %>
        • - <%= link_to t('user.view.delete_user'), delete_user_path(:display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> + <%= link_to t('user.view.delete_user'), delete_user_path(:display_name => @user.display_name), :data => { :confirm => t('user.view.confirm') } %>
        @@ -140,11 +140,11 @@

        - <%= t 'user.view.mapper since' %> <%= l @this_user.creation_time.to_date, :format => :long %> - <% unless @this_user.terms_agreed %> + <%= t 'user.view.mapper since' %> <%= l @user.creation_time.to_date, :format => :long %> + <% unless @user.terms_agreed %> | <%= t 'user.view.ct status' %> - <% if @this_user.terms_seen? -%> + <% if @user.terms_seen? -%> <%= t 'user.view.ct declined' %> <% else -%> <%= t 'user.view.ct undecided' %> @@ -154,25 +154,25 @@

    -
    <%= @this_user.description.to_html %>
    +
    <%= @user.description.to_html %>
    <% if current_user and current_user.administrator? -%> <% end -%> <% end %> - <% if current_user and @this_user.id == current_user.id %> - <% if @this_user.home_lat.nil? or @this_user.home_lon.nil? %> + <% if current_user and @user.id == current_user.id %> + <% if @user.home_lat.nil? or @user.home_lon.nil? %>

    <%= raw(t 'user.view.if set location', :settings_link => (link_to t('user.view.settings_link_text'), :controller => 'user', :action => 'account', :display_name => current_user.display_name)) %>

    @@ -191,8 +191,8 @@ <%= content_tag "div", "", :id => "map", :class => "content_map", :data => {:user => user_data} %> <% end %> - <% friends = @this_user.friends.collect { |f| f.befriendee } %> - <% nearby = @this_user.nearby - friends %> + <% friends = @user.friends.collect { |f| f.befriendee } %> + <% nearby = @user.nearby - friends %>

    <%= t 'user.view.my friends' %>

    diff --git a/app/views/user_blocks/blocks_by.html.erb b/app/views/user_blocks/blocks_by.html.erb index 02f6f17ce..8b7a290fc 100644 --- a/app/views/user_blocks/blocks_by.html.erb +++ b/app/views/user_blocks/blocks_by.html.erb @@ -1,10 +1,10 @@ -<% @title = t('user_block.blocks_by.title', :name => h(@this_user.display_name)) %> +<% @title = t('user_block.blocks_by.title', :name => h(@user.display_name)) %> <% content_for :heading do %> -

    <%= raw(t('user_block.blocks_by.heading', :name => link_to(h(@this_user.display_name), user_path(@this_user)))) %>

    +

    <%= raw(t('user_block.blocks_by.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

    <% end %> <% unless @user_blocks.empty? %> <%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => true, :show_creator_name => false } %> <% else %> -

    <%= t "user_block.blocks_by.empty", :name => h(@this_user.display_name) %>

    +

    <%= t "user_block.blocks_by.empty", :name => h(@user.display_name) %>

    <% end %> diff --git a/app/views/user_blocks/blocks_on.html.erb b/app/views/user_blocks/blocks_on.html.erb index 18419986a..7abcc8674 100644 --- a/app/views/user_blocks/blocks_on.html.erb +++ b/app/views/user_blocks/blocks_on.html.erb @@ -1,9 +1,9 @@ -<% @title = t('user_block.blocks_on.title', :name => h(@this_user.display_name)) %> +<% @title = t('user_block.blocks_on.title', :name => h(@user.display_name)) %> <% content_for :heading do %> -

    <%= raw(t('user_block.blocks_on.heading', :name => link_to(h(@this_user.display_name), user_path(@this_user)))) %>

    +

    <%= raw(t('user_block.blocks_on.heading', :name => link_to(h(@user.display_name), user_path(@user)))) %>

    <% end %> <% unless @user_blocks.empty? %> <%= render :partial => 'blocks', :locals => { :show_revoke_link => (current_user and current_user.moderator?), :show_user_name => false, :show_creator_name => true } %> <% else %> -

    <%= t "user_block.blocks_on.empty", :name => h(@this_user.display_name) %>

    +

    <%= t "user_block.blocks_on.empty", :name => h(@user.display_name) %>

    <% end %> diff --git a/app/views/user_blocks/new.html.erb b/app/views/user_blocks/new.html.erb index 4161f6af8..f26a91c5c 100644 --- a/app/views/user_blocks/new.html.erb +++ b/app/views/user_blocks/new.html.erb @@ -1,15 +1,15 @@ -<% @title = t 'user_block.new.title', :name => h(@this_user.display_name) %> +<% @title = t 'user_block.new.title', :name => h(@user.display_name) %> <% content_for :heading do %>

    <%= raw t('user_block.new.heading', :name => link_to( - h(@this_user.display_name), - user_path(@this_user))) %>

    + h(@user.display_name), + user_path(@user))) %> <% end %> <%= form_for(@user_block) do |f| %> <%= f.error_messages %>

    - <%= f.label :reason, t('user_block.new.reason', :name => @this_user.display_name) %>
    + <%= f.label :reason, t('user_block.new.reason', :name => @user.display_name) %>
    <%= richtext_area :user_block, :reason, :cols => 80, :rows => 20 %>

    @@ -21,7 +21,7 @@ <%= f.label :needs_view, t('user_block.new.needs_view') %>

    - <%= hidden_field_tag 'display_name', @this_user.display_name %> + <%= hidden_field_tag 'display_name', @user.display_name %> <%= f.submit t('user_block.new.submit') %>

    <% end %> -- 2.39.5