From 5e45c10baae1e7920586900dd0e1b2681535e54b Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Mon, 23 Nov 2015 10:46:20 +0100 Subject: [PATCH] Check for piece and edition validity by using their ids instead of titles Also removed a few unnecessary location props. --- js/components/ascribe_detail/edition.js | 6 ++---- js/components/ascribe_detail/edition_container.js | 8 +++----- js/components/ascribe_detail/further_details.js | 6 ++---- js/components/ascribe_detail/piece_container.js | 8 +++----- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index 6b38ddf8..254746a6 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -42,8 +42,7 @@ import { getLangText } from '../../utils/lang_utils'; let Edition = React.createClass({ propTypes: { edition: React.PropTypes.object, - loadEdition: React.PropTypes.func, - location: React.PropTypes.object + loadEdition: React.PropTypes.func }, mixins: [History], @@ -156,8 +155,7 @@ let Edition = React.createClass({ pieceId={this.props.edition.parent} extraData={this.props.edition.extra_data} otherData={this.props.edition.other_data} - handleSuccess={this.props.loadEdition} - location={this.props.location}/> + handleSuccess={this.props.loadEdition} /> diff --git a/js/components/ascribe_detail/edition_container.js b/js/components/ascribe_detail/edition_container.js index 2c479d24..febe652d 100644 --- a/js/components/ascribe_detail/edition_container.js +++ b/js/components/ascribe_detail/edition_container.js @@ -17,8 +17,7 @@ import { setDocumentTitle } from '../../utils/dom_utils'; */ let EditionContainer = React.createClass({ propTypes: { - params: React.PropTypes.object, - location: React.PropTypes.object + params: React.PropTypes.object }, getInitialState() { @@ -67,14 +66,13 @@ let EditionContainer = React.createClass({ }, render() { - if(this.state.edition && this.state.edition.title) { + if(this.state.edition && this.state.edition.id) { setDocumentTitle([this.state.edition.artist_name, this.state.edition.title].join(', ')); return ( + loadEdition={this.loadEdition} /> ); } else { return ( diff --git a/js/components/ascribe_detail/further_details.js b/js/components/ascribe_detail/further_details.js index 91ce87c5..c178fb93 100644 --- a/js/components/ascribe_detail/further_details.js +++ b/js/components/ascribe_detail/further_details.js @@ -23,8 +23,7 @@ let FurtherDetails = React.createClass({ pieceId: React.PropTypes.number, extraData: React.PropTypes.object, otherData: React.PropTypes.arrayOf(React.PropTypes.object), - handleSuccess: React.PropTypes.func, - location: React.PropTypes.object + handleSuccess: React.PropTypes.func }, getInitialState() { @@ -86,8 +85,7 @@ let FurtherDetails = React.createClass({ overrideForm={true} pieceId={this.props.pieceId} otherData={this.props.otherData} - multiple={true} - location={this.props.location}/> + multiple={true} /> diff --git a/js/components/ascribe_detail/piece_container.js b/js/components/ascribe_detail/piece_container.js index 8cd7df1c..cde6eaea 100644 --- a/js/components/ascribe_detail/piece_container.js +++ b/js/components/ascribe_detail/piece_container.js @@ -50,8 +50,7 @@ import { setDocumentTitle } from '../../utils/dom_utils'; */ let PieceContainer = React.createClass({ propTypes: { - params: React.PropTypes.object, - location: React.PropTypes.object + params: React.PropTypes.object }, mixins: [History], @@ -226,7 +225,7 @@ let PieceContainer = React.createClass({ }, render() { - if(this.state.piece && this.state.piece.title) { + if(this.state.piece && this.state.piece.id) { setDocumentTitle([this.state.piece.artist_name, this.state.piece.title].join(', ')); return ( @@ -292,8 +291,7 @@ let PieceContainer = React.createClass({ pieceId={this.state.piece.id} extraData={this.state.piece.extra_data} otherData={this.state.piece.other_data} - handleSuccess={this.loadPiece} - location={this.props.location}/> + handleSuccess={this.loadPiece} />