diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/domain_blocks_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/auth/registrations_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/home_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/media_controller.rb | 13 | ||||
-rw-r--r-- | app/controllers/well_known/webfinger_controller.rb | 9 |
6 files changed, 23 insertions, 13 deletions
diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb index 5d146d946..1932dc6a8 100644 --- a/app/controllers/admin/domain_blocks_controller.rb +++ b/app/controllers/admin/domain_blocks_controller.rb @@ -15,7 +15,7 @@ module Admin if @domain_block.save DomainBlockWorker.perform_async(@domain_block.id) - redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_block.created_msg') + redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.created_msg') else render action: :new end @@ -28,7 +28,7 @@ module Admin def destroy @domain_block = DomainBlock.find(params[:id]) UnblockDomainService.new.call(@domain_block, resource_params[:retroactive]) - redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_block.destroyed_msg') + redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg') end private diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 1976ce330..b0e26918e 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -77,9 +77,9 @@ class Api::V1::StatusesController < ApiController end def unreblog - reblog = Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first! - @status = reblog.reblog - @reblogged_map = { @status.id => false } + reblog = Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first! + @status = reblog.reblog + @reblogs_map = { @status.id => false } RemovalWorker.perform_async(reblog.id) @@ -93,7 +93,7 @@ class Api::V1::StatusesController < ApiController def unfavourite @status = Status.find(params[:id]) - @favourited_map = { @status.id => false } + @favourites_map = { @status.id => false } UnfavouriteWorker.perform_async(current_user.account_id, @status.id) diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index f8050afb5..dd30be32a 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -10,6 +10,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController def build_resource(hash = nil) super(hash) + resource.locale = I18n.locale resource.build_account if resource.account.nil? end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 2d1cf74f0..0a25b52aa 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -7,6 +7,7 @@ class HomeController < ApplicationController @body_classes = 'app-body' @token = find_or_create_access_token.token @web_settings = Web::Setting.find_by(user: current_user)&.data || {} + @admin = Account.find_local(Setting.site_contact_username) @streaming_api_base_url = Rails.configuration.x.streaming_api_base_url end diff --git a/app/controllers/media_controller.rb b/app/controllers/media_controller.rb index 488c4f944..fa1daf012 100644 --- a/app/controllers/media_controller.rb +++ b/app/controllers/media_controller.rb @@ -1,16 +1,19 @@ # frozen_string_literal: true class MediaController < ApplicationController - before_action :set_media_attachment + before_action :verify_permitted_status def show - redirect_to @media_attachment.file.url(:original) + redirect_to media_attachment.file.url(:original) end private - def set_media_attachment - @media_attachment = MediaAttachment.where.not(status_id: nil).find_by!(shortcode: params[:id]) - raise ActiveRecord::RecordNotFound unless @media_attachment.status.permitted?(current_account) + def media_attachment + MediaAttachment.attached.find_by!(shortcode: params[:id]) + end + + def verify_permitted_status + raise ActiveRecord::RecordNotFound unless media_attachment.status.permitted?(current_account) end end diff --git a/app/controllers/well_known/webfinger_controller.rb b/app/controllers/well_known/webfinger_controller.rb index 1a8ef5f90..4a521d102 100644 --- a/app/controllers/well_known/webfinger_controller.rb +++ b/app/controllers/well_known/webfinger_controller.rb @@ -8,8 +8,13 @@ module WellKnown @magic_key = pem_to_magic_key(@account.keypair.public_key) respond_to do |format| - format.xml { render content_type: 'application/xrd+xml' } - format.json { render content_type: 'application/jrd+json' } + format.any(:json, :html) do + render formats: :json, content_type: 'application/jrd+json' + end + + format.xml do + render content_type: 'application/xrd+xml' + end end rescue ActiveRecord::RecordNotFound head 404 |