Importer SiteSettings recommendations

AI-generated summary

The discussion revolves around recommendations for Importer SiteSettings in Discourse. pfaffman suggests including the following settings for imports to prevent issues:

  • Disabling emails to avoid sending unwanted messages
  • Requiring login to prevent crawlers from indexing the site
  • Preventing the site from being indexed in Google
  • Setting a title to easily identify the import

Additionally, pfaffman proposes a function to deactivate all non-admin users to avoid sending emails. This function would be included in base.rb to avoid duplication across importers. zogstrip agrees with the suggestions.

I’ve done several imports recently and find it helpful to include these SiteSettings:

    SiteSetting.disable_emails = true
    SiteSetting.login_required = true
    SiteSetting.allow_index_in_robots_txt=false
    SiteSetting.title = "Legacy Forum Name import"

In case it’s not clear:

  • I live in fear of uploading some uploading a demo import to someone and having Discourse send out a zillion emails.
  • I live in fear of having someone’s not-ready site show up in Google (he wasn’t very happy!)
  • Having a title makes it a tiny bit easier to guess which backup I’m looking for.

Unless someone says not to, I’m going to include these in future PRs when I make improvements to importers.

deactivate_all_users

This is along the same lines, and I’ll throw it in here rather than start another thread.

Also handy is a function to deactivate all users so that if you do want to make a site functional enough to log in but don’t want a bunch of people getting emails. (And yeah, that happened too. :frowning:)

It it OK to submit a PR with this in base.rb? That’ll keep me from adding it to every importer I touch.

  def deactivate_all_users
    User.where("active = true and admin != true").update_all(active: false)
  end

Seems fine to me :+1: