From a86f21cf90814ef0dd6e013202fb93ee83beca86 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Tue, 20 Sep 2016 01:53:30 +0200
Subject: [PATCH] Fix rake tasks and loading bar

---
 .../features/ui/containers/loading_bar_container.jsx |  8 ++++++++
 .../javascripts/components/features/ui/index.jsx     |  4 ++--
 lib/tasks/mastodon.rake                              | 12 +++++++-----
 3 files changed, 17 insertions(+), 7 deletions(-)
 create mode 100644 app/assets/javascripts/components/features/ui/containers/loading_bar_container.jsx

diff --git a/app/assets/javascripts/components/features/ui/containers/loading_bar_container.jsx b/app/assets/javascripts/components/features/ui/containers/loading_bar_container.jsx
new file mode 100644
index 0000000000..6c4e73e386
--- /dev/null
+++ b/app/assets/javascripts/components/features/ui/containers/loading_bar_container.jsx
@@ -0,0 +1,8 @@
+import { connect }    from 'react-redux';
+import LoadingBar from 'react-redux-loading-bar';
+
+const mapStateToProps = (state) => ({
+  loading: state.get('loadingBar')
+});
+
+export default connect(mapStateToProps)(LoadingBar.WrappedComponent);
diff --git a/app/assets/javascripts/components/features/ui/index.jsx b/app/assets/javascripts/components/features/ui/index.jsx
index fbfa361f2e..323729dd64 100644
--- a/app/assets/javascripts/components/features/ui/index.jsx
+++ b/app/assets/javascripts/components/features/ui/index.jsx
@@ -8,7 +8,7 @@ import StatusListContainer    from './containers/status_list_container';
 import NotificationsContainer from './containers/notifications_container';
 import NavigationContainer    from './containers/navigation_container';
 import PureRenderMixin        from 'react-addons-pure-render-mixin';
-import LoadingBar             from 'react-redux-loading-bar';
+import LoadingBarContainer    from './containers/loading_bar_container';
 
 const UI = React.createClass({
 
@@ -46,7 +46,7 @@ const UI = React.createClass({
         </ColumnsArea>
 
         <NotificationsContainer />
-        <LoadingBar style={{ backgroundColor: '#2b90d9', left: '0', top: '0' }} />
+        <LoadingBarContainer style={{ backgroundColor: '#2b90d9', left: '0', top: '0' }} />
       </div>
     );
   }
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index bdfa2e4589..c75028ecb1 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -13,11 +13,13 @@ namespace :mastodon do
     task clear: :environment do
       Account.remote.without_followers.find_each do |a|
         Rails.logger.debug "PuSH unsubscribing from #{a.acct}"
-        a.subscription('').unsubscribe
-      rescue HTTP::Error, OpenSSL::SSL::SSLError
-        Rails.logger.debug "PuSH unsubscribing from #{a.acct} failed due to an HTTP or SSL error"
-      ensure
-        a.update!(verify_token: '', secret: '', subscription_expires_at: nil)
+        begin
+          a.subscription('').unsubscribe
+        rescue HTTP::Error, OpenSSL::SSL::SSLError
+          Rails.logger.debug "PuSH unsubscribing from #{a.acct} failed due to an HTTP or SSL error"
+        ensure
+          a.update!(verify_token: '', secret: '', subscription_expires_at: nil)
+        end
       end
     end
 
-- 
GitLab