add preference options to a: hide boosts globally, & b: show only packmates across all timelines - works in all client apps
parent
1fecec8fb6
commit
32d998b623
|
@ -23,7 +23,11 @@ class Api::V1::Timelines::HomeController < Api::BaseController
|
|||
end
|
||||
|
||||
def cached_home_statuses
|
||||
cache_collection home_statuses, Status
|
||||
if current_account&.user&.hides_boosts?
|
||||
cache_collection home_statuses.without_reblogs, Status
|
||||
else
|
||||
cache_collection home_statuses, Status
|
||||
end
|
||||
end
|
||||
|
||||
def home_statuses
|
||||
|
|
|
@ -25,7 +25,11 @@ class Api::V1::Timelines::ListController < Api::BaseController
|
|||
end
|
||||
|
||||
def cached_list_statuses
|
||||
cache_collection list_statuses, Status
|
||||
if current_account&.user&.hides_boosts?
|
||||
cache_collection list_statuses.without_reblogs, Status
|
||||
else
|
||||
cache_collection list_statuses, Status
|
||||
end
|
||||
end
|
||||
|
||||
def list_statuses
|
||||
|
|
|
@ -51,6 +51,8 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
:setting_hide_mntions_blocked,
|
||||
:setting_hide_mntions_blocker,
|
||||
:setting_hide_mntions_packm8,
|
||||
:setting_hide_boosts,
|
||||
:setting_only_known,
|
||||
:setting_gently_kobolds,
|
||||
:setting_user_is_kobold,
|
||||
:setting_hide_mascot,
|
||||
|
|
|
@ -30,6 +30,8 @@ class UserSettingsDecorator
|
|||
user.settings['hide_mntions_blocked']= hide_mntions_blocked_preference if change?('setting_hide_mntions_blocked')
|
||||
user.settings['hide_mntions_blocker']= hide_mntions_blocker_preference if change?('setting_hide_mntions_blocker')
|
||||
user.settings['hide_mntions_packm8'] = hide_mntions_packm8_preference if change?('setting_hide_mntions_packm8')
|
||||
user.settings['hide_boosts'] = hide_boosts_preference if change?('setting_hide_boosts')
|
||||
user.settings['only_known'] = only_known_preference if change?('setting_only_known')
|
||||
user.settings['force_lowercase'] = force_lowercase_preference if change?('setting_force_lowercase')
|
||||
user.settings['hide_captions'] = hide_captions_preference if change?('setting_hide_captions')
|
||||
user.settings['hide_mascot'] = hide_mascot_preference if change?('setting_hide_mascot')
|
||||
|
@ -125,6 +127,14 @@ class UserSettingsDecorator
|
|||
boolean_cast_setting 'setting_hide_mascot'
|
||||
end
|
||||
|
||||
def hide_boosts_preference
|
||||
boolean_cast_setting 'setting_hide_boosts'
|
||||
end
|
||||
|
||||
def only_known_preference
|
||||
boolean_cast_setting 'setting_only_known'
|
||||
end
|
||||
|
||||
def hide_interactions_preference
|
||||
boolean_cast_setting 'setting_hide_interactions'
|
||||
end
|
||||
|
|
|
@ -125,6 +125,8 @@ class Status < ApplicationRecord
|
|||
|
||||
scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).select('statuses.*').where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') }
|
||||
|
||||
scope :only_followers_of, ->(account) { where(account: [account] + account.following) }
|
||||
|
||||
scope :tagged_with_all, ->(tags) {
|
||||
Array(tags).map(&:id).map(&:to_i).reduce(self) do |result, id|
|
||||
result.joins("INNER JOIN statuses_tags t#{id} ON t#{id}.status_id = statuses.id AND t#{id}.tag_id = #{id}")
|
||||
|
@ -390,7 +392,9 @@ class Status < ApplicationRecord
|
|||
end
|
||||
|
||||
def as_home_timeline(account)
|
||||
where(account: [account] + account.following, visibility: [:public, :unlisted, :local, :private])
|
||||
query = where(account: [account] + account.following, visibility: [:public, :unlisted, :local, :private])
|
||||
query = query.without_reblogs if account.present? && account&.user&.hides_boosts?
|
||||
query
|
||||
end
|
||||
|
||||
def as_direct_timeline(account, limit = 20, max_id = nil, since_id = nil, cache_ids = false)
|
||||
|
@ -440,13 +444,20 @@ class Status < ApplicationRecord
|
|||
else
|
||||
query = Status.curated
|
||||
end
|
||||
|
||||
query = query.without_replies unless Setting.show_replies_in_public_timelines
|
||||
|
||||
if account.present? && account.local?
|
||||
query = query.without_reblogs if account&.user&.hides_boosts?
|
||||
query = query.only_followers_of(account) if account&.user&.shows_only_known?
|
||||
end
|
||||
|
||||
apply_timeline_filters(query, account, local_only)
|
||||
end
|
||||
|
||||
def as_tag_timeline(tag, account = nil, local_only = false, priv = false)
|
||||
query = tag_timeline_scope(account, local_only, priv).tagged_with(tag)
|
||||
query = query.only_followers_of(account) if account.present? && account.local? && account&.user&.shows_only_known?
|
||||
apply_timeline_filters(query, account, local_only, true)
|
||||
end
|
||||
|
||||
|
|
|
@ -132,6 +132,8 @@ class User < ApplicationRecord
|
|||
:hide_mntions_blocker,
|
||||
:hide_mntions_packm8,
|
||||
:hide_mascot,
|
||||
:hide_boosts,
|
||||
:only_known,
|
||||
:hide_interactions,
|
||||
:hide_public_profile,
|
||||
:hide_public_outbox,
|
||||
|
@ -305,6 +307,14 @@ class User < ApplicationRecord
|
|||
@hides_mascot ||= (settings.hide_mascot || false)
|
||||
end
|
||||
|
||||
def hides_boosts?
|
||||
@hides_boosts ||= (settings.hide_boosts || false)
|
||||
end
|
||||
|
||||
def shows_only_known?
|
||||
@only_known ||= (settings.only_known || false)
|
||||
end
|
||||
|
||||
def hides_interactions?
|
||||
@hides_interactions ||= (settings.hide_interactions || false)
|
||||
end
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
|
||||
.fields-group
|
||||
= f.input :setting_rawr_federated, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_hide_boosts, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_only_known, as: :boolean, wrapper: :with_label
|
||||
|
||||
%hr/
|
||||
|
||||
|
|
|
@ -155,6 +155,8 @@ en:
|
|||
setting_hide_mntions_packm8: Filter group chat branches addressed to participants you aren't a packmate of
|
||||
setting_hide_mascot: Don't show the mascot image
|
||||
setting_hide_interactions: Make your roar interaction lists private
|
||||
setting_hide_boosts: Don't show boosts on any timeline
|
||||
setting_only_known: Only show posts from packmates on all timelines
|
||||
setting_aggregate_reblogs: Group repeats in timelines
|
||||
setting_auto_play_gif: Auto-play animated GIFs
|
||||
setting_boost_modal: Show confirmation dialog before repeating
|
||||
|
|
Loading…
Reference in New Issue