Fix new rubocop warnings
This commit is contained in:
parent
61ad3234fc
commit
dc28f1dccc
9 changed files with 38 additions and 38 deletions
|
@ -16,10 +16,10 @@ class ConfirmationsController < ApplicationController
|
||||||
if request.post?
|
if request.post?
|
||||||
token = UserToken.find_by(:token => params[:confirm_string])
|
token = UserToken.find_by(:token => params[:confirm_string])
|
||||||
if token&.user&.active?
|
if token&.user&.active?
|
||||||
flash[:error] = t("confirmations.confirm.already active")
|
flash[:error] = t(".already active")
|
||||||
redirect_to login_path
|
redirect_to login_path
|
||||||
elsif !token || token.expired?
|
elsif !token || token.expired?
|
||||||
flash[:error] = t("confirmations.confirm.unknown token")
|
flash[:error] = t(".unknown token")
|
||||||
redirect_to :action => "confirm"
|
redirect_to :action => "confirm"
|
||||||
elsif !token.user.visible?
|
elsif !token.user.visible?
|
||||||
render_unknown_user token.user.display_name
|
render_unknown_user token.user.display_name
|
||||||
|
@ -40,7 +40,7 @@ class ConfirmationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
if token.nil? || token.user != user
|
if token.nil? || token.user != user
|
||||||
flash[:notice] = t("confirmations.confirm.success")
|
flash[:notice] = t(".success")
|
||||||
redirect_to login_path(:referer => referer)
|
redirect_to login_path(:referer => referer)
|
||||||
else
|
else
|
||||||
token.destroy
|
token.destroy
|
||||||
|
@ -63,7 +63,7 @@ class ConfirmationsController < ApplicationController
|
||||||
token = UserToken.find_by(:token => session[:token])
|
token = UserToken.find_by(:token => session[:token])
|
||||||
|
|
||||||
if user.nil? || token.nil? || token.user != user
|
if user.nil? || token.nil? || token.user != user
|
||||||
flash[:error] = t "confirmations.confirm_resend.failure", :name => params[:display_name]
|
flash[:error] = t ".failure", :name => params[:display_name]
|
||||||
else
|
else
|
||||||
UserMailer.signup_confirm(user, user.tokens.create).deliver_later
|
UserMailer.signup_confirm(user, user.tokens.create).deliver_later
|
||||||
flash[:notice] = { :partial => "confirmations/resend_success_flash", :locals => { :email => user.email, :sender => Settings.email_from } }
|
flash[:notice] = { :partial => "confirmations/resend_success_flash", :locals => { :email => user.email, :sender => Settings.email_from } }
|
||||||
|
@ -83,9 +83,9 @@ class ConfirmationsController < ApplicationController
|
||||||
gravatar_enabled = gravatar_enable(current_user)
|
gravatar_enabled = gravatar_enable(current_user)
|
||||||
if current_user.save
|
if current_user.save
|
||||||
flash[:notice] = if gravatar_enabled
|
flash[:notice] = if gravatar_enabled
|
||||||
"#{t('confirmations.confirm_email.success')} #{gravatar_status_message(current_user)}"
|
"#{t('.success')} #{gravatar_status_message(current_user)}"
|
||||||
else
|
else
|
||||||
t("confirmations.confirm_email.success")
|
t(".success")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:errors] = current_user.errors
|
flash[:errors] = current_user.errors
|
||||||
|
@ -94,9 +94,9 @@ class ConfirmationsController < ApplicationController
|
||||||
session[:user] = current_user.id
|
session[:user] = current_user.id
|
||||||
session[:fingerprint] = current_user.fingerprint
|
session[:fingerprint] = current_user.fingerprint
|
||||||
elsif token
|
elsif token
|
||||||
flash[:error] = t "confirmations.confirm_email.failure"
|
flash[:error] = t ".failure"
|
||||||
else
|
else
|
||||||
flash[:error] = t "confirmations.confirm_email.unknown_token"
|
flash[:error] = t ".unknown_token"
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_account_path
|
redirect_to edit_account_path
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
@user = User.active.find_by(:display_name => params[:display_name])
|
@user = User.active.find_by(:display_name => params[:display_name])
|
||||||
|
|
||||||
if @user
|
if @user
|
||||||
@title = t "diary_entries.index.user_title", :user => @user.display_name
|
@title = t ".user_title", :user => @user.display_name
|
||||||
@entries = @user.diary_entries
|
@entries = @user.diary_entries
|
||||||
else
|
else
|
||||||
render_unknown_user params[:display_name]
|
render_unknown_user params[:display_name]
|
||||||
|
@ -24,7 +24,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
end
|
end
|
||||||
elsif params[:friends]
|
elsif params[:friends]
|
||||||
if current_user
|
if current_user
|
||||||
@title = t "diary_entries.index.title_friends"
|
@title = t ".title_friends"
|
||||||
@entries = DiaryEntry.where(:user_id => current_user.friends)
|
@entries = DiaryEntry.where(:user_id => current_user.friends)
|
||||||
else
|
else
|
||||||
require_user
|
require_user
|
||||||
|
@ -32,7 +32,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
end
|
end
|
||||||
elsif params[:nearby]
|
elsif params[:nearby]
|
||||||
if current_user
|
if current_user
|
||||||
@title = t "diary_entries.index.title_nearby"
|
@title = t ".title_nearby"
|
||||||
@entries = DiaryEntry.where(:user_id => current_user.nearby)
|
@entries = DiaryEntry.where(:user_id => current_user.nearby)
|
||||||
else
|
else
|
||||||
require_user
|
require_user
|
||||||
|
@ -42,10 +42,10 @@ class DiaryEntriesController < ApplicationController
|
||||||
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
|
||||||
|
|
||||||
if params[:language]
|
if params[:language]
|
||||||
@title = t "diary_entries.index.in_language_title", :language => Language.find(params[:language]).english_name
|
@title = t ".in_language_title", :language => Language.find(params[:language]).english_name
|
||||||
@entries = @entries.where(:language_code => params[:language])
|
@entries = @entries.where(:language_code => params[:language])
|
||||||
else
|
else
|
||||||
@title = t "diary_entries.index.title"
|
@title = t ".title"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
|
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
|
||||||
if @entry
|
if @entry
|
||||||
@title = t "diary_entries.show.title", :user => params[:display_name], :title => @entry.title
|
@title = t ".title", :user => params[:display_name], :title => @entry.title
|
||||||
@comments = can?(:unhidecomment, DiaryEntry) ? @entry.comments : @entry.visible_comments
|
@comments = can?(:unhidecomment, DiaryEntry) ? @entry.comments : @entry.visible_comments
|
||||||
else
|
else
|
||||||
@title = t "diary_entries.no_such_entry.title", :id => params[:id]
|
@title = t "diary_entries.no_such_entry.title", :id => params[:id]
|
||||||
|
@ -73,7 +73,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@title = t "diary_entries.new.title"
|
@title = t ".title"
|
||||||
|
|
||||||
default_lang = current_user.preferences.where(:k => "diary.default_language").first
|
default_lang = current_user.preferences.where(:k => "diary.default_language").first
|
||||||
lang_code = default_lang ? default_lang.v : current_user.preferred_language
|
lang_code = default_lang ? default_lang.v : current_user.preferred_language
|
||||||
|
@ -83,7 +83,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@title = t "diary_entries.edit.title"
|
@title = t ".title"
|
||||||
@diary_entry = DiaryEntry.find(params[:id])
|
@diary_entry = DiaryEntry.find(params[:id])
|
||||||
|
|
||||||
redirect_to diary_entry_path(@diary_entry.user, @diary_entry) if current_user != @diary_entry.user
|
redirect_to diary_entry_path(@diary_entry.user, @diary_entry) if current_user != @diary_entry.user
|
||||||
|
|
|
@ -18,14 +18,14 @@ class FriendshipsController < ApplicationController
|
||||||
friendship.befriender = current_user
|
friendship.befriender = current_user
|
||||||
friendship.befriendee = @new_friend
|
friendship.befriendee = @new_friend
|
||||||
if current_user.friends_with?(@new_friend)
|
if current_user.friends_with?(@new_friend)
|
||||||
flash[:warning] = t "friendships.make_friend.already_a_friend", :name => @new_friend.display_name
|
flash[:warning] = t ".already_a_friend", :name => @new_friend.display_name
|
||||||
elsif current_user.friendships.where("created_at >= ?", Time.now.utc - 1.hour).count >= current_user.max_friends_per_hour
|
elsif current_user.friendships.where("created_at >= ?", Time.now.utc - 1.hour).count >= current_user.max_friends_per_hour
|
||||||
flash.now[:error] = t "friendships.make_friend.limit_exceeded"
|
flash.now[:error] = t ".limit_exceeded"
|
||||||
elsif friendship.save
|
elsif friendship.save
|
||||||
flash[:notice] = t "friendships.make_friend.success", :name => @new_friend.display_name
|
flash[:notice] = t ".success", :name => @new_friend.display_name
|
||||||
UserMailer.friendship_notification(friendship).deliver_later
|
UserMailer.friendship_notification(friendship).deliver_later
|
||||||
else
|
else
|
||||||
friendship.add_error(t("friendships.make_friend.failed", :name => @new_friend.display_name))
|
friendship.add_error(t(".failed", :name => @new_friend.display_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
referer = safe_referer(params[:referer]) if params[:referer]
|
referer = safe_referer(params[:referer]) if params[:referer]
|
||||||
|
@ -44,9 +44,9 @@ class FriendshipsController < ApplicationController
|
||||||
if request.post?
|
if request.post?
|
||||||
if current_user.friends_with?(@friend)
|
if current_user.friends_with?(@friend)
|
||||||
Friendship.where(:befriender => current_user, :befriendee => @friend).delete_all
|
Friendship.where(:befriender => current_user, :befriendee => @friend).delete_all
|
||||||
flash[:notice] = t "friendships.remove_friend.success", :name => @friend.display_name
|
flash[:notice] = t ".success", :name => @friend.display_name
|
||||||
else
|
else
|
||||||
flash[:error] = t "friendships.remove_friend.not_a_friend", :name => @friend.display_name
|
flash[:error] = t ".not_a_friend", :name => @friend.display_name
|
||||||
end
|
end
|
||||||
|
|
||||||
referer = safe_referer(params[:referer]) if params[:referer]
|
referer = safe_referer(params[:referer]) if params[:referer]
|
||||||
|
|
|
@ -154,7 +154,7 @@ class GeocoderController < ApplicationController
|
||||||
prefix_name = t "geocoder.search_osm_nominatim.prefix.place.#{extratag.attributes['value']}", :default => prefix_name if extratag.attributes["key"] == "linked_place" || extratag.attributes["key"] == "place"
|
prefix_name = t "geocoder.search_osm_nominatim.prefix.place.#{extratag.attributes['value']}", :default => prefix_name if extratag.attributes["key"] == "linked_place" || extratag.attributes["key"] == "place"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
prefix = t "geocoder.search_osm_nominatim.prefix_format", :name => prefix_name
|
prefix = t ".prefix_format", :name => prefix_name
|
||||||
object_type = place.attributes["osm_type"]
|
object_type = place.attributes["osm_type"]
|
||||||
object_id = place.attributes["osm_id"]
|
object_id = place.attributes["osm_id"]
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class OauthClientsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@client_application = current_user.client_applications.build(application_params)
|
@client_application = current_user.client_applications.build(application_params)
|
||||||
if @client_application.save
|
if @client_application.save
|
||||||
flash[:notice] = t "oauth_clients.create.flash"
|
flash[:notice] = t ".flash"
|
||||||
redirect_to :action => "show", :id => @client_application.id
|
redirect_to :action => "show", :id => @client_application.id
|
||||||
else
|
else
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
|
@ -42,7 +42,7 @@ class OauthClientsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@client_application = current_user.client_applications.find(params[:id])
|
@client_application = current_user.client_applications.find(params[:id])
|
||||||
if @client_application.update(application_params)
|
if @client_application.update(application_params)
|
||||||
flash[:notice] = t "oauth_clients.update.flash"
|
flash[:notice] = t ".flash"
|
||||||
redirect_to :action => "show", :id => @client_application.id
|
redirect_to :action => "show", :id => @client_application.id
|
||||||
else
|
else
|
||||||
render :action => "edit"
|
render :action => "edit"
|
||||||
|
@ -55,7 +55,7 @@ class OauthClientsController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
@client_application = current_user.client_applications.find(params[:id])
|
@client_application = current_user.client_applications.find(params[:id])
|
||||||
@client_application.destroy
|
@client_application.destroy
|
||||||
flash[:notice] = t "oauth_clients.destroy.flash"
|
flash[:notice] = t ".flash"
|
||||||
redirect_to :action => "index"
|
redirect_to :action => "index"
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
@type = "client application"
|
@type = "client application"
|
||||||
|
|
|
@ -12,7 +12,7 @@ class PasswordsController < ApplicationController
|
||||||
before_action :check_database_writable, :only => [:lost_password, :reset_password]
|
before_action :check_database_writable, :only => [:lost_password, :reset_password]
|
||||||
|
|
||||||
def lost_password
|
def lost_password
|
||||||
@title = t "passwords.lost_password.title"
|
@title = t ".title"
|
||||||
|
|
||||||
if request.post?
|
if request.post?
|
||||||
user = User.visible.find_by(:email => params[:email])
|
user = User.visible.find_by(:email => params[:email])
|
||||||
|
@ -26,16 +26,16 @@ class PasswordsController < ApplicationController
|
||||||
if user
|
if user
|
||||||
token = user.tokens.create
|
token = user.tokens.create
|
||||||
UserMailer.lost_password(user, token).deliver_later
|
UserMailer.lost_password(user, token).deliver_later
|
||||||
flash[:notice] = t "passwords.lost_password.notice email on way"
|
flash[:notice] = t ".notice email on way"
|
||||||
redirect_to login_path
|
redirect_to login_path
|
||||||
else
|
else
|
||||||
flash.now[:error] = t "passwords.lost_password.notice email cannot find"
|
flash.now[:error] = t ".notice email cannot find"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_password
|
def reset_password
|
||||||
@title = t "passwords.reset_password.title"
|
@title = t ".title"
|
||||||
|
|
||||||
if params[:token]
|
if params[:token]
|
||||||
token = UserToken.find_by(:token => params[:token])
|
token = UserToken.find_by(:token => params[:token])
|
||||||
|
@ -52,12 +52,12 @@ class PasswordsController < ApplicationController
|
||||||
if current_user.save
|
if current_user.save
|
||||||
token.destroy
|
token.destroy
|
||||||
session[:fingerprint] = current_user.fingerprint
|
session[:fingerprint] = current_user.fingerprint
|
||||||
flash[:notice] = t "passwords.reset_password.flash changed"
|
flash[:notice] = t ".flash changed"
|
||||||
successful_login(current_user)
|
successful_login(current_user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:error] = t "passwords.reset_password.flash token bad"
|
flash[:error] = t ".flash token bad"
|
||||||
redirect_to :action => "lost_password"
|
redirect_to :action => "lost_password"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,7 +24,7 @@ class SessionsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@title = t "sessions.destroy.title"
|
@title = t ".title"
|
||||||
|
|
||||||
if request.post?
|
if request.post?
|
||||||
if session[:token]
|
if session[:token]
|
||||||
|
|
|
@ -119,7 +119,7 @@ class TracesController < ApplicationController
|
||||||
TraceImporterJob.perform_later(@trace)
|
TraceImporterJob.perform_later(@trace)
|
||||||
redirect_to :action => :index, :display_name => current_user.display_name
|
redirect_to :action => :index, :display_name => current_user.display_name
|
||||||
else
|
else
|
||||||
flash[:error] = t("traces.create.upload_failed") if @trace.valid?
|
flash[:error] = t(".upload_failed") if @trace.valid?
|
||||||
|
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@title = t "users.new.title"
|
@title = t ".title"
|
||||||
@referer = if params[:referer]
|
@referer = if params[:referer]
|
||||||
safe_referer(params[:referer])
|
safe_referer(params[:referer])
|
||||||
else
|
else
|
||||||
|
@ -127,7 +127,7 @@ class UsersController < ApplicationController
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
render :partial => "terms"
|
render :partial => "terms"
|
||||||
else
|
else
|
||||||
@title = t "users.terms.title"
|
@title = t ".title"
|
||||||
|
|
||||||
if current_user&.terms_agreed?
|
if current_user&.terms_agreed?
|
||||||
# Already agreed to terms, so just show settings
|
# Already agreed to terms, so just show settings
|
||||||
|
@ -220,7 +220,7 @@ class UsersController < ApplicationController
|
||||||
def go_public
|
def go_public
|
||||||
current_user.data_public = true
|
current_user.data_public = true
|
||||||
current_user.save
|
current_user.save
|
||||||
flash[:notice] = t "users.go_public.flash success"
|
flash[:notice] = t ".flash success"
|
||||||
redirect_to edit_account_path
|
redirect_to edit_account_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ class UsersController < ApplicationController
|
||||||
##
|
##
|
||||||
# omniauth failure callback
|
# omniauth failure callback
|
||||||
def auth_failure
|
def auth_failure
|
||||||
flash[:error] = t(params[:message], :scope => "users.auth_failure", :default => t("users.auth_failure.unknown_error"))
|
flash[:error] = t(params[:message], :scope => "users.auth_failure", :default => t(".unknown_error"))
|
||||||
|
|
||||||
origin = safe_referer(params[:origin]) if params[:origin]
|
origin = safe_referer(params[:origin]) if params[:origin]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue