Skip to content

Commit

Permalink
Fix uploading flow for Mockr instances without Campfire configured
Browse files Browse the repository at this point in the history
Users without a Campfire subdomain set were seeing an error message when
uploading a mock. The mock went through, but we were encountering an error in
attempting to parse the URI ".campfire.now", which does not exist. We now only
parse if a proper campfire subdomain has been configured.

Change-Id: I18af41801b9115baf159869dbb11593d1c96c662
Reviewed-on: https://gerrit.causes.com/5217
Tested-by: Chris Chan <chris@causes.com>
Reviewed-by: Adam Derewecki <adam@causes.com>
  • Loading branch information
Chris Chan authored and Adam Derewecki committed Apr 13, 2012
1 parent be438ae commit 6b0fdf3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/campfire.rb
Expand Up @@ -2,16 +2,16 @@ class Campfire
KEYS = ["campfire_subdomain", "campfire_token", "campfire_room"]

def self.notify_mocks_created(mocks, url)
room = find_room
if use? && room
if use?
room = find_room
mock = mocks.first
mocks_text = mocks.size == 1 ? "a new mock" : "#{mocks.size} new mocks"
room.speak "#{mock.author.name} posted #{mocks_text}:"
room.speak mock.image.url
room.speak url
end
# Handle invalid token and invalid subdomain errors respectively.
rescue Tinder::AuthenticationFailed, NoMethodError
rescue Tinder::AuthenticationFailed, NoMethodError
# Do nothing.
end

Expand All @@ -34,7 +34,7 @@ def self.settings
end
settings
end

def self.use?
!self.settings["campfire_subdomain"].blank?
end
Expand Down

0 comments on commit 6b0fdf3

Please sign in to comment.