Add setting for whether to show DMS in home timeline
This commit is contained in:
parent
d50e824168
commit
fe6a7dfb2c
|
@ -48,6 +48,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
:setting_theme,
|
||||
:setting_hide_network,
|
||||
:setting_aggregate_reblogs,
|
||||
:setting_home_dms,
|
||||
notification_emails: %i(follow follow_request reblog favourite mention digest report),
|
||||
interactions: %i(must_be_follower must_be_following)
|
||||
)
|
||||
|
|
|
@ -92,7 +92,7 @@ class FeedManager
|
|||
end
|
||||
|
||||
query.each do |status|
|
||||
next if status.direct_visibility? || status.limited_visibility? || filter?(:home, status, into_account)
|
||||
next if not (status.direct_visibility? && account.user&.home_dms?) || status.limited_visibility? || filter?(:home, status, into_account)
|
||||
add_to_feed(:home, into_account.id, status, into_account.user&.aggregates_reblogs?)
|
||||
end
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ class UserSettingsDecorator
|
|||
user.settings['theme'] = theme_preference if change?('setting_theme')
|
||||
user.settings['hide_network'] = hide_network_preference if change?('setting_hide_network')
|
||||
user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs')
|
||||
user.settings['home_dms'] = aggregate_reblogs_preference if change?('home_dms')
|
||||
end
|
||||
|
||||
def merged_notification_emails
|
||||
|
@ -102,6 +103,10 @@ class UserSettingsDecorator
|
|||
boolean_cast_setting 'setting_aggregate_reblogs'
|
||||
end
|
||||
|
||||
def home_dms_preference
|
||||
boolean_cast_setting 'setting_home_dms'
|
||||
end
|
||||
|
||||
def boolean_cast_setting(key)
|
||||
ActiveModel::Type::Boolean.new.cast(settings[key])
|
||||
end
|
||||
|
|
|
@ -244,6 +244,10 @@ class User < ApplicationRecord
|
|||
@aggregates_reblogs ||= settings.aggregate_reblogs
|
||||
end
|
||||
|
||||
def home_dms?
|
||||
@home_dms ||= settings.home_dms
|
||||
end
|
||||
|
||||
def token_for_app(a)
|
||||
return nil if a.nil? || a.owner != self
|
||||
Doorkeeper::AccessToken
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
.fields-group
|
||||
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_home_dms, as: :boolean, wrapper: :with_label
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label
|
||||
|
|
Loading…
Reference in New Issue