diff --git a/app/controllers/server_settings_controller.rb b/app/controllers/server_settings_controller.rb index 57154fe4..e6ad1dc6 100644 --- a/app/controllers/server_settings_controller.rb +++ b/app/controllers/server_settings_controller.rb @@ -34,16 +34,18 @@ def server_setting_params end def prepare_server_setting - @parent_settings = ServerSetting.where(parent_id: nil).includes(:children).order(:id) + @parent_settings = ENV['MASTODON_INSTANCE_URL']&.include?('channel') ? ServerSetting.where(parent_id: nil).includes(:children).order(:id) : ServerSetting.where(parent_id: nil).order(:id) @parent_settings = @parent_settings.where("lower(name) LIKE ?", "%#{@q.downcase}%") if @q.present? desired_order = ['Local Features', 'User Management', 'Content filters', 'Spam filters', 'Federation', 'Plug-ins'] + desired_child_name = ['Spam filters', 'Content filters', 'Bluesky', 'Custom theme', 'Search opt-out', 'Long posts and markdown', 'e-Newsletters'] @data = @parent_settings.map do |parent_setting| + child_setting_query = ENV['MASTODON_INSTANCE_URL']&.include?('channel') ? parent_setting.children.sort_by(&:position) : parent_setting.children.where(name: desired_child_name).sort_by(&:position) { name: parent_setting.name, - settings: parent_setting.children.sort_by(&:position).map do |child_setting| + settings: child_setting_query.map do |child_setting| { id: child_setting.id, name: child_setting.name, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a2254140..d1acbe58 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,6 +30,14 @@ def sidebar_menu_items { path: api_keys_path, id: 'resources-link', header: 'API Key', icon: 'key.svg', text: 'API Key', active_if: 'api_keys' }, { path: wait_lists_path, id: 'invitation-codes-link', header: 'Invitation codes', icon: 'invitation_code.svg', text: 'Invitation codes', active_if: 'wait_lists' }, { path: app_versions_path(app_name: AppVersion.app_names['patchwork']), id: 'app-versions-link', header: 'App versions', icon: 'sliders.svg', text: 'App versions', active_if: 'app_versions' }, + *( + if ["patchwork.io", "mo-me.social", "newsmast.social"].any? { |domain| ENV['MASTODON_INSTANCE_URL']&.include?(domain) } + [ + { path: "#{ENV['MASTODON_INSTANCE_URL']}/admin/dashboard", id: 'administration-link', header: 'Administration', icon: 'administrator.svg', text: 'Administration', target: '_blank' }, + { path: "#{ENV['MASTODON_INSTANCE_URL']}/admin/reports", id: 'moderation-link', header: 'Moderation', icon: 'users.svg', text: 'Moderation', target: '_blank' }, + ] + end + ), { path: "/sidekiq", id: 'sidekiq-link', header: 'Sidekiq', icon: 'smile-1.svg', text: 'Sidekiq', target: '_blank' }, { path: '#', id: 'help-support-link', header: 'Help & Support', icon: 'question.svg', text: 'Help & Support', active_if: 'help_support' } ]