-
-
Notifications
You must be signed in to change notification settings - Fork 71
Make community assets paths configurable #1946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Oaphi
wants to merge
12
commits into
develop
Choose a base branch
from
0valt/1941/community-assets-settings
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f9b75d5
added JSPath & CSSPath site settings & handling
Oaphi 54dd4f9
added new site setting type that only works with URI paths
Oaphi cf9e643
fixed a bunch of linter issues in seeds.rb
Oaphi 842a045
fixed minor linter issues in db scripts
Oaphi d3e2d6c
linted migrations (suggestions from Rubocop)
Oaphi f917abc
enabled linting for db-related sources
Oaphi 2951416
added seed for community assets (very conservative)
Oaphi ae072eb
system user is only guaranteed upon running post seeds
Oaphi cd5fa2f
Stats seed struct should only be defined once
Oaphi 8766c2b
fixed AddTagSetReferenceToTags migration linter change
Oaphi 0ab6aaf
special handling of community assets routes is no longer needed
Oaphi e62f1bc
adjusted CSSPath & JSPath site setting seeds wording to align with ot…
Oaphi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| class AddCategoryToSiteSettings < ActiveRecord::Migration[5.2] | ||
| def change | ||
| add_column :site_settings, :category, :string | ||
| add_index :site_settings, :category | ||
| end | ||
| end | ||
| class AddCategoryToSiteSettings < ActiveRecord::Migration[5.2] | ||
| def change | ||
| add_column :site_settings, :category, :string | ||
| add_index :site_settings, :category | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,37 @@ | ||
| class AddSettingCategories < ActiveRecord::Migration[5.2] | ||
| def change | ||
| # This migration only needs to run if there are already existing settings without a category. | ||
| # That's not the case in test, because they get seeded as necessary, so we don't need to run this. | ||
| return if Rails.env.test? | ||
| categories = { | ||
| site_name: :site_details, | ||
| site_logo_path: :site_details, | ||
| question_up_vote_rep: :reputation_and_voting, | ||
| question_down_vote_rep: :reputation_and_voting, | ||
| answer_up_vote_rep: :reputation_and_voting, | ||
| answer_down_vote_rep: :reputation_and_voting, | ||
| allow_self_votes: :reputation_and_voting, | ||
| asking_guidance: :help_and_guidance, | ||
| answering_guidance: :help_and_guidance, | ||
| administrator_contact_email: :site_details, | ||
| hot_questions_count: :display, | ||
| admin_badge_character: :display, | ||
| mod_badge_character: :display, | ||
| soft_delete_transfer_user: :advanced_settings, | ||
| new_user_initial_rep: :reputation_and_voting, | ||
| se_api_client_id: :integrations, | ||
| se_api_client_secret: :integrations, | ||
| se_api_key: :integrations, | ||
| content_license_name: :site_details, | ||
| content_license_link: :site_details, | ||
| max_tag_length: :site_details, | ||
| max_upload_size: :advanced_settings | ||
| } | ||
| categories.each do |name, category| | ||
| puts "#{name.to_s.camelize}: #{category.to_s.camelize}" | ||
| SiteSetting.find_by(name: name.to_s.camelize).update(category: category.to_s.camelize) | ||
| end | ||
| end | ||
| end | ||
| class AddSettingCategories < ActiveRecord::Migration[5.2] | ||
| def change | ||
| # This migration only needs to run if there are already existing settings without a category. | ||
| # That's not the case in test, because they get seeded as necessary, so we don't need to run this. | ||
| return if Rails.env.test? | ||
|
|
||
| categories = { | ||
| site_name: :site_details, | ||
| site_logo_path: :site_details, | ||
| question_up_vote_rep: :reputation_and_voting, | ||
| question_down_vote_rep: :reputation_and_voting, | ||
| answer_up_vote_rep: :reputation_and_voting, | ||
| answer_down_vote_rep: :reputation_and_voting, | ||
| allow_self_votes: :reputation_and_voting, | ||
| asking_guidance: :help_and_guidance, | ||
| answering_guidance: :help_and_guidance, | ||
| administrator_contact_email: :site_details, | ||
| hot_questions_count: :display, | ||
| admin_badge_character: :display, | ||
| mod_badge_character: :display, | ||
| soft_delete_transfer_user: :advanced_settings, | ||
| new_user_initial_rep: :reputation_and_voting, | ||
| se_api_client_id: :integrations, | ||
| se_api_client_secret: :integrations, | ||
| se_api_key: :integrations, | ||
| content_license_name: :site_details, | ||
| content_license_link: :site_details, | ||
| max_tag_length: :site_details, | ||
| max_upload_size: :advanced_settings | ||
| } | ||
|
|
||
| categories.each do |name, category| | ||
| puts "#{name.to_s.camelize}: #{category.to_s.camelize}" | ||
| SiteSetting.find_by(name: name.to_s.camelize).update(category: category.to_s.camelize) | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,15 @@ def change | |
| RequestContext.community = community | ||
| main_set = TagSet.find_or_create_by(community: community, name: 'Main') | ||
| meta_set = TagSet.find_or_create_by(community: community, name: 'Meta') | ||
| sql = "select tag_id from posts_tags where post_id in (select id from posts where community_id = #{community.id} and category = '$cat')" | ||
| in_sql = "(select id from posts where community_id = #{community.id} and category = '$cat')" | ||
| sql = "select tag_id from posts_tags where post_id in #{in_sql}" | ||
|
Comment on lines
+8
to
+9
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a manual line length fix |
||
| main_sql = sql.gsub('$cat', 'Main') | ||
| meta_sql = sql.gsub('$cat', 'Meta') | ||
| update_sql = "update tags set tag_set_id = $tsid where id in ($sql);" | ||
| update_sql = 'update tags set tag_set_id = $tsid where id in ($sql);' | ||
| ActiveRecord::Base.connection.execute update_sql.gsub('$tsid', main_set.id.to_s).gsub('$sql', main_sql) | ||
| ActiveRecord::Base.connection.execute update_sql.gsub('$tsid', meta_set.id.to_s).gsub('$sql', meta_sql) | ||
| end | ||
| ActiveRecord::Base.connection.execute "delete from tags where tag_set_id is null;" | ||
| ActiveRecord::Base.connection.execute 'delete from tags where tag_set_id is null;' | ||
| change_column_null :tags, :tag_set_id, false | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ def change | |
| t.references :user, null: false, foreign_key: true | ||
| end | ||
| end | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.