Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
- `app/lib/feed_manager.rb`:
  Not a real conflict, glitch-soc-only DM-related method
  too close to changed upstream stuff.
  Ported upstream changes.
- `app/services/batched_remove_status_service.rb`:
  Additional logic in glitch-soc to clear DMs from timelines.
  Ported upstream changes and fixed the DM TL clearing logic.
- `app/workers/scheduler/feed_cleanup_scheduler.rb`:
  Additional code in glitch-soc to clear DM timelines.
  Ported upstream changes.
This commit is contained in:
Claire
2020-12-23 01:47:45 +01:00
58 changed files with 842 additions and 538 deletions

View File

@@ -83,7 +83,7 @@ class User < ApplicationRecord
has_one :invite_request, class_name: 'UserInviteRequest', inverse_of: :user, dependent: :destroy
accepts_nested_attributes_for :invite_request, reject_if: ->(attributes) { attributes['text'].blank? && !Setting.require_invite_text }
validates :invite_request, presence: true, on: :create, if: -> { Setting.require_invite_text && !invited? }
validates :invite_request, presence: true, on: :create, if: :invite_text_required?
validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
validates_with BlacklistedEmailValidator, on: :create
@@ -128,7 +128,7 @@ class User < ApplicationRecord
to: :settings, prefix: :setting, allow_nil: false
attr_reader :invite_code, :sign_in_token_attempt
attr_writer :external
attr_writer :external, :bypass_invite_request_check
def confirmed?
confirmed_at.present?
@@ -429,6 +429,10 @@ class User < ApplicationRecord
!!@external
end
def bypass_invite_request_check?
@bypass_invite_request_check
end
def sanitize_languages
return if chosen_languages.nil?
chosen_languages.reject!(&:blank?)
@@ -466,4 +470,8 @@ class User < ApplicationRecord
def validate_email_dns?
email_changed? && !(Rails.env.test? || Rails.env.development?)
end
def invite_text_required?
Setting.require_invite_text && !invited? && !external? && !bypass_invite_request_check?
end
end