Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
348a641eca
15 changed files with 75 additions and 59 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
module Admin
|
||||
class DomainBlocksController < BaseController
|
||||
before_action :set_domain_block, only: [:show, :destroy, :edit, :update]
|
||||
before_action :set_domain_block, only: [:destroy, :edit, :update]
|
||||
|
||||
def batch
|
||||
authorize :domain_block, :create?
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
module Admin
|
||||
class EmailDomainBlocksController < BaseController
|
||||
before_action :set_email_domain_block, only: [:show, :destroy]
|
||||
|
||||
def index
|
||||
authorize :email_domain_block, :index?
|
||||
|
||||
|
@ -59,10 +57,6 @@ module Admin
|
|||
|
||||
private
|
||||
|
||||
def set_email_domain_block
|
||||
@email_domain_block = EmailDomainBlock.find(params[:id])
|
||||
end
|
||||
|
||||
def set_resolved_records
|
||||
Resolv::DNS.open do |dns|
|
||||
dns.timeouts = 5
|
||||
|
|
|
@ -8300,11 +8300,13 @@ noscript {
|
|||
img {
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
video {
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
figure {
|
||||
|
|
|
@ -123,6 +123,8 @@ class Account < ApplicationRecord
|
|||
scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
|
||||
scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
|
||||
|
||||
after_update_commit :trigger_update_webhooks
|
||||
|
||||
delegate :email,
|
||||
:unconfirmed_email,
|
||||
:current_sign_in_at,
|
||||
|
@ -606,4 +608,9 @@ class Account < ApplicationRecord
|
|||
|
||||
CanonicalEmailBlock.where(reference_account: self).delete_all
|
||||
end
|
||||
|
||||
# NOTE: the `account.created` webhook is triggered by the `User` model, not `Account`.
|
||||
def trigger_update_webhooks
|
||||
TriggerWebhookWorker.perform_async('account.updated', 'Account', id) if local?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -116,6 +116,9 @@ class Status < ApplicationRecord
|
|||
where('NOT EXISTS (SELECT * FROM statuses_tags forbidden WHERE forbidden.status_id = statuses.id AND forbidden.tag_id IN (?))', tag_ids)
|
||||
}
|
||||
|
||||
after_create_commit :trigger_create_webhooks
|
||||
after_update_commit :trigger_update_webhooks
|
||||
|
||||
cache_associated :application,
|
||||
:media_attachments,
|
||||
:conversation,
|
||||
|
@ -572,4 +575,12 @@ class Status < ApplicationRecord
|
|||
reblog&.decrement_count!(:reblogs_count) if reblog?
|
||||
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
||||
end
|
||||
|
||||
def trigger_create_webhooks
|
||||
TriggerWebhookWorker.perform_async('status.created', 'Status', id) if local?
|
||||
end
|
||||
|
||||
def trigger_update_webhooks
|
||||
TriggerWebhookWorker.perform_async('status.updated', 'Status', id) if local?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,10 @@ class Webhook < ApplicationRecord
|
|||
EVENTS = %w(
|
||||
account.approved
|
||||
account.created
|
||||
account.updated
|
||||
report.created
|
||||
status.created
|
||||
status.updated
|
||||
).freeze
|
||||
|
||||
scope :enabled, -> { where(enabled: true) }
|
||||
|
|
|
@ -19,7 +19,7 @@ class Webhooks::DeliveryWorker
|
|||
private
|
||||
|
||||
def perform_request
|
||||
request = Request.new(:post, @webhook.url, body: @body)
|
||||
request = Request.new(:post, @webhook.url, body: @body, allow_local: true)
|
||||
|
||||
request.add_headers(
|
||||
'Content-Type' => 'application/json',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue