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:
@@ -5,7 +5,7 @@ require 'mime/types/columnar'
|
||||
module Attachmentable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
MAX_MATRIX_LIMIT = 16_777_216 # 4096x4096px or approx. 16MB
|
||||
MAX_MATRIX_LIMIT = 33_177_600 # 7680x4320px or approx. 847MB in RAM
|
||||
GIF_MATRIX_LIMIT = 921_600 # 1280x720px
|
||||
|
||||
# For some file extensions, there exist different content
|
||||
|
141
app/models/concerns/has_user_settings.rb
Normal file
141
app/models/concerns/has_user_settings.rb
Normal file
@@ -0,0 +1,141 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module HasUserSettings
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
serialize :settings, UserSettingsSerializer
|
||||
end
|
||||
|
||||
def settings_attributes=(attributes)
|
||||
settings.update(attributes)
|
||||
end
|
||||
|
||||
def prefers_noindex?
|
||||
settings['noindex']
|
||||
end
|
||||
|
||||
def preferred_posting_language
|
||||
valid_locale_cascade(settings['default_language'], locale, I18n.locale)
|
||||
end
|
||||
|
||||
def setting_auto_play_gif
|
||||
settings['web.auto_play']
|
||||
end
|
||||
|
||||
def setting_default_sensitive
|
||||
settings['default_sensitive']
|
||||
end
|
||||
|
||||
def setting_unfollow_modal
|
||||
settings['web.unfollow_modal']
|
||||
end
|
||||
|
||||
def setting_boost_modal
|
||||
settings['web.reblog_modal']
|
||||
end
|
||||
|
||||
def setting_delete_modal
|
||||
settings['web.delete_modal']
|
||||
end
|
||||
|
||||
def setting_reduce_motion
|
||||
settings['web.reduce_motion']
|
||||
end
|
||||
|
||||
def setting_system_font_ui
|
||||
settings['web.use_system_font']
|
||||
end
|
||||
|
||||
def setting_noindex
|
||||
settings['noindex']
|
||||
end
|
||||
|
||||
def setting_theme
|
||||
settings['theme']
|
||||
end
|
||||
|
||||
def setting_display_media
|
||||
settings['web.display_media']
|
||||
end
|
||||
|
||||
def setting_expand_spoilers
|
||||
settings['web.expand_content_warnings']
|
||||
end
|
||||
|
||||
def setting_default_language
|
||||
settings['default_language']
|
||||
end
|
||||
|
||||
def setting_aggregate_reblogs
|
||||
settings['aggregate_reblogs']
|
||||
end
|
||||
|
||||
def setting_show_application
|
||||
settings['show_application']
|
||||
end
|
||||
|
||||
def setting_advanced_layout
|
||||
settings['web.advanced_layout']
|
||||
end
|
||||
|
||||
def setting_use_blurhash
|
||||
settings['web.use_blurhash']
|
||||
end
|
||||
|
||||
def setting_use_pending_items
|
||||
settings['web.use_pending_items']
|
||||
end
|
||||
|
||||
def setting_trends
|
||||
settings['web.trends']
|
||||
end
|
||||
|
||||
def setting_crop_images
|
||||
settings['web.crop_images']
|
||||
end
|
||||
|
||||
def setting_disable_swiping
|
||||
settings['web.disable_swiping']
|
||||
end
|
||||
|
||||
def setting_always_send_emails
|
||||
settings['always_send_emails']
|
||||
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_trends_review_emails?
|
||||
settings['notification_emails.trends']
|
||||
end
|
||||
|
||||
def aggregates_reblogs?
|
||||
settings['aggregate_reblogs']
|
||||
end
|
||||
|
||||
def shows_application?
|
||||
settings['show_application']
|
||||
end
|
||||
|
||||
def show_all_media?
|
||||
settings['web.display_media'] == 'show_all'
|
||||
end
|
||||
|
||||
def hide_all_media?
|
||||
settings['web.display_media'] == 'hide_all'
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user