From b5e23152bd1c2ea1091b2785a49e9ab3d0f3fd16 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 2 Mar 2020 01:16:05 -0600 Subject: clean up timeline scoping & drop timeline options no longer used by monsterfork --- app/controllers/settings/preferences_controller.rb | 1 - app/lib/user_settings_decorator.rb | 5 --- app/models/form/admin_settings.rb | 4 --- app/models/status.rb | 41 +++++----------------- app/models/user.rb | 5 --- app/services/fan_out_on_write_service.rb | 6 ++-- app/views/admin/settings/edit.html.haml | 6 ---- app/views/settings/preferences/show.html.haml | 3 -- config/locales/en.yml | 6 ---- config/locales/simple_form.en.yml | 1 - config/settings.yml | 2 -- 11 files changed, 12 insertions(+), 68 deletions(-) diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index c64ae9ab7..56abd5d73 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -64,7 +64,6 @@ class Settings::PreferencesController < Settings::BaseController params.require(:user).permit( :setting_default_local, :setting_always_local, - :setting_rawr_federated, :setting_hide_stats, :setting_force_lowercase, :setting_hide_captions, diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index 8e95f518a..e38e47aa2 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -17,7 +17,6 @@ class UserSettingsDecorator def process_update 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['larger_menus'] = larger_menus_preference if change?('setting_larger_menus') user.settings['larger_buttons'] = larger_buttons_preference if change?('setting_larger_buttons') @@ -233,10 +232,6 @@ class UserSettingsDecorator boolean_cast_setting 'setting_always_local' end - def rawr_federated_preference - boolean_cast_setting 'setting_rawr_federated' - end - def hide_stats_preference boolean_cast_setting 'setting_hide_stats' end diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 40e1da84b..7e68196a7 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -32,8 +32,6 @@ class Form::AdminSettings thumbnail hero mascot - show_reblogs_in_public_timelines - show_replies_in_public_timelines auto_reject_unknown auto_mark_known auto_mark_instance_actors_known @@ -60,8 +58,6 @@ class Form::AdminSettings profile_directory hide_followers_count enable_keybase - show_reblogs_in_public_timelines - show_replies_in_public_timelines auto_reject_unknown auto_mark_known auto_mark_instance_actors_known diff --git a/app/models/status.rb b/app/models/status.rb index e707f3683..e4cbfd2a6 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -500,25 +500,17 @@ class Status < ApplicationRecord end def as_public_timeline(account = nil, local_only = false) - if local_only || account.nil? || account&.user&.setting_rawr_federated - query = timeline_scope(local_only) - else - query = Status.curated - end - - query = query.without_replies unless Setting.show_replies_in_public_timelines - - if account.present? && account.local? + query = (local_only || account.nil?) ? timeline_scope(local_only) : curated + if account&.local? query = query.without_reblogs if account&.user&.hide_boosts - query = query.only_followers_of(account) if account&.user&.only_known + query = query.only_followers_of(account) if account&.user&.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&.only_known? + query = query.only_followers_of(account) if account&.local? && account&.user&.only_known? apply_timeline_filters(query, account, local_only, true) end @@ -592,23 +584,13 @@ class Status < ApplicationRecord private def timeline_scope(local_only = false) - starting_scope = local_only ? Status.network : Status - starting_scope = local_only ? starting_scope.public_local_visibility : starting_scope.with_public_visibility - if Setting.show_reblogs_in_public_timelines - starting_scope - else - starting_scope.without_reblogs - end + starting_scope = local_only ? Status.network.public_local_visibility : Status.with_public_visibility + starting_scope.without_reblogs end def browsable_timeline_scope(local_only = false) starting_scope = local_only ? Status.network : Status - starting_scope = starting_scope.public_browsable - if Setting.show_reblogs_in_public_timelines - starting_scope - else - starting_scope.without_reblogs - end + starting_scope.public_browsable.without_reblogs end def tag_timeline_scope(account = nil, local_only = false, priv = false) @@ -616,15 +598,10 @@ class Status < ApplicationRecord return Status.none if account.nil? starting_scope = account.statuses else - starting_scope = local_only ? Status.network : Status - starting_scope = starting_scope.public_browsable + starting_scope = (local_only ? Status.network : Status).public_browsable end - if Setting.show_reblogs_in_public_timelines - starting_scope - else - starting_scope.without_reblogs - end + starting_scope.without_reblogs end def apply_timeline_filters(query, account = nil, local_only = false, tag_timeline = false) diff --git a/app/models/user.rb b/app/models/user.rb index 52d9a2add..7d6969745 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -130,7 +130,6 @@ class User < ApplicationRecord delegate :default_local, :always_local, - :rawr_federated, :hide_stats, :force_lowercase, :hide_captions, @@ -416,10 +415,6 @@ class User < ApplicationRecord @always_local_only ||= (settings.always_local || false) end - def wants_raw_federated? - @wants_raw_federated ||= (settings.rawr_federated || false) - end - def hides_stats? @hides_stats ||= (settings.hide_stats || false) end diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 4d868b699..3bd3717fe 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -21,7 +21,7 @@ class FanOutOnWriteService < BaseService deliver_to_mentioned_followers(status) elsif status.local_visibility? deliver_to_followers(status) unless public_only || status.curated - return if status.reblog? && !Setting.show_reblogs_in_public_timelines + return if status.reblog? deliver_to_lists(status) unless public_only || status.curated deliver_to_local(status) unless filtered?(status) else @@ -30,7 +30,7 @@ class FanOutOnWriteService < BaseService deliver_to_lists(status) end - return if status.reblog? && !Setting.show_reblogs_in_public_timelines + return if status.reblog? return if filtered?(status) || (status.reblog? && filtered?(status.reblog)) if !status.reblog? && status.distributable? @@ -53,7 +53,7 @@ class FanOutOnWriteService < BaseService private def filtered?(status) - status.account.silenced? || !Setting.show_replies_in_public_timelines && status.reply? && status.in_reply_to_account_id != status.account_id + status.account.silenced? || status.reply? && status.in_reply_to_account_id != status.account_id end def deliver_to_self(status) diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml index 92900de85..8e58215ca 100644 --- a/app/views/admin/settings/edit.html.haml +++ b/app/views/admin/settings/edit.html.haml @@ -89,12 +89,6 @@ .fields-group = f.input :enable_keybase, as: :boolean, wrapper: :with_label, label: t('admin.settings.enable_keybase.title'), hint: t('admin.settings.enable_keybase.desc_html') - .fields-group - = f.input :show_reblogs_in_public_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_reblogs_in_public_timelines.title'), hint: t('admin.settings.show_reblogs_in_public_timelines.desc_html') - - .fields-group - = f.input :show_replies_in_public_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_replies_in_public_timelines.title'), hint: t('admin.settings.show_replies_in_public_timelines.desc_html') - .fields-group = f.input :spam_check_enabled, as: :boolean, wrapper: :with_label, label: t('admin.settings.spam_check_enabled.title'), hint: t('admin.settings.spam_check_enabled.desc_html') diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index c51f91bde..bda993bf6 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -88,9 +88,6 @@ = f.input :filter_undescribed, as: :boolean, wrapper: :with_label = f.input :setting_hide_sensitive_cards, as: :boolean, wrapper: :with_label - .fields-group - = f.input :setting_rawr_federated, as: :boolean, wrapper: :with_label - %hr/ .fields-group diff --git a/config/locales/en.yml b/config/locales/en.yml index b592f5de5..573c44c7f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -509,12 +509,6 @@ en: show_known_fediverse_at_about_page: desc_html: When toggled, it will show roars from all the known fediverse on preview. Otherwise it will only show local roars. title: Show known fediverse on timeline preview - show_reblogs_in_public_timelines: - desc_html: Show public boosts of public toots in local and public timelines. - title: Show boosts in public timelines - show_replies_in_public_timelines: - desc_html: In addition to public self-replies (threads), show public replies in local and public timelines. - title: Show replies in public timelines show_staff_badge: desc_html: Show a staff badge on a creature page title: Show staff badge diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 224047a69..f840184f1 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -154,7 +154,6 @@ en: setting_boost_interval_to: Maximum boost interval setting_default_local: Default to Monsterpit-only roars (in Glitch flavour) 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_force_lowercase: make everything lowercase setting_hide_captions: Hide media captions diff --git a/config/settings.yml b/config/settings.yml index 4f4ac0db8..95bae4127 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -63,8 +63,6 @@ defaults: &defaults activity_api_enabled: true peers_api_enabled: true show_known_fediverse_at_about_page: true - show_reblogs_in_public_timelines: false - show_replies_in_public_timelines: false default_content_type: 'text/x-bbcode+markdown' auto_reject_unknown: true auto_mark_known: true -- cgit