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_theme,
|
||||||
:setting_hide_network,
|
:setting_hide_network,
|
||||||
:setting_aggregate_reblogs,
|
:setting_aggregate_reblogs,
|
||||||
|
:setting_home_dms,
|
||||||
notification_emails: %i(follow follow_request reblog favourite mention digest report),
|
notification_emails: %i(follow follow_request reblog favourite mention digest report),
|
||||||
interactions: %i(must_be_follower must_be_following)
|
interactions: %i(must_be_follower must_be_following)
|
||||||
)
|
)
|
||||||
|
|
|
@ -92,7 +92,7 @@ class FeedManager
|
||||||
end
|
end
|
||||||
|
|
||||||
query.each do |status|
|
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?)
|
add_to_feed(:home, into_account.id, status, into_account.user&.aggregates_reblogs?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ class UserSettingsDecorator
|
||||||
user.settings['theme'] = theme_preference if change?('setting_theme')
|
user.settings['theme'] = theme_preference if change?('setting_theme')
|
||||||
user.settings['hide_network'] = hide_network_preference if change?('setting_hide_network')
|
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['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs')
|
||||||
|
user.settings['home_dms'] = aggregate_reblogs_preference if change?('home_dms')
|
||||||
end
|
end
|
||||||
|
|
||||||
def merged_notification_emails
|
def merged_notification_emails
|
||||||
|
@ -102,6 +103,10 @@ class UserSettingsDecorator
|
||||||
boolean_cast_setting 'setting_aggregate_reblogs'
|
boolean_cast_setting 'setting_aggregate_reblogs'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def home_dms_preference
|
||||||
|
boolean_cast_setting 'setting_home_dms'
|
||||||
|
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
|
||||||
|
|
|
@ -244,6 +244,10 @@ class User < ApplicationRecord
|
||||||
@aggregates_reblogs ||= settings.aggregate_reblogs
|
@aggregates_reblogs ||= settings.aggregate_reblogs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def home_dms?
|
||||||
|
@home_dms ||= settings.home_dms
|
||||||
|
end
|
||||||
|
|
||||||
def token_for_app(a)
|
def token_for_app(a)
|
||||||
return nil if a.nil? || a.owner != self
|
return nil if a.nil? || a.owner != self
|
||||||
Doorkeeper::AccessToken
|
Doorkeeper::AccessToken
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label
|
= f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label
|
||||||
|
= f.input :setting_home_dms, as: :boolean, wrapper: :with_label
|
||||||
|
|
||||||
.fields-group
|
.fields-group
|
||||||
= f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label
|
= f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label
|
||||||
|
|
Loading…
Reference in New Issue