Merge remote-tracking branch 'parent/main' into upstream-20240817
This commit is contained in:
commit
82ffc95733
97 changed files with 1377 additions and 472 deletions
|
@ -11,7 +11,7 @@ class Scheduler::AutoCloseRegistrationsScheduler
|
|||
OPEN_REGISTRATIONS_MODERATOR_THRESHOLD = 1.week + UserTrackingConcern::SIGN_IN_UPDATE_FREQUENCY
|
||||
|
||||
def perform
|
||||
return if Rails.configuration.x.email_domains_whitelist.present? || ENV['DISABLE_AUTOMATIC_SWITCHING_TO_APPROVED_REGISTRATIONS'] == 'true'
|
||||
return if Rails.configuration.x.email_domains_allowlist.present? || ENV['DISABLE_AUTOMATIC_SWITCHING_TO_APPROVED_REGISTRATIONS'] == 'true'
|
||||
return unless Setting.registrations_mode == 'open'
|
||||
|
||||
switch_to_approval_mode! unless active_moderators?
|
||||
|
|
|
@ -3,8 +3,19 @@
|
|||
class UnfilterNotificationsWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(notification_request_id)
|
||||
@notification_request = NotificationRequest.find(notification_request_id)
|
||||
# Earlier versions of the feature passed a `notification_request` ID
|
||||
# If `to_account_id` is passed, the first argument is an account ID
|
||||
# TODO for after 4.3.0: drop the single-argument case
|
||||
def perform(notification_request_or_account_id, from_account_id = nil)
|
||||
if from_account_id.present?
|
||||
@notification_request = nil
|
||||
@from_account = Account.find(from_account_id)
|
||||
@recipient = Account.find(notification_request_or_account_id)
|
||||
else
|
||||
@notification_request = NotificationRequest.find(notification_request_or_account_id)
|
||||
@from_account = @notification_request.from_account
|
||||
@recipient = @notification_request.account
|
||||
end
|
||||
|
||||
push_to_conversations!
|
||||
unfilter_notifications!
|
||||
|
@ -16,7 +27,7 @@ class UnfilterNotificationsWorker
|
|||
private
|
||||
|
||||
def push_to_conversations!
|
||||
notifications_with_private_mentions.find_each { |notification| AccountConversation.add_status(@notification_request.account, notification.target_status) }
|
||||
notifications_with_private_mentions.reorder(nil).find_each(order: :desc) { |notification| AccountConversation.add_status(@recipient, notification.target_status) }
|
||||
end
|
||||
|
||||
def unfilter_notifications!
|
||||
|
@ -24,14 +35,14 @@ class UnfilterNotificationsWorker
|
|||
end
|
||||
|
||||
def remove_request!
|
||||
@notification_request.destroy!
|
||||
@notification_request&.destroy!
|
||||
end
|
||||
|
||||
def filtered_notifications
|
||||
Notification.where(account: @notification_request.account, from_account: @notification_request.from_account, filtered: true)
|
||||
Notification.where(account: @recipient, from_account: @from_account, filtered: true)
|
||||
end
|
||||
|
||||
def notifications_with_private_mentions
|
||||
filtered_notifications.joins(mention: :status).merge(Status.where(visibility: :direct)).includes(mention: :status)
|
||||
filtered_notifications.where(type: :mention).joins(mention: :status).merge(Status.where(visibility: :direct)).includes(mention: :status)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue