diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -678,6 +678,20 @@ class Flash(_Flash): session.save() return messages + def json_alerts(self): + payloads = [] + messages = flash.pop_messages() + if messages: + for message in messages: + payloads.append({ + 'message': { + 'message': u'{}'.format(message.message), + 'level': message.category, + 'force': 'true' + } + }) + return json.dumps(payloads) + flash = Flash() #============================================================================== diff --git a/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js b/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js --- a/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js +++ b/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js @@ -3,10 +3,14 @@ ccLog.setLevel(Logger.OFF); var rhodeCodeApp = Polymer({ is: 'rhodecode-app', - created: function () { + attached: function () { ccLog.debug('rhodeCodeApp created'); $.Topic('/notifications').subscribe(this.handleNotifications.bind(this)); + for (var i = 0; i < alertMessagePayloads.length; i++) { + $.Topic('/notifications').publish(alertMessagePayloads[i]); + } + $.Topic('/plugins/__REGISTER__').subscribe( this.kickoffChannelstreamPlugin.bind(this) ); diff --git a/rhodecode/public/js/src/components/rhodecode-toast/rhodecode-toast.html b/rhodecode/public/js/src/components/rhodecode-toast/rhodecode-toast.html --- a/rhodecode/public/js/src/components/rhodecode-toast/rhodecode-toast.html +++ b/rhodecode/public/js/src/components/rhodecode-toast/rhodecode-toast.html @@ -21,7 +21,7 @@