Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `config/webpack/configuration.js`: Upstream updated the `js-yaml` dependency, which changed how to call it. Those changes conflicted because that code is pretty different in glitch-soc which has to deal with its more complex theming system. Proceeded to the same compatibility changes in glitch-soc's code. - `package.json` and `yarn.lock`: Not really a conflict, just glitch-soc-specific dependencies textually too close to some dependencies updated upstream.
This commit is contained in:
@@ -32,7 +32,7 @@ class BatchedRemoveStatusService < BaseService
|
||||
|
||||
# Since we skipped all callbacks, we also need to manually
|
||||
# deindex the statuses
|
||||
Chewy.strategy.current.update(StatusesIndex, statuses_and_reblogs) if Chewy.enabled?
|
||||
Chewy.strategy.current.update(StatusesIndex::Status, statuses_and_reblogs) if Chewy.enabled?
|
||||
|
||||
return if options[:skip_side_effects]
|
||||
|
||||
|
@@ -142,6 +142,7 @@ class DeleteAccountService < BaseService
|
||||
purge_user!
|
||||
purge_profile!
|
||||
purge_statuses!
|
||||
purge_mentions!
|
||||
purge_media_attachments!
|
||||
purge_polls!
|
||||
purge_generated_notifications!
|
||||
@@ -159,6 +160,10 @@ class DeleteAccountService < BaseService
|
||||
end
|
||||
end
|
||||
|
||||
def purge_mentions!
|
||||
@account.mentions.reorder(nil).where.not(status_id: reported_status_ids).in_batches.delete_all
|
||||
end
|
||||
|
||||
def purge_media_attachments!
|
||||
@account.media_attachments.reorder(nil).find_each do |media_attachment|
|
||||
next if keep_account_record? && reported_status_ids.include?(media_attachment.status_id)
|
||||
@@ -182,7 +187,7 @@ class DeleteAccountService < BaseService
|
||||
@account.favourites.in_batches do |favourites|
|
||||
ids = favourites.pluck(:status_id)
|
||||
StatusStat.where(status_id: ids).update_all('favourites_count = GREATEST(0, favourites_count - 1)')
|
||||
Chewy.strategy.current.update(StatusesIndex, ids) if Chewy.enabled?
|
||||
Chewy.strategy.current.update(StatusesIndex::Status, ids) if Chewy.enabled?
|
||||
# Rails.cache.delete_multi would be better, but we don't have it yet
|
||||
ids.each { |id| Rails.cache.delete("statuses/#{id}") }
|
||||
favourites.delete_all
|
||||
@@ -191,7 +196,7 @@ class DeleteAccountService < BaseService
|
||||
|
||||
def purge_bookmarks!
|
||||
@account.bookmarks.in_batches do |bookmarks|
|
||||
Chewy.strategy.current.update(StatusesIndex, bookmarks.pluck(:status_id)) if Chewy.enabled?
|
||||
Chewy.strategy.current.update(StatusesIndex::Status, bookmarks.pluck(:status_id)) if Chewy.enabled?
|
||||
bookmarks.delete_all
|
||||
end
|
||||
end
|
||||
|
@@ -11,11 +11,12 @@ class FollowService < BaseService
|
||||
# @option [Boolean] :reblogs Whether or not to show reblogs, defaults to true
|
||||
# @option [Boolean] :notify Whether to create notifications about new posts, defaults to false
|
||||
# @option [Boolean] :bypass_locked
|
||||
# @option [Boolean] :bypass_limit Allow following past the total follow number
|
||||
# @option [Boolean] :with_rate_limit
|
||||
def call(source_account, target_account, options = {})
|
||||
@source_account = source_account
|
||||
@target_account = ResolveAccountService.new.call(target_account, skip_webfinger: true)
|
||||
@options = { bypass_locked: false, with_rate_limit: false }.merge(options)
|
||||
@options = { bypass_locked: false, bypass_limit: false, with_rate_limit: false }.merge(options)
|
||||
|
||||
raise ActiveRecord::RecordNotFound if following_not_possible?
|
||||
raise Mastodon::NotPermittedError if following_not_allowed?
|
||||
@@ -54,7 +55,7 @@ class FollowService < BaseService
|
||||
end
|
||||
|
||||
def request_follow!
|
||||
follow_request = @source_account.request_follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit])
|
||||
follow_request = @source_account.request_follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
|
||||
|
||||
if @target_account.local?
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow_request.id, follow_request.class.name, :follow_request)
|
||||
@@ -66,7 +67,7 @@ class FollowService < BaseService
|
||||
end
|
||||
|
||||
def direct_follow!
|
||||
follow = @source_account.follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit])
|
||||
follow = @source_account.follow!(@target_account, reblogs: @options[:reblogs], notify: @options[:notify], rate_limit: @options[:with_rate_limit], bypass_limit: @options[:bypass_limit])
|
||||
|
||||
LocalNotificationWorker.perform_async(@target_account.id, follow.id, follow.class.name, :follow)
|
||||
MergeWorker.perform_async(@target_account.id, @source_account.id)
|
||||
|
@@ -65,10 +65,16 @@ class SuspendAccountService < BaseService
|
||||
attachment = media_attachment.public_send(attachment_name)
|
||||
styles = [:original] | attachment.styles.keys
|
||||
|
||||
next if attachment.blank?
|
||||
|
||||
styles.each do |style|
|
||||
case Paperclip::Attachment.default_options[:storage]
|
||||
when :s3
|
||||
attachment.s3_object(style).acl.put(acl: 'private')
|
||||
begin
|
||||
attachment.s3_object(style).acl.put(acl: 'private')
|
||||
rescue Aws::S3::Errors::NoSuchKey
|
||||
Rails.logger.warn "Tried to change acl on non-existent key #{attachment.s3_object(style).key}"
|
||||
end
|
||||
when :fog
|
||||
# Not supported
|
||||
when :filesystem
|
||||
|
@@ -56,10 +56,16 @@ class UnsuspendAccountService < BaseService
|
||||
attachment = media_attachment.public_send(attachment_name)
|
||||
styles = [:original] | attachment.styles.keys
|
||||
|
||||
next if attachment.blank?
|
||||
|
||||
styles.each do |style|
|
||||
case Paperclip::Attachment.default_options[:storage]
|
||||
when :s3
|
||||
attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions])
|
||||
begin
|
||||
attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions])
|
||||
rescue Aws::S3::Errors::NoSuchKey
|
||||
Rails.logger.warn "Tried to change acl on non-existent key #{attachment.s3_object(style).key}"
|
||||
end
|
||||
when :fog
|
||||
# Not supported
|
||||
when :filesystem
|
||||
|
Reference in New Issue
Block a user