Skip to content

Commit

Permalink
Support User: Move dev-support-user reference to Calypso boot
Browse files Browse the repository at this point in the history
  • Loading branch information
jordwest committed Jan 15, 2016
1 parent 061bd4a commit ed3efab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
5 changes: 5 additions & 0 deletions client/boot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ function boot() {
i18n.setLocaleSlug( user.get().localeSlug );
} );

// Temporary support for development of the Support User feature
if ( config.isEnabled( 'support-user' ) ) {
require( 'lib/user/dev-support-user' )( user );
}

translatorJumpstart.init();

reduxStore = createReduxStore();
Expand Down
30 changes: 14 additions & 16 deletions client/lib/user/dev-support-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
* This is a temporary file to assist development of the support user feature.
*/

import User from './user';
import config from 'config';

// TODO: This will be replaced with a UI
if ( config.isEnabled( 'support-user' ) ) {
let user = new User();
export default function( user ) {
if ( config.isEnabled( 'support-user' ) ) {
const callback = ( error ) => {
if ( error ) {
console.error( error );
} else {
console.log( 'success' );
}
};

const callback = ( error ) => {
if ( error ) {
console.error( error );
} else {
console.log( 'success' );
}
};

window.supportUser = {
login: ( username, password ) => user.changeUser( username, password, callback ),
logout: () => user.restoreUser()
};
window.supportUser = {
login: ( username, password ) => user.changeUser( username, password, callback ),
logout: () => user.restoreUser()
};
}
}
4 changes: 1 addition & 3 deletions client/lib/user/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,9 @@ User.prototype.restoreUser = function() {

this.fetch();
}
}
};

/**
* Expose `User`
*/
module.exports = User;

require( './dev-support-user' );

0 comments on commit ed3efab

Please sign in to comment.