Compare commits

...

7 commits

Author SHA1 Message Date
neatchee 109ccf9f60 db migration for show public reblogs/replies in public timelines setting split 2023-01-04 14:48:19 -08:00
neatchee 80cc050e02 Add missing config/settings.yml default values for show boosts/replies in local/federated timelines 2023-01-04 13:46:15 -08:00
neatchee 4794789f3d
Code style improvements
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2023-01-04 06:51:11 -08:00
neatchee 874d68fedf Merge branch 'split_public_visible' of github.com:neatchee/mastodon into split_public_visible 2023-01-03 15:16:06 -08:00
neatchee a6b4f5217c Fix missing argument in 4dc140c721 (#29)
Fixes #25
2023-01-03 15:15:40 -08:00
neatchee 78d412c931
Merge branch 'glitch-soc:main' into split_public_visible 2023-01-03 15:11:25 -08:00
Dean Bassett fe2acbc4c4 Split 'show boosts/replies in public timelines' glitch admin settings into local and federated (#8)
* Showing all federated boosts is noisy while local boosts may be acceptable (especially once #4 is addressed)
2022-12-29 20:04:42 -08:00
7 changed files with 78 additions and 23 deletions

View file

@ -39,8 +39,8 @@ class Api::V1::Timelines::PublicController < Api::BaseController
remote: truthy_param?(:remote),
only_media: truthy_param?(:only_media),
allow_local_only: truthy_param?(:allow_local_only),
with_replies: Setting.show_replies_in_public_timelines,
with_reblogs: Setting.show_reblogs_in_public_timelines,
with_replies: truthy_param?(:local) ? Setting.show_replies_in_local_timelines : Setting.show_replies_in_federated_timelines,
with_reblogs: truthy_param?(:local) ? Setting.show_reblogs_in_local_timelines : Setting.show_reblogs_in_federated_timelines,
)
end

View file

@ -25,8 +25,10 @@ class Form::AdminSettings
flavour_and_skin
thumbnail
mascot
show_reblogs_in_public_timelines
show_replies_in_public_timelines
show_reblogs_in_local_timelines
show_replies_in_local_timelines
show_reblogs_in_federated_timelines
show_replies_in_federated_timelines
trends
trendable_by_default
trending_status_cw
@ -54,8 +56,10 @@ class Form::AdminSettings
preview_sensitive_media
profile_directory
hide_followers_count
show_reblogs_in_public_timelines
show_replies_in_public_timelines
show_reblogs_in_local_timelines
show_replies_in_local_timelines
show_reblogs_in_federated_timelines
show_replies_in_federated_timelines
trends
trendable_by_default
trending_status_cw

View file

@ -129,14 +129,17 @@ class FanOutOnWriteService < BaseService
end
def broadcast_to_public_streams!
return if @status.reply? && @status.in_reply_to_account_id != @account.id && !Setting.show_replies_in_public_timelines
broadcast_to = ->(channel) {
redis.publish(channel, anonymous_payload)
redis.publish("#{channel}:media", anonymous_payload) if @status.with_media?
}
is_reply = @status.reply? && @status.in_reply_to_account_id != @account.id
redis.publish('timeline:public', anonymous_payload)
redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
if @status.with_media?
redis.publish('timeline:public:media', anonymous_payload)
redis.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', anonymous_payload)
broadcast_to.call('timeline:public') if !is_reply || Setting.show_replies_in_federated_timelines
if @status.local
broadcast_to.call('timeline:public:local') if !is_reply || Setting.show_replies_in_local_timelines
else
broadcast_to.call('timeline:public:remote') if !is_reply || Setting.show_replies_in_federated_timelines
end
end

View file

@ -14,10 +14,16 @@
= f.input :hide_followers_count, as: :boolean, wrapper: :with_label, label: t('admin.settings.hide_followers_count.title'), hint: t('admin.settings.hide_followers_count.desc_html'), glitch_only: true
.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'), glitch_only: true
= f.input :show_reblogs_in_local_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_reblogs_in_local_timelines.title'), hint: t('admin.settings.show_reblogs_in_local_timelines.desc_html'), glitch_only: true
.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'), glitch_only: true
= f.input :show_replies_in_local_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_replies_in_local_timelines.title'), hint: t('admin.settings.show_replies_in_local_timelines.desc_html'), glitch_only: true
.fields-group
= f.input :show_reblogs_in_federated_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_reblogs_in_federated_timelines.title'), hint: t('admin.settings.show_reblogs_in_federated_timelines.desc_html'), glitch_only: true
.fields-group
= f.input :show_replies_in_federated_timelines, as: :boolean, wrapper: :with_label, label: t('admin.settings.show_replies_in_federated_timelines.title'), hint: t('admin.settings.show_replies_in_federated_timelines.desc_html'), glitch_only: true
.fields-group
= f.input :outgoing_spoilers, wrapper: :with_label, label: t('admin.settings.outgoing_spoilers.title'), hint: t('admin.settings.outgoing_spoilers.desc_html'), glitch_only: true

View file

@ -19,12 +19,18 @@ en:
outgoing_spoilers:
desc_html: When federating toots, add this content warning to toots that do not have one. It is useful if your server is specialized in content other servers might want to have under a Content Warning. Media will also be marked as sensitive.
title: Content warning for outgoing toots
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_reblogs_in_federated_timelines:
desc_html: Show public boosts of public toots in the federated timeline.
title: Show boosts in the federated timeline
show_reblogs_in_local_timelines:
desc_html: Show public boosts in the instance's local timeline.
title: Show boosts in the local timeline
show_replies_in_federated_timelines:
desc_html: In addition to public self-replies (threads), show public replies in the federated timeline.
title: Show replies in the federated timeline
show_replies_in_local_timelines:
desc_html: In addition to public self-replies (threads), show public replies in the instance's local timeline.
title: Show replies in the local timeline
trending_status_cw:
desc_html: When trending posts are enabled, allow posts with Content Warnings to be eligible. Changes to this setting are not retroactive.
title: Allow posts with Content Warnings to trend

View file

@ -73,8 +73,10 @@ defaults: &defaults
bootstrap_timeline_accounts: ''
activity_api_enabled: true
peers_api_enabled: true
show_reblogs_in_public_timelines: false
show_replies_in_public_timelines: false
show_reblogs_in_local_timelines: false
show_reblogs_in_federated_timelines: false
show_replies_in_local_timelines: false
show_replies_in_federated_timelines: false
default_content_type: 'text/plain'
show_domain_blocks: 'disabled'
show_domain_blocks_rationale: 'disabled'

View file

@ -0,0 +1,34 @@
class MigrateShowReblogsRepliesInPublicTimelinesSetting < ActiveRecord::Migration[6.1]
def up
show_reblogs_in_public_timelines = Setting.find_by(var: 'show_reblogs_in_public_timelines')
if show_reblogs_in_public_timelines.nil? || show_reblogs_in_public_timelines.value
setting_local = Setting.where(var: 'show_reblogs_in_local_timelines').first_or_initialize(var: 'show_reblogs_in_local_timelines')
setting_federated = Setting.where(var: 'show_reblogs_in_federated_timelines').first_or_initialize(var: 'show_reblogs_in_federated_timelines')
setting_local.update(value: true)
setting_federated.update(value: true)
end
show_replies_in_public_timelines = Setting.find_by(var: 'show_replies_in_public_timelines')
if show_replies_in_public_timelines.nil? || show_replies_in_public_timelines.value
setting_local = Setting.where(var: 'show_replies_in_local_timelines').first_or_initialize(var: 'show_replies_in_local_timelines')
setting_federated = Setting.where(var: 'show_replies_in_federated_timelines').first_or_initialize(var: 'show_replies_in_federated_timelines')
setting_local.update(value: true)
setting_federated.update(value: true)
end
end
def down
show_reblogs_in_local_timelines = Setting.find_by(var: 'show_reblogs_in_local_timelines')
show_reblogs_in_federate_timelines = Setting.find_by(var: 'show_reblogs_in_federated_timelines')
if show_reblogs_in_local_timelines.nil? || show_reblogs_in_local_timelines.value || show_reblogs_in_federated_timelines.nil? || show_reblogs_in_federated_timelines.value
setting = Setting.where(var: 'show_reblogs_in_public_timelines').first_or_initialize(var: 'show_reblogs_in_public_timelines')
setting.update(value: true)
end
show_replies_in_public_timelines = Setting.find_by(var: 'show_replies_in_public_timelines')
if show_replies_in_local_timelines.nil? || show_replies_in_local_timelines.value || show_replies_in_federated_timelines.nil? || show_replies_in_federated_timelines.value
setting = Setting.where(var: 'show_replies_in_public_timelines').first_or_initialize(var: 'show_replies_in_public_timelines')
setting.update(value: true)
end
end
end