Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `README.md`: Discarded upstream changes: we have our own README - `app/controllers/follower_accounts_controller.rb`: Port upstream's minor refactoring
This commit is contained in:
		@@ -16,6 +16,26 @@ class Api::BaseController < ApplicationController
 | 
			
		||||
 | 
			
		||||
  protect_from_forgery with: :null_session
 | 
			
		||||
 | 
			
		||||
  content_security_policy do |p|
 | 
			
		||||
    # Set every directive that does not have a fallback
 | 
			
		||||
    p.default_src :none
 | 
			
		||||
    p.frame_ancestors :none
 | 
			
		||||
    p.form_action :none
 | 
			
		||||
 | 
			
		||||
    # Disable every directive with a fallback to cut on response size
 | 
			
		||||
    p.base_uri false
 | 
			
		||||
    p.font_src false
 | 
			
		||||
    p.img_src false
 | 
			
		||||
    p.style_src false
 | 
			
		||||
    p.media_src false
 | 
			
		||||
    p.frame_src false
 | 
			
		||||
    p.manifest_src false
 | 
			
		||||
    p.connect_src false
 | 
			
		||||
    p.script_src false
 | 
			
		||||
    p.child_src false
 | 
			
		||||
    p.worker_src false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e|
 | 
			
		||||
    render json: { error: e.to_s }, status: 422
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -40,10 +40,8 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
 | 
			
		||||
 | 
			
		||||
  def update
 | 
			
		||||
    authorize @domain_block, :update?
 | 
			
		||||
    @domain_block.update(domain_block_params)
 | 
			
		||||
    severity_changed = @domain_block.severity_changed?
 | 
			
		||||
    @domain_block.save!
 | 
			
		||||
    DomainBlockWorker.perform_async(@domain_block.id, severity_changed)
 | 
			
		||||
    @domain_block.update!(domain_block_params)
 | 
			
		||||
    DomainBlockWorker.perform_async(@domain_block.id, @domain_block.severity_previously_changed?)
 | 
			
		||||
    log_action :update, @domain_block
 | 
			
		||||
    render json: @domain_block, serializer: REST::Admin::DomainBlockSerializer
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ class Api::V1::NotificationsController < Api::BaseController
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  def load_notifications
 | 
			
		||||
    notifications = browserable_account_notifications.includes(from_account: :account_stat).to_a_paginated_by_id(
 | 
			
		||||
    notifications = browserable_account_notifications.includes(from_account: [:account_stat, :user]).to_a_paginated_by_id(
 | 
			
		||||
      limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
 | 
			
		||||
      params_slice(:max_id, :since_id, :min_id)
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user