home feed group toggle

This commit is contained in:
2458773093 2019-07-22 04:50:09 +03:00
parent bf2d54201b
commit ff03e6a55f
6 changed files with 21 additions and 12 deletions

View File

@ -50,6 +50,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_aggregate_reblogs, :setting_aggregate_reblogs,
:setting_show_application, :setting_show_application,
:setting_advanced_layout, :setting_advanced_layout,
:setting_group_in_home_feed,
notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account), notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account),
interactions: %i(must_be_follower must_be_following) interactions: %i(must_be_follower must_be_following)
) )

View File

@ -34,6 +34,7 @@ class UserSettingsDecorator
user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs') user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs')
user.settings['show_application'] = show_application_preference if change?('setting_show_application') user.settings['show_application'] = show_application_preference if change?('setting_show_application')
user.settings['advanced_layout'] = advanced_layout_preference if change?('setting_advanced_layout') user.settings['advanced_layout'] = advanced_layout_preference if change?('setting_advanced_layout')
user.settings['group_in_home_feed'] = group_in_home_feed_preference if change?('setting_group_in_home_feed')
end end
def merged_notification_emails def merged_notification_emails
@ -112,6 +113,10 @@ class UserSettingsDecorator
boolean_cast_setting 'setting_advanced_layout' boolean_cast_setting 'setting_advanced_layout'
end end
def group_in_home_feed_preference
boolean_cast_setting 'setting_group_in_home_feed'
end
def boolean_cast_setting(key) def boolean_cast_setting(key)
ActiveModel::Type::Boolean.new.cast(settings[key]) ActiveModel::Type::Boolean.new.cast(settings[key])
end end

View File

@ -105,7 +105,7 @@ class User < ApplicationRecord
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal, delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
:reduce_motion, :system_font_ui, :noindex, :theme, :display_media, :hide_network, :reduce_motion, :system_font_ui, :noindex, :theme, :display_media, :hide_network,
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application, :expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, to: :settings, prefix: :setting, allow_nil: false :advanced_layout, :group_in_home_feed, to: :settings, prefix: :setting, allow_nil: false
attr_reader :invite_code attr_reader :invite_code
attr_writer :external attr_writer :external

View File

@ -23,17 +23,18 @@ class InitialStateSerializer < ActiveModel::Serializer
} }
if object.current_account if object.current_account
store[:username] = object.current_account.username store[:username] = object.current_account.username
store[:me] = object.current_account.id.to_s store[:me] = object.current_account.id.to_s
store[:unfollow_modal] = object.current_account.user.setting_unfollow_modal store[:unfollow_modal] = object.current_account.user.setting_unfollow_modal
store[:boost_modal] = object.current_account.user.setting_boost_modal store[:boost_modal] = object.current_account.user.setting_boost_modal
store[:delete_modal] = object.current_account.user.setting_delete_modal store[:delete_modal] = object.current_account.user.setting_delete_modal
store[:auto_play_gif] = object.current_account.user.setting_auto_play_gif store[:auto_play_gif] = object.current_account.user.setting_auto_play_gif
store[:display_media] = object.current_account.user.setting_display_media store[:display_media] = object.current_account.user.setting_display_media
store[:expand_spoilers] = object.current_account.user.setting_expand_spoilers store[:expand_spoilers] = object.current_account.user.setting_expand_spoilers
store[:reduce_motion] = object.current_account.user.setting_reduce_motion store[:reduce_motion] = object.current_account.user.setting_reduce_motion
store[:advanced_layout] = object.current_account.user.setting_advanced_layout store[:advanced_layout] = object.current_account.user.setting_advanced_layout
store[:is_staff] = object.current_account.user.staff? store[:group_in_home_feed] = object.current_account.user.setting_group_in_home_feed
store[:is_staff] = object.current_account.user.staff?
end end
store store

View File

@ -62,6 +62,7 @@
= f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label = f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label
= f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label
= f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label
= f.input :setting_group_in_home_feed, as: :boolean, wrapper: :with_label
.actions .actions
= f.button :button, t('generic.save_changes'), type: :submit = f.button :button, t('generic.save_changes'), type: :submit

View File

@ -105,6 +105,7 @@ en:
setting_hide_network: Hide your network setting_hide_network: Hide your network
setting_noindex: Opt-out of search engine indexing setting_noindex: Opt-out of search engine indexing
setting_reduce_motion: Reduce motion in animations setting_reduce_motion: Reduce motion in animations
setting_group_in_home_feed: Show posts from your groups”
setting_show_application: Disclose application used to send gabs setting_show_application: Disclose application used to send gabs
setting_system_font_ui: Use system's default font setting_system_font_ui: Use system's default font
setting_theme: Site theme setting_theme: Site theme