REFACTOR: Clean up parameterized title
Follow up to [FIX: Empty backup names with unicode site titles][1]
- Use .presence - "It's cleaner"
- Update spec to use System.system_user so it is more readable
[1]: c8661674d4
This commit is contained in:
parent
2ecc613c5d
commit
b0c92bb0b9
|
@ -84,7 +84,7 @@ module BackupRestore
|
|||
end
|
||||
|
||||
def get_parameterized_title
|
||||
SiteSetting.title.parameterize.empty? ? "discourse" : SiteSetting.title.parameterize
|
||||
SiteSetting.title.parameterize.presence || "discourse"
|
||||
end
|
||||
|
||||
def initialize_state
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
List of relations
|
||||
Schema | Name | Type | Owner
|
||||
--------+-----------------------------+-------+-------
|
||||
public | anonymous_users | table | blake
|
||||
public | api_keys | table | blake
|
||||
public | application_requests | table | blake
|
||||
public | ar_internal_metadata | table | blake
|
||||
public | backup_metadata | table | blake
|
||||
public | badge_groupings | table | blake
|
||||
public | badge_types | table | blake
|
||||
public | badges | table | blake
|
||||
public | categories | table | blake
|
||||
public | categories_web_hooks | table | blake
|
||||
public | category_custom_fields | table | blake
|
||||
public | category_featured_topics | table | blake
|
||||
public | category_groups | table | blake
|
||||
public | category_search_data | table | blake
|
||||
public | category_tag_groups | table | blake
|
||||
public | category_tag_stats | table | blake
|
||||
public | category_tags | table | blake
|
||||
public | category_users | table | blake
|
||||
public | child_themes | table | blake
|
||||
public | color_scheme_colors | table | blake
|
||||
public | color_schemes | table | blake
|
||||
public | custom_emojis | table | blake
|
||||
public | developers | table | blake
|
||||
public | directory_items | table | blake
|
||||
public | draft_sequences | table | blake
|
||||
public | drafts | table | blake
|
||||
public | email_change_requests | table | blake
|
||||
public | email_logs | table | blake
|
||||
public | email_tokens | table | blake
|
||||
public | embeddable_hosts | table | blake
|
||||
public | github_commits | table | blake
|
||||
public | github_repos | table | blake
|
||||
public | github_user_infos | table | blake
|
||||
public | given_daily_likes | table | blake
|
||||
public | google_user_infos | table | blake
|
||||
public | group_archived_messages | table | blake
|
||||
public | group_custom_fields | table | blake
|
||||
public | group_histories | table | blake
|
||||
public | group_mentions | table | blake
|
||||
public | group_requests | table | blake
|
||||
public | group_users | table | blake
|
||||
public | groups | table | blake
|
||||
public | groups_web_hooks | table | blake
|
||||
public | ignored_users | table | blake
|
||||
public | incoming_domains | table | blake
|
||||
public | incoming_emails | table | blake
|
||||
public | incoming_links | table | blake
|
||||
public | incoming_referers | table | blake
|
||||
public | instagram_user_infos | table | blake
|
||||
public | invited_groups | table | blake
|
||||
public | invites | table | blake
|
||||
public | javascript_caches | table | blake
|
||||
public | message_bus | table | blake
|
||||
public | muted_users | table | blake
|
||||
public | notifications | table | blake
|
||||
public | oauth2_user_infos | table | blake
|
||||
public | onceoff_logs | table | blake
|
||||
public | optimized_images | table | blake
|
||||
public | permalinks | table | blake
|
||||
public | plugin_store_rows | table | blake
|
||||
public | poll_options | table | blake
|
||||
public | poll_votes | table | blake
|
||||
public | polls | table | blake
|
||||
public | post_action_types | table | blake
|
||||
public | post_actions | table | blake
|
||||
public | post_custom_fields | table | blake
|
||||
public | post_details | table | blake
|
||||
public | post_replies | table | blake
|
||||
public | post_reply_keys | table | blake
|
||||
public | post_revisions | table | blake
|
||||
public | post_search_data | table | blake
|
||||
public | post_stats | table | blake
|
||||
public | post_timings | table | blake
|
||||
public | post_uploads | table | blake
|
||||
public | posts | table | blake
|
||||
public | push_subscriptions | table | blake
|
||||
public | quoted_posts | table | blake
|
||||
public | remote_themes | table | blake
|
||||
public | reviewable_claimed_topics | table | blake
|
||||
public | reviewable_histories | table | blake
|
||||
public | reviewable_scores | table | blake
|
||||
public | reviewables | table | blake
|
||||
public | scheduler_stats | table | blake
|
||||
public | schema_migration_details | table | blake
|
||||
public | schema_migrations | table | blake
|
||||
public | screened_emails | table | blake
|
||||
public | screened_ip_addresses | table | blake
|
||||
public | screened_urls | table | blake
|
||||
public | search_logs | table | blake
|
||||
public | shared_drafts | table | blake
|
||||
public | single_sign_on_records | table | blake
|
||||
public | site_settings | table | blake
|
||||
public | skipped_email_logs | table | blake
|
||||
public | stylesheet_cache | table | blake
|
||||
public | tag_group_memberships | table | blake
|
||||
public | tag_group_permissions | table | blake
|
||||
public | tag_groups | table | blake
|
||||
public | tag_search_data | table | blake
|
||||
public | tag_users | table | blake
|
||||
public | tags | table | blake
|
||||
public | tags_web_hooks | table | blake
|
||||
public | theme_fields | table | blake
|
||||
public | theme_settings | table | blake
|
||||
public | theme_translation_overrides | table | blake
|
||||
public | themes | table | blake
|
||||
public | top_topics | table | blake
|
||||
public | topic_allowed_groups | table | blake
|
||||
public | topic_allowed_users | table | blake
|
||||
public | topic_custom_fields | table | blake
|
||||
public | topic_embeds | table | blake
|
||||
public | topic_invites | table | blake
|
||||
public | topic_link_clicks | table | blake
|
||||
public | topic_links | table | blake
|
||||
public | topic_search_data | table | blake
|
||||
public | topic_tags | table | blake
|
||||
public | topic_timers | table | blake
|
||||
public | topic_users | table | blake
|
||||
public | topic_views | table | blake
|
||||
public | topics | table | blake
|
||||
public | translation_overrides | table | blake
|
||||
public | unsubscribe_keys | table | blake
|
||||
public | uploads | table | blake
|
||||
public | user_actions | table | blake
|
||||
public | user_api_keys | table | blake
|
||||
public | user_archived_messages | table | blake
|
||||
public | user_associated_accounts | table | blake
|
||||
public | user_auth_token_logs | table | blake
|
||||
public | user_auth_tokens | table | blake
|
||||
public | user_avatars | table | blake
|
||||
public | user_badges | table | blake
|
||||
public | user_custom_fields | table | blake
|
||||
public | user_emails | table | blake
|
||||
public | user_exports | table | blake
|
||||
public | user_field_options | table | blake
|
||||
public | user_fields | table | blake
|
||||
public | user_histories | table | blake
|
||||
public | user_open_ids | table | blake
|
||||
public | user_options | table | blake
|
||||
public | user_profile_views | table | blake
|
||||
public | user_profiles | table | blake
|
||||
public | user_search_data | table | blake
|
||||
public | user_second_factors | table | blake
|
||||
public | user_stats | table | blake
|
||||
public | user_uploads | table | blake
|
||||
public | user_visits | table | blake
|
||||
public | user_warnings | table | blake
|
||||
public | users | table | blake
|
||||
public | watched_words | table | blake
|
||||
public | web_crawler_requests | table | blake
|
||||
public | web_hook_event_types | table | blake
|
||||
public | web_hook_event_types_hooks | table | blake
|
||||
public | web_hook_events | table | blake
|
||||
public | web_hooks | table | blake
|
||||
(153 rows)
|
||||
|
|
@ -5,14 +5,14 @@ require 'rails_helper'
|
|||
describe BackupRestore::Backuper do
|
||||
it 'returns a non-empty parameterized title when site title contains unicode' do
|
||||
SiteSetting.title = 'Ɣ'
|
||||
backuper = BackupRestore::Backuper.new(-1)
|
||||
backuper = BackupRestore::Backuper.new(Discourse.system_user.id)
|
||||
|
||||
expect(backuper.send(:get_parameterized_title)).to eq("discourse")
|
||||
end
|
||||
|
||||
it 'returns a valid parameterized site title' do
|
||||
SiteSetting.title = "Coding Horror"
|
||||
backuper = BackupRestore::Backuper.new(-1)
|
||||
backuper = BackupRestore::Backuper.new(Discourse.system_user.id)
|
||||
|
||||
expect(backuper.send(:get_parameterized_title)).to eq("coding-horror")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue