diff options
-rw-r--r-- | app/controllers/errors_controller.rb | 2 | ||||
-rw-r--r-- | config/settings.yml.example | 1 | ||||
-rw-r--r-- | lib/aclog/receiver/collector_connection.rb | 9 |
3 files changed, 3 insertions, 9 deletions
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 2c9815e..5ea964d 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -45,7 +45,7 @@ class ErrorsController < ApplicationController private def force_format if request.format == :html - request.format = env["REQUEST_PATH"].scan(/\.([A-Za-z]+)$/).flatten.first || :html + request.format = (env["REQUEST_PATH"].scan(/\.([A-Za-z]+)$/).flatten.first || :html).to_sym end unless request.format == :html || request.format == :json diff --git a/config/settings.yml.example b/config/settings.yml.example index 0fd8ddd..15396e0 100644 --- a/config/settings.yml.example +++ b/config/settings.yml.example @@ -7,6 +7,7 @@ collector: consumer_version: 0 # which consumer (0..) notification: + enabled: false consumer: key: "consumer key of notification account" secret: "consumer secret" diff --git a/lib/aclog/receiver/collector_connection.rb b/lib/aclog/receiver/collector_connection.rb index 2a0b24e..42e825f 100644 --- a/lib/aclog/receiver/collector_connection.rb +++ b/lib/aclog/receiver/collector_connection.rb @@ -162,7 +162,7 @@ module Aclog Rails.logger.debug("Receive Favorite(#{@worker_number}): #{msg["user_id"]} => #{msg["tweet_id"]}") f = Favorite.from_hash(:tweet_id => msg["tweet_id"], :user_id => msg["user_id"]) - if t = Tweet.find_by(id: msg["tweet_id"]) + if Settings.notification.enabled && t = Tweet.find_by(id: msg["tweet_id"]) Notification.notify_favorite(t) end end @@ -195,13 +195,6 @@ module Aclog receive_unfavorite(msg) end end - - def receive_spam(msg) - Rails.logger.info("Receive Spam(#{@worker_number}): #{msg["id"]}") - # @@queue.push -> do - # # TODO - # end - end end end end |