Add display_in_directory setting (#14733)
* Add display_in_directory setting * Remove setting from constants * Update spec to use change
This commit is contained in:
parent
94d2261d42
commit
a024efcc45
5 changed files with 21 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ module Api
|
|||
context: ApplicationConfig["FOREM_CONTEXT"],
|
||||
cover_image_url: Settings::General.main_social_image,
|
||||
description: Settings::Community.community_description,
|
||||
display_in_directory: Settings::UserExperience.display_in_directory,
|
||||
logo_image_url: Settings::General.logo_png,
|
||||
name: Settings::Community.community_name,
|
||||
registered_users_count: User.registered.estimated_count,
|
||||
|
|
|
|||
|
|
@ -22,5 +22,6 @@ module Settings
|
|||
# a public forem could have more fine-grained authentication (listings ar private etc.) in future
|
||||
setting :public, type: :boolean, default: 0
|
||||
setting :tag_feed_minimum_score, type: :integer, default: 0
|
||||
setting :display_in_directory, type: :boolean, default: true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -72,6 +72,15 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="crayons-field crayons-field--checkbox">
|
||||
<%= f.check_box :display_in_directory, checked: Settings::UserExperience.display_in_directory, class: "crayons-checkbox" %>
|
||||
<div class="mt-0">
|
||||
<%= admin_config_label :display_in_directory, model: Settings::UserExperience %>
|
||||
<p class="crayons-field__description">
|
||||
Do you want this Forem to be displayed in the <a href="https://discover.forem.com" target="_blank">Forem Directory</a>?
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<%= render "update_setting_button", f: f %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -805,6 +805,15 @@ RSpec.describe "/admin/customization/config", type: :request do
|
|||
}
|
||||
expect(Settings::UserExperience.public).to eq(is_public)
|
||||
end
|
||||
|
||||
it "updates display_in_directory to false" do
|
||||
default_value = Settings::UserExperience.get_default(:display_in_directory)
|
||||
expect do
|
||||
post admin_settings_user_experiences_path, params: {
|
||||
settings_user_experience: { display_in_directory: false }
|
||||
}
|
||||
end.to change(Settings::UserExperience, :display_in_directory).from(default_value).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
describe "Credits" do
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ RSpec.describe "Api::V0::Instances", type: :request do
|
|||
expect(response.parsed_body["context"]).to eq ApplicationConfig["FOREM_CONTEXT"]
|
||||
expect(response.parsed_body["cover_image_url"]).to eq Settings::General.main_social_image
|
||||
expect(response.parsed_body["description"]).to eq Settings::Community.community_description
|
||||
expect(response.parsed_body["display_in_directory"]).to eq Settings::UserExperience.display_in_directory
|
||||
expect(response.parsed_body["logo_image_url"]).to eq Settings::General.logo_png
|
||||
expect(response.parsed_body["name"]).to eq Settings::Community.community_name
|
||||
expect(response.parsed_body["registered_users_count"]).to eq User.registered.estimated_count
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue