Skip to content

Commit

Permalink
Author: Set as numeric user ID
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Aug 24, 2017
1 parent 8c878f0 commit aa342a4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions editor/sidebar/post-author/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,20 @@ import { getEditedPostAttribute } from '../../selectors';
import { editPost } from '../../actions';

class PostAuthor extends Component {
constructor() {
super( ...arguments );

this.setAuthorId = this.setAuthorId.bind( this );
}

setAuthorId( event ) {
const { onUpdateAuthor } = this.props;
const { value } = event.target;
onUpdateAuthor( Number( value ) );
}

render() {
const { users, onUpdateAuthor, postAuthor, instanceId } = this.props;
const { users, postAuthor, instanceId } = this.props;
if ( ! users.data || users.data.length < 2 ) {
return null;
}
Expand All @@ -36,7 +48,7 @@ class PostAuthor extends Component {
<select
id={ selectId }
value={ postAuthor }
onChange={ ( event ) => onUpdateAuthor( event.target.value ) }
onChange={ this.setAuthorId }
className="editor-post-author__select"
>
{ users.data.map( ( author ) => (
Expand Down

0 comments on commit aa342a4

Please sign in to comment.