if request.post?
token = UserToken.find_by(:token => params[:confirm_string])
if token&.user&.active?
- flash[:error] = t("confirmations.confirm.already active")
+ flash[:error] = t(".already active")
redirect_to login_path
elsif !token || token.expired?
- flash[:error] = t("confirmations.confirm.unknown token")
+ flash[:error] = t(".unknown token")
redirect_to :action => "confirm"
elsif !token.user.visible?
render_unknown_user token.user.display_name
end
if token.nil? || token.user != user
- flash[:notice] = t("confirmations.confirm.success")
+ flash[:notice] = t(".success")
redirect_to login_path(:referer => referer)
else
token.destroy
token = UserToken.find_by(:token => session[:token])
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
UserMailer.signup_confirm(user, user.tokens.create).deliver_later
flash[:notice] = { :partial => "confirmations/resend_success_flash", :locals => { :email => user.email, :sender => Settings.email_from } }
gravatar_enabled = gravatar_enable(current_user)
if current_user.save
flash[:notice] = if gravatar_enabled
- "#{t('confirmations.confirm_email.success')} #{gravatar_status_message(current_user)}"
+ "#{t('.success')} #{gravatar_status_message(current_user)}"
else
- t("confirmations.confirm_email.success")
+ t(".success")
end
else
flash[:errors] = current_user.errors
session[:user] = current_user.id
session[:fingerprint] = current_user.fingerprint
elsif token
- flash[:error] = t "confirmations.confirm_email.failure"
+ flash[:error] = t ".failure"
else
- flash[:error] = t "confirmations.confirm_email.unknown_token"
+ flash[:error] = t ".unknown_token"
end
redirect_to edit_account_path
@user = User.active.find_by(:display_name => params[:display_name])
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
else
render_unknown_user params[:display_name]
end
elsif params[:friends]
if current_user
- @title = t "diary_entries.index.title_friends"
+ @title = t ".title_friends"
@entries = DiaryEntry.where(:user_id => current_user.friends)
else
require_user
end
elsif params[:nearby]
if current_user
- @title = t "diary_entries.index.title_nearby"
+ @title = t ".title_nearby"
@entries = DiaryEntry.where(:user_id => current_user.nearby)
else
require_user
@entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] })
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])
else
- @title = t "diary_entries.index.title"
+ @title = t ".title"
end
end
def show
@entry = @user.diary_entries.visible.where(:id => params[:id]).first
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
else
@title = t "diary_entries.no_such_entry.title", :id => params[:id]
end
def new
- @title = t "diary_entries.new.title"
+ @title = t ".title"
default_lang = current_user.preferences.where(:k => "diary.default_language").first
lang_code = default_lang ? default_lang.v : current_user.preferred_language
end
def edit
- @title = t "diary_entries.edit.title"
+ @title = t ".title"
@diary_entry = DiaryEntry.find(params[:id])
redirect_to diary_entry_path(@diary_entry.user, @diary_entry) if current_user != @diary_entry.user
friendship.befriender = current_user
friendship.befriendee = @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
- flash.now[:error] = t "friendships.make_friend.limit_exceeded"
+ flash.now[:error] = t ".limit_exceeded"
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
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
referer = safe_referer(params[:referer]) if params[:referer]
if request.post?
if current_user.friends_with?(@friend)
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
- flash[:error] = t "friendships.remove_friend.not_a_friend", :name => @friend.display_name
+ flash[:error] = t ".not_a_friend", :name => @friend.display_name
end
referer = safe_referer(params[:referer]) if params[:referer]
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
- 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_id = place.attributes["osm_id"]
def create
@client_application = current_user.client_applications.build(application_params)
if @client_application.save
- flash[:notice] = t "oauth_clients.create.flash"
+ flash[:notice] = t ".flash"
redirect_to :action => "show", :id => @client_application.id
else
render :action => "new"
def update
@client_application = current_user.client_applications.find(params[:id])
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
else
render :action => "edit"
def destroy
@client_application = current_user.client_applications.find(params[:id])
@client_application.destroy
- flash[:notice] = t "oauth_clients.destroy.flash"
+ flash[:notice] = t ".flash"
redirect_to :action => "index"
rescue ActiveRecord::RecordNotFound
@type = "client application"
before_action :check_database_writable, :only => [:lost_password, :reset_password]
def lost_password
- @title = t "passwords.lost_password.title"
+ @title = t ".title"
if request.post?
user = User.visible.find_by(:email => params[:email])
if user
token = user.tokens.create
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
else
- flash.now[:error] = t "passwords.lost_password.notice email cannot find"
+ flash.now[:error] = t ".notice email cannot find"
end
end
end
def reset_password
- @title = t "passwords.reset_password.title"
+ @title = t ".title"
if params[:token]
token = UserToken.find_by(:token => params[:token])
if current_user.save
token.destroy
session[:fingerprint] = current_user.fingerprint
- flash[:notice] = t "passwords.reset_password.flash changed"
+ flash[:notice] = t ".flash changed"
successful_login(current_user)
end
end
else
- flash[:error] = t "passwords.reset_password.flash token bad"
+ flash[:error] = t ".flash token bad"
redirect_to :action => "lost_password"
end
else
end
def destroy
- @title = t "sessions.destroy.title"
+ @title = t ".title"
if request.post?
if session[:token]
TraceImporterJob.perform_later(@trace)
redirect_to :action => :index, :display_name => current_user.display_name
else
- flash[:error] = t("traces.create.upload_failed") if @trace.valid?
+ flash[:error] = t(".upload_failed") if @trace.valid?
render :action => "new"
end
end
def new
- @title = t "users.new.title"
+ @title = t ".title"
@referer = if params[:referer]
safe_referer(params[:referer])
else
if request.xhr?
render :partial => "terms"
else
- @title = t "users.terms.title"
+ @title = t ".title"
if current_user&.terms_agreed?
# Already agreed to terms, so just show settings
def go_public
current_user.data_public = true
current_user.save
- flash[:notice] = t "users.go_public.flash success"
+ flash[:notice] = t ".flash success"
redirect_to edit_account_path
end
##
# omniauth failure callback
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]