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

Conflicts:
- `README.md`:
  Upstream added a link to the roadmap, but we have a completely different README.
  Kept ours.
- `app/models/media_attachment.rb`:
  Upstream upped media attachment limits.
  Updated the default according to upstream's.
- `db/migrate/20180831171112_create_bookmarks.rb`:
  Upstream changed the migration compatibility level.
  Did so too.
- `config/initializers/content_security_policy.rb`:
  Upstream refactored this file but we have a different version.
  Kept our version.
- `app/controllers/settings/preferences_controller.rb`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  The file does not directly references individual settings anymore.
  Applied upstream changes.
- `app/lib/user_settings_decorator.rb`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  The file got removed entirely.
  Removed it as well.
- `app/models/user.rb`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  References to individual settings have been removed from the file.
  Removed them as well.
- `app/views/settings/preferences/appearance/show.html.haml`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  Applied upstream's changes and ported ours back.
- `app/views/settings/preferences/notifications/show.html.haml`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  Applied upstream's changes and ported ours back.
- `app/views/settings/preferences/other/show.html.haml`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  Applied upstream's changes and ported ours back.
- `config/settings.yml`:
  Upstream completely refactored user settings storage, and glitch-soc has a
  different set of settings.
  In particular, upstream removed user-specific and unused settings.
  Did the same in glitch-soc.
- `spec/controllers/application_controller_spec.rb`:
  Conflicts due to glitch-soc's theming system.
  Mostly kept our version, as upstream messed up the tests.
This commit is contained in:
Claire
2023-03-31 21:30:27 +02:00
341 changed files with 4055 additions and 2756 deletions

View File

@ -39,10 +39,11 @@
# webauthn_id :string
# sign_up_ip :inet
# role_id :bigint(8)
# settings :text
#
class User < ApplicationRecord
self.ignored_columns = %w(
self.ignored_columns += %w(
remember_created_at
remember_token
current_sign_in_ip
@ -51,9 +52,9 @@ class User < ApplicationRecord
filtered_languages
)
include Settings::Extend
include Redisable
include LanguagesHelper
include HasUserSettings
# The home and list feeds will be stored in Redis for this amount
# of time, and status fan-out to followers will include only people
@ -132,13 +133,6 @@ class User < ApplicationRecord
has_many :session_activations, dependent: :destroy
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
:reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_followers_count,
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
:disable_swiping, :always_send_emails, :default_content_type, :system_emoji_font,
to: :settings, prefix: :setting, allow_nil: false
delegate :can?, to: :role
attr_reader :invite_code
@ -303,50 +297,6 @@ class User < ApplicationRecord
save!
end
def prefers_noindex?
setting_noindex
end
def preferred_posting_language
valid_locale_cascade(settings.default_language, locale, I18n.locale)
end
def setting_default_privacy
settings.default_privacy || (account.locked? ? 'private' : 'public')
end
def allows_report_emails?
settings.notification_emails['report']
end
def allows_pending_account_emails?
settings.notification_emails['pending_account']
end
def allows_appeal_emails?
settings.notification_emails['appeal']
end
def allows_trending_tags_review_emails?
settings.notification_emails['trending_tag']
end
def allows_trending_links_review_emails?
settings.notification_emails['trending_link']
end
def allows_trending_statuses_review_emails?
settings.notification_emails['trending_status']
end
def aggregates_reblogs?
@aggregates_reblogs ||= settings.aggregate_reblogs
end
def shows_application?
@shows_application ||= settings.show_application
end
def token_for_app(app)
return nil if app.nil? || app.owner != self
@ -426,14 +376,6 @@ class User < ApplicationRecord
send_reset_password_instructions
end
def show_all_media?
setting_display_media == 'show_all'
end
def hide_all_media?
setting_display_media == 'hide_all'
end
protected
def send_devise_notification(notification, *args, **kwargs)
@ -503,7 +445,8 @@ class User < ApplicationRecord
def sanitize_languages
return if chosen_languages.nil?
chosen_languages.reject!(&:blank?)
chosen_languages.compact_blank!
self.chosen_languages = nil if chosen_languages.empty?
end