add option to toggle captions + code: move monsterpit additons on top

staging
multiple creatures 2019-04-07 23:50:13 -05:00
parent 2ee72d3aaf
commit caf265bbeb
6 changed files with 67 additions and 13 deletions

View File

@ -29,11 +29,12 @@ class Settings::PreferencesController < Settings::BaseController
def user_settings_params
params.require(:user).permit(
:setting_default_privacy,
:setting_default_local,
:setting_always_local,
:setting_rawr_federated,
:setting_hide_stats,
:setting_hide_captions,
:setting_default_privacy,
:setting_default_sensitive,
:setting_default_language,
:setting_unfollow_modal,

View File

@ -15,13 +15,14 @@ class UserSettingsDecorator
private
def process_update
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
user.settings['interactions'] = merged_interactions if change?('interactions')
user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy')
user.settings['default_local'] = default_local_preference if change?('setting_default_local')
user.settings['always_local'] = always_local_preference if change?('setting_always_local')
user.settings['rawr_federated'] = rawr_federated_preference if change?('setting_rawr_federated')
user.settings['hide_stats'] = hide_stats_preference if change?('setting_hide_stats')
user.settings['hide_captions'] = hide_captions_preference if change?('setting_hide_captions')
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
user.settings['interactions'] = merged_interactions if change?('interactions')
user.settings['default_privacy'] = default_privacy_preference if change?('setting_default_privacy')
user.settings['default_sensitive'] = default_sensitive_preference if change?('setting_default_sensitive')
user.settings['default_language'] = default_language_preference if change?('setting_default_language')
user.settings['unfollow_modal'] = unfollow_modal_preference if change?('setting_unfollow_modal')
@ -71,6 +72,10 @@ class UserSettingsDecorator
boolean_cast_setting 'setting_hide_stats'
end
def hide_captions_preference
boolean_cast_setting 'setting_hide_captions'
end
def default_sensitive_preference
boolean_cast_setting 'setting_default_sensitive'
end

View File

@ -102,9 +102,34 @@ class User < ApplicationRecord
has_many :session_activations, dependent: :destroy
delegate :auto_play_gif, :default_local, :always_local, :rawr_federated, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
:hide_stats, :reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_network, :hide_followers_count,
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application, :default_content_type, to: :settings, prefix: :setting, allow_nil: false
delegate :default_local,
:always_local,
:rawr_federated,
:hide_stats,
:disable_color,
:hide_captions,
:auto_play_gif,
:default_sensitive,
:unfollow_modal,
:boost_modal,
:favourite_modal,
:delete_modal,
:reduce_motion,
:system_font_ui,
:noindex,
:flavour,
:skin,
:display_media,
:hide_network,
:hide_followers_count,
:expand_spoilers,
:default_language,
:aggregate_reblogs,
:show_application,
:default_content_type,
to: :settings,
prefix: :setting,
allow_nil: false
attr_reader :invite_code
attr_writer :external
@ -204,6 +229,10 @@ class User < ApplicationRecord
settings.hide_stats || false
end
def setting_hide_captions
settings.hide_captions || false
end
def allows_digest_emails?
settings.notification_emails['digest']
end

View File

@ -37,5 +37,20 @@
- if Setting.custom_css.present?
= stylesheet_link_tag custom_css_path, media: 'all'
- if current_account&.user&.setting_disable_color
:css
.status__content p > span,
.reply-indicator__content p > span,
.composer--reply > .content p > span,
.account__header__content p > span,
.account__header__fields p > span
{ color: inherit !important }
- if current_account&.user&.setting_hide_captions
:css
div .media-caption,
span .caption
{ display: none }
%body{ class: body_classes }
= content_for?(:content) ? yield(:content) : yield

View File

@ -36,15 +36,11 @@
.fields-group
= f.input :setting_rawr_federated, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_noindex, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_hide_network, as: :boolean, wrapper: :with_label
= f.input :setting_hide_stats, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_show_application, as: :boolean, wrapper: :with_label
= f.input :setting_noindex, as: :boolean, wrapper: :with_label
- unless Setting.hide_followers_count
.fields-group
@ -57,6 +53,7 @@
= f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label
= f.input :setting_disable_color, as: :boolean, wrapper: :with_label
= f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label
= f.input :setting_hide_captions, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label

View File

@ -69,6 +69,7 @@ en:
suspend: Suspend and irreversibly delete account data
warning_preset_id: Use a warning preset
defaults:
hidden: Hide public profile
autofollow: Invite to join your pack
avatar: Avatar
bot: This is a bot account
@ -88,7 +89,6 @@ en:
irreversible: Drop instead of hide
locale: Interface language
locked: Lock account
hidden: Hide public profile
max_uses: Max number of uses
new_password: New password
note: Bio
@ -108,6 +108,13 @@ en:
setting_always_local: Don't send your roars outside Monsterpit
setting_rawr_federated: Show raw world timeline (may contain offensive content!)
setting_hide_stats: Hide statistics on public pages
setting_disable_color: Ignore text color formatting
setting_hide_captions: Hide media captions
setting_aggregate_reblogs: Group repeats in timelines
setting_auto_play_gif: Auto-play animated GIFs
setting_boost_modal: Show confirmation dialog before repeating
setting_default_language: Posting language
setting_default_privacy: Post privacy
setting_default_sensitive: Always mark media as sensitive
setting_delete_modal: Show confirmation dialog before deleting a roar
setting_display_media: Media display