diff --git a/mopidy_iris/frontend.py b/mopidy_iris/frontend.py
index 0732ecfb..d08491be 100755
--- a/mopidy_iris/frontend.py
+++ b/mopidy_iris/frontend.py
@@ -194,7 +194,7 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener):
def get_config( self ):
all_config = self.config
config = {
- "spotify_user": all_config['spotify']['username'],
+ "spotify_username": all_config['spotify']['username'],
"country": all_config['iris']['country'],
"locale": all_config['iris']['locale']
}
diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js
index 8811192c..7fd8942e 100755
--- a/src/js/services/pusher/middleware.js
+++ b/src/js/services/pusher/middleware.js
@@ -1,7 +1,8 @@
-var pusherActions = require('./actions.js')
-var uiActions = require('../ui/actions.js')
var helpers = require('../../helpers.js')
+var uiActions = require('../ui/actions.js')
+var pusherActions = require('./actions.js')
+var spotifyActions = require('../spotify/actions.js')
const PusherMiddleware = (function(){
@@ -117,6 +118,9 @@ const PusherMiddleware = (function(){
.then(
response => {
store.dispatch({ type: 'CONFIG', config: response.data.config })
+ if (response.data.config.spotify_username){
+ store.dispatch(spotifyActions.getUser('spotify:user:'+response.data.config.spotify_username))
+ }
var spotify = store.getState().spotify
if (!spotify.country || !spotify.locale){
store.dispatch({ type: 'SPOTIFY_SET_CONFIG', config: response.data.config })
diff --git a/src/js/views/Settings.js b/src/js/views/Settings.js
index 167aa4b0..c114149b 100755
--- a/src/js/views/Settings.js
+++ b/src/js/views/Settings.js
@@ -81,21 +81,23 @@ class Settings extends React.Component{
}
renderSpotifyUser(){
+
+ var user = null
if (this.props.spotify.me && this.props.spotify.authorized){
+ user = this.props.spotify.me
+ } else if (this.props.ui.config && this.props.ui.config.spotify_username){
+ if (this.props.ui.users && typeof(this.props.ui.users['spotify:user:'+this.props.ui.config.spotify_username]) !== 'undefined'){
+ user = this.props.ui.users['spotify:user:'+this.props.ui.config.spotify_username]
+ }
+ }
+
+ if (user){
return (
-
-
+
+
- { this.props.spotify.me.display_name ? this.props.spotify.me.display_name : this.props.spotify.me.id }
-
-
- )
- } else if (this.props.ui.config && this.props.ui.config.spotify_user){
- return (
-
-
-
- {this.props.ui.config.spotify_user} (As defined in mopidy.config)
+ {user.display_name ? user.display_name : user.username}
+ {!this.props.spotify.authorized ? (As defined in config file) : null}
)
@@ -104,7 +106,8 @@ class Settings extends React.Component{
- Default user (As defined in mopidy.config)
+ Default user
+ (As defined in config file)
)