diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb index 670c3b02b6b..79a6b224546 100644 --- a/app/controllers/api/v1/timelines/public_controller.rb +++ b/app/controllers/api/v1/timelines/public_controller.rb @@ -16,11 +16,11 @@ class Api::V1::Timelines::PublicController < Api::V1::Timelines::BaseController def require_auth? if truthy_param?(:local) - Setting.local_live_feed_access != 'public' + Setting.local_live_feed_access != 'all' elsif truthy_param?(:remote) - Setting.remote_live_feed_access != 'public' + Setting.remote_live_feed_access != 'all' else - Setting.local_live_feed_access != 'public' || Setting.remote_live_feed_access != 'public' + Setting.local_live_feed_access != 'all' || Setting.remote_live_feed_access != 'all' end end diff --git a/app/controllers/api/v1/timelines/topic_controller.rb b/app/controllers/api/v1/timelines/topic_controller.rb index 6faf54f7083..7190ce3b09b 100644 --- a/app/controllers/api/v1/timelines/topic_controller.rb +++ b/app/controllers/api/v1/timelines/topic_controller.rb @@ -7,11 +7,11 @@ class Api::V1::Timelines::TopicController < Api::V1::Timelines::BaseController def require_auth? if truthy_param?(:local) - Setting.local_topic_feed_access != 'public' + Setting.local_topic_feed_access != 'all' elsif truthy_param?(:remote) - Setting.remote_topic_feed_access != 'public' + Setting.remote_topic_feed_access != 'all' else - Setting.local_topic_feed_access != 'public' || Setting.remote_topic_feed_access != 'public' + Setting.local_topic_feed_access != 'all' || Setting.remote_topic_feed_access != 'all' end end end diff --git a/app/javascript/mastodon/initial_state.ts b/app/javascript/mastodon/initial_state.ts index c1cd377530d..8b29c651d3f 100644 --- a/app/javascript/mastodon/initial_state.ts +++ b/app/javascript/mastodon/initial_state.ts @@ -33,10 +33,10 @@ interface InitialStateMeta { single_user_mode: boolean; source_url: string; streaming_api_base_url: string; - local_live_feed_access: 'public' | 'authenticated' | 'disabled'; - remote_live_feed_access: 'public' | 'authenticated' | 'disabled'; - local_topic_feed_access: 'public' | 'authenticated' | 'disabled'; - remote_topic_feed_access: 'public' | 'authenticated' | 'disabled'; + local_live_feed_access: 'all' | 'users' | 'disabled'; + remote_live_feed_access: 'all' | 'users' | 'disabled'; + local_topic_feed_access: 'all' | 'users' | 'disabled'; + remote_topic_feed_access: 'all' | 'users' | 'disabled'; title: string; show_trends: boolean; trends_as_landing_page: boolean; diff --git a/app/javascript/mastodon/permissions.ts b/app/javascript/mastodon/permissions.ts index a83e1d77a7d..2d478fc5a8d 100644 --- a/app/javascript/mastodon/permissions.ts +++ b/app/javascript/mastodon/permissions.ts @@ -27,12 +27,12 @@ export function canManageReports(permissions: number) { export const canViewFeed = ( signedIn: boolean, permissions: number, - setting: 'public' | 'authenticated' | 'disabled' | undefined, + setting: 'all' | 'users' | 'disabled' | undefined, ) => { switch (setting) { - case 'public': + case 'all': return true; - case 'authenticated': + case 'users': return signedIn; case 'disabled': default: diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 8b3c09a351e..b1d9000c338 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -87,7 +87,7 @@ class Form::AdminSettings DESCRIPTION_LIMIT = 200 DOMAIN_BLOCK_AUDIENCES = %w(disabled users all).freeze REGISTRATION_MODES = %w(open approved none).freeze - FEED_ACCESS_MODES = %w(public authenticated disabled).freeze + FEED_ACCESS_MODES = %w(all users disabled).freeze attr_accessor(*KEYS) diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb index 92efc0f7e5b..30601e91623 100644 --- a/app/models/public_feed.rb +++ b/app/models/public_feed.rb @@ -44,9 +44,9 @@ class PublicFeed def user_has_access_to_feed?(setting) case setting - when 'public' + when 'public', 'all' true - when 'authenticated' + when 'authenticated', 'users' @account&.user&.functional? when 'disabled' @account&.user&.can?(:view_feeds) diff --git a/config/locales/en.yml b/config/locales/en.yml index 15c3c582bb0..71e02ce3923 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -852,9 +852,9 @@ en: users: To logged-in local users feed_access: modes: - authenticated: Authenticated users only + all: Everyone disabled: Require specific user role - public: Everyone + users: Authenticated users only registrations: moderation_recommandation: Please make sure you have an adequate and reactive moderation team before you open registrations to everyone! preamble: Control who can create an account on your server. diff --git a/config/settings.yml b/config/settings.yml index c6478e57d46..f5323d7a808 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -12,10 +12,10 @@ defaults: &defaults registrations_mode: 'none' profile_directory: true closed_registrations_message: '' - local_live_feed_access: 'public' - remote_live_feed_access: 'public' - local_topic_feed_access: 'public' - remote_topic_feed_access: 'public' + local_live_feed_access: 'all' + remote_live_feed_access: 'all' + local_topic_feed_access: 'all' + remote_topic_feed_access: 'all' show_staff_badge: true preview_sensitive_media: false noindex: false diff --git a/db/migrate/20251023125005_migrate_feed_access_values.rb b/db/migrate/20251023125005_migrate_feed_access_values.rb new file mode 100644 index 00000000000..fd51d0cc71d --- /dev/null +++ b/db/migrate/20251023125005_migrate_feed_access_values.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class MigrateFeedAccessValues < ActiveRecord::Migration[8.0] + class Setting < ApplicationRecord; end + + def up + %w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).each do |var| + setting = Setting.find_by(var: var) + next unless setting.present? && setting.attributes['value'].present? + + value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol]) + + case value + when 'public' + setting.update(value: "--- all\n") + when 'authenticated' + setting.update(value: "--- users\n") + end + end + end + + def down; end +end diff --git a/db/schema.rb b/db/schema.rb index 8910bac36a8..a4b871e4c96 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_10_07_142305) do +ActiveRecord::Schema[8.0].define(version: 2025_10_23_125005) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql"