Skip to content

Commit

Permalink
Merge pull request #330 from enoodle/fix/fail_softly_drive_integration
Browse files Browse the repository at this point in the history
softly failing in the event of not creating google drive document
  • Loading branch information
enoodle authored Feb 19, 2019
2 parents cc2de27 + ee0f615 commit efe177b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ GEM
httparty (~> 0.13.7)
json
rack
rb-readline (0.5.4)
rb-readline (0.5.5)
rdoc (4.2.1)
json (~> 1.4)
recaptcha (4.0.1)
Expand Down
14 changes: 9 additions & 5 deletions app/controllers/camps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,16 @@ def enforce_grant_lockdown!

def create_camp
Camp.transaction do
@camp.save!
if Rails.application.config.x.firestarter_settings['google_drive_integration'] and ENV['GOOGLE_APPS_SCRIPT'].present?
response = NewDreamAppsScript::createNewDreamFolder(@camp.creator.email, @camp.id, @camp.name)
@camp.google_drive_folder_path = response['id']
@camp.google_drive_budget_file_path = response['budget']
begin
@camp.save!
if Rails.application.config.x.firestarter_settings['google_drive_integration'] and ENV['GOOGLE_APPS_SCRIPT'].present?
response = NewDreamAppsScript::createNewDreamFolder(@camp.creator.email, @camp.id, @camp.name)
@camp.google_drive_folder_path = response['id']
@camp.google_drive_budget_file_path = response['budget']
@camp.save!
end
rescue
flash[:alert] = "#{t:failed_to_create_google_drive_integration}"
end
end
true
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ en:
i_gift_thee_grants: Donate to dream
i_gift_thee_grants_diabled: "Thank you for your participation. You have donated all your hearts."
no_granting_yet: No granting for this dream yet!
failed_to_create_google_drive_integration: Failed to create google drive budget document
donate_title: Oh Wow! this thing you are about to do...
donate_content: There are many ways to help a dream come true, yet here you are
invited to divide your Hearts donation and give it to this dream.
Expand Down
1 change: 1 addition & 0 deletions config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ he:
i_gift_thee_grants: "תרמו לחלום"
i_gift_thee_grants_diabled: "תודה על ההשתתפות. תרמת את כל הלבבות שלך"
no_granting_yet: "טרם נפתח המענק לחלום זה!"
failed_to_create_google_drive_integration: "נכשלנו בניסיון ליצור קובץ תקציב בדרייב. יתוקן בקרוב"
donate_title: "הו, וואו! הדבר שאתם עומדים לעשות..."
donate_content: "תרומה לחלום יכולה לבוא בכל מיני צורות, אבל מכאן תוכלו להעביר חלק מעלות התרומה (שכבר שילמתם), ולבקש לתרום אותה לחלום הזה."
donate_text: "תרמו"
Expand Down

0 comments on commit efe177b

Please sign in to comment.