Skip to content

Commit

Permalink
Split 'show boosts/replies in public timelines' glitch admin settings…
Browse files Browse the repository at this point in the history
… into local and federated (#8)

* Showing all federated boosts is noisy while local boosts may be acceptable (especially once #4 is addressed)
  • Loading branch information
deanveloper authored and neatchee committed Mar 27, 2023
1 parent beb53a5 commit 3fba24d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v1/timelines/public_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def public_feed
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

Expand Down
12 changes: 8 additions & 4 deletions app/models/form/admin_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
trends_as_landing_page
trendable_by_default
Expand Down Expand Up @@ -56,8 +58,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
trends_as_landing_page
trendable_by_default
Expand Down
19 changes: 12 additions & 7 deletions app/services/fan_out_on_write_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,19 @@ def broadcast_to_hashtag_streams!
end

def broadcast_to_public_streams!
return if @status.reply? && @status.in_reply_to_account_id != @account.id && !Setting.show_replies_in_public_timelines

redis.publish('timeline:public', anonymous_payload)
redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
broadcast_to = ->(channel) {
redis.publish(channel, anonymous_payload)
if @status.with_media?
redis.publish("#{channel}:media")
end
}
is_reply = @status.reply? && @status.in_reply_to_account_id != @account.id

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

Expand Down
10 changes: 8 additions & 2 deletions app/views/admin/settings/other/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions config/locales-glitch/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3fba24d

Please sign in to comment.