diff --git a/app/controllers/admin/flags_controller.rb b/app/controllers/admin/flags_controller.rb index ae613d6d113..af2cd1107cf 100644 --- a/app/controllers/admin/flags_controller.rb +++ b/app/controllers/admin/flags_controller.rb @@ -43,7 +43,7 @@ limit 100 posts = sql.exec.to_a if posts.length == 0 - render :json => {users: [], posts: []} + render json: {users: [], posts: []} return end diff --git a/app/controllers/draft_controller.rb b/app/controllers/draft_controller.rb index 4395b435195..fad27991b2b 100644 --- a/app/controllers/draft_controller.rb +++ b/app/controllers/draft_controller.rb @@ -4,17 +4,17 @@ class DraftController < ApplicationController def show seq = params[:sequence] || DraftSequence.current(current_user, params[:draft_key]) - render :json => {draft: Draft.get(current_user, params[:draft_key], seq), draft_sequence: seq} + render json: {draft: Draft.get(current_user, params[:draft_key], seq), draft_sequence: seq} end def update Draft.set(current_user, params[:draft_key], params[:sequence].to_i, params[:data]) - render :text => 'ok' + render text: 'ok' end def destroy Draft.clear(current_user, params[:draft_key], params[:sequence].to_i) - render :text => 'ok' + render text: 'ok' end end diff --git a/app/controllers/excerpt_controller.rb b/app/controllers/excerpt_controller.rb index 3ed59202b8f..854991faf29 100644 --- a/app/controllers/excerpt_controller.rb +++ b/app/controllers/excerpt_controller.rb @@ -17,16 +17,16 @@ class ExcerptController < ApplicationController post = route.has_key?(:post_number) ? topic_posts.last : topic_posts.first guardian.ensure_can_see!(post) - render :json => post, serializer: PostExcerptSerializer, root: false + render json: post, serializer: PostExcerptSerializer, root: false when 'users' user = User.where(username_lower: route[:username].downcase).first guardian.ensure_can_see!(user) - render :json => user, serializer: UserExcerptSerializer, root: false + render json: user, serializer: UserExcerptSerializer, root: false when 'list' if route[:action] == 'category' category = Category.where(slug: route[:category]).first guardian.ensure_can_see!(category) - render :json => category, serializer: CategoryExcerptSerializer, root: false + render json: category, serializer: CategoryExcerptSerializer, root: false end else render nothing: true, status: 404 diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 2ceacc005af..4cd50ee8c3a 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -6,9 +6,9 @@ class ForumsController < ApplicationController def status if $shutdown - render :text => 'shutting down', :status => 500 + render text: 'shutting down', :status => 500 else - render :text => 'ok' + render text: 'ok' end end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 648999404a7..2d420907f90 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -143,7 +143,7 @@ class PostsController < ApplicationController PostAction.remove_act(current_user, post, PostActionType.types[:bookmark]) end end - render :nothing => true + render nothing: true end diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 7a05b6b943e..be6defc7ccb 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -16,7 +16,7 @@ class SessionController < ApplicationController # If the site requires user approval and the user is not approved yet if SiteSetting.must_approve_users? && !@user.approved? - render :json => {error: I18n.t("login.not_approved")} + render json: {error: I18n.t("login.not_approved")} return end @@ -27,13 +27,13 @@ class SessionController < ApplicationController render_serialized(@user, UserSerializer) return else - render :json => {error: I18n.t("login.not_activated"), reason: 'not_activated', sent_to_email: @user.email_logs.where(email_type: 'signup').order('created_at DESC').first.try(:to_address), current_email: @user.email} + render json: {error: I18n.t("login.not_activated"), reason: 'not_activated', sent_to_email: @user.email_logs.where(email_type: 'signup').order('created_at DESC').first.try(:to_address), current_email: @user.email} return end end end - render :json => {error: I18n.t("login.incorrect_username_email_or_password")} + render json: {error: I18n.t("login.incorrect_username_email_or_password")} end def forgot_password @@ -45,7 +45,7 @@ class SessionController < ApplicationController Jobs.enqueue(:user_email, type: :forgot_password, user_id: user.id, email_token: email_token.token) end # always render of so we don't leak information - render :json => {result: "ok"} + render json: {result: "ok"} end def destroy diff --git a/app/controllers/user_actions_controller.rb b/app/controllers/user_actions_controller.rb index 441950f5df8..8ada7a8d4b4 100644 --- a/app/controllers/user_actions_controller.rb +++ b/app/controllers/user_actions_controller.rb @@ -2,7 +2,7 @@ class UserActionsController < ApplicationController def index requires_parameters(:user_id) per_chunk = 60 - render :json => UserAction.stream( + render json: UserAction.stream( user_id: params[:user_id].to_i, offset: params[:offset], limit: per_chunk, @@ -14,7 +14,7 @@ class UserActionsController < ApplicationController def show requires_parameters(:id) - render :json => UserAction.stream_item(params[:id], guardian) + render json: UserAction.stream_item(params[:id], guardian) end def private_messages diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index a09b9a6763b..efa4872d2f2 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -29,13 +29,13 @@ class Users::OmniauthCallbacksController < ApplicationController respond_to do |format| format.html - format.json { render :json => @data } + format.json { render json: @data } end end def failure flash[:error] = I18n.t("login.omniauth_error", strategy: params[:strategy].titleize) - render :layout => 'no_js' + render layout: 'no_js' end def create_or_sign_on_user_using_twitter(auth_token) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 943e37c7b3d..b337a953627 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -43,7 +43,7 @@ class UsersController < ApplicationController u.auto_track_topics_after_msecs = params[:auto_track_topics_after_msecs].to_i if params[:auto_track_topics_after_msecs] u.new_topic_duration_minutes = params[:new_topic_duration_minutes].to_i if params[:new_topic_duration_minutes] - [:email_digests, :email_direct, :email_private_messages, + [:email_digests, :email_direct, :email_private_messages, :external_links_in_new_tab, :enable_quoting].each do |i| if params[i].present? u.send("#{i.to_s}=", params[i] == 'true') @@ -138,7 +138,7 @@ class UsersController < ApplicationController if params[:password_confirmation] != honeypot_value || params[:challenge] != challenge_value.try(:reverse) # Don't give any indication that we caught you in the honeypot - return render(:json => {success: true, active: false, message: I18n.t("login.activate_email", email: params[:email]) }) + return render(json: {success: true, active: false, message: I18n.t("login.activate_email", email: params[:email]) }) end user = User.new @@ -196,14 +196,14 @@ class UsersController < ApplicationController session[:authentication] = nil # JSON result - render :json => {success: true, active: active_result, message: msg } + render json: {success: true, active: active_result, message: msg } else - render :json => {success: false, message: I18n.t("login.errors", errors: user.errors.full_messages.join("\n"))} + render json: {success: false, message: I18n.t("login.errors", errors: user.errors.full_messages.join("\n"))} end rescue ActiveRecord::StatementInvalid - render :json => {success: false, message: I18n.t("login.something_already_taken")} + render json: {success: false, message: I18n.t("login.something_already_taken")} rescue DiscourseHub::NicknameUnavailable - render :json => {success: false, message: I18n.t("login.errors", errors:I18n.t("login.not_available", suggestion: User.suggest_username(params[:username])) )} + render json: {success: false, message: I18n.t("login.errors", errors:I18n.t("login.not_available", suggestion: User.suggest_username(params[:username])) )} rescue RestClient::Forbidden render json: {errors: [I18n.t("discourse_hub.access_token_problem")]} end @@ -257,7 +257,7 @@ class UsersController < ApplicationController end end end - render :layout => 'no_js' + render layout: 'no_js' end def change_email @@ -285,7 +285,7 @@ class UsersController < ApplicationController else flash[:error] = I18n.t('change_email.error') end - render :layout => 'no_js' + render layout: 'no_js' end def activate_account @@ -303,7 +303,7 @@ class UsersController < ApplicationController else flash[:error] = I18n.t('activation.already_done') end - render :layout => 'no_js' + render layout: 'no_js' end def send_activation_email