Skip to content

Commit

Permalink
Merge pull request #20 from gdpelican/site-settings
Browse files Browse the repository at this point in the history
Use site settings instead of hard coded values
  • Loading branch information
gdpelican committed Aug 12, 2015
2 parents e6c0685 + 2691034 commit 47b5192
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 10 additions & 0 deletions config/settings.yml
@@ -0,0 +1,10 @@
plugins:
babble_user_id:
default: -2
hidden: true
babble_user_email:
default: chatty@kathy.com
hidden: true
babble_username:
default: chattykathy
hidden: true
9 changes: 3 additions & 6 deletions plugin.rb
Expand Up @@ -7,9 +7,6 @@
register_asset "stylesheets/babble.css"

BABBLE_PLUGIN_NAME ||= "babble".freeze
BABBLE_UNIQUE_EMAIL ||= "noreply@chattykathy.com"
BABBLE_UNIQUE_USERNAME ||= "chattykathy"
BABBLE_USER_ID ||= -2

after_initialize do
module ::Babble
Expand Down Expand Up @@ -120,9 +117,9 @@ def serialized_post

class ::Babble::User
def self.find_or_create
User.find_or_initialize_by(id: BABBLE_USER_ID,
email: BABBLE_UNIQUE_EMAIL,
username: BABBLE_UNIQUE_USERNAME).tap(&:save)
User.find_or_initialize_by(id: SiteSetting.babble_user_id,
email: SiteSetting.babble_user_email,
username: SiteSetting.babble_username).tap(&:save)
end
end

Expand Down

0 comments on commit 47b5192

Please sign in to comment.