From e3bfcbc7c90f4b3e6663ad27612a3e60d553f7df Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 9 Jun 2017 11:01:48 -0400 Subject: [PATCH] FIX: Don't fail seed if avatar can't be downloaded --- .../db/fixtures/001_discobot.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb b/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb index c81ac87fc4a..8ba0d0322e3 100644 --- a/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb +++ b/plugins/discourse-narrative-bot/db/fixtures/001_discobot.rb @@ -18,11 +18,15 @@ if !user # TODO Pull the user avatar from that thread for now. In the future, pull it from a local file or from some central discobot repo. if !Rails.env.test? - UserAvatar.import_url_for_user( - "https://cdn.discourse.org/dev/uploads/default/original/2X/e/edb63d57a720838a7ce6a68f02ba4618787f2299.png", - User.find(-2), - override_gravatar: true - ) + begin + UserAvatar.import_url_for_user( + "https://cdn.discourse.org/dev/uploads/default/original/2X/e/edb63d57a720838a7ce6a68f02ba4618787f2299.png", + User.find(-2), + override_gravatar: true + ) + rescue + # In case the avatar can't be downloaded, don't fail seed + end end end