Skip to content

Commit

Permalink
Don't allow editing of MT statuses from UI
Browse files Browse the repository at this point in the history
  • Loading branch information
maallen committed Nov 5, 2024
1 parent 74494e2 commit 6d2257d
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class TextUnitsreviewModal extends React.Component {
};
}

isMTState = () => {
return this.state.currentReviewState === this.MACHINE_TRANSLATED || this.state.currentReviewState === this.MT_REVIEW;
}

/**
* Sets the state of the component to the button that was clicked upon.
* @param {string} reviewState
Expand Down Expand Up @@ -69,7 +73,8 @@ class TextUnitsreviewModal extends React.Component {
getRejectButton = () => {
return (
<Button active={this.state.currentReviewState === this.REJECT}
onClick={this.optionClicked.bind(this, this.REJECT)}>
onClick={this.optionClicked.bind(this, this.REJECT)}
disabled={this.isMTState()}>

<FormattedMessage id="textUnit.reviewModal.rejected"/>
</Button>
Expand All @@ -82,7 +87,8 @@ class TextUnitsreviewModal extends React.Component {
getMTReviewNeededButton = () => {
return (
<Button active={this.state.currentReviewState === this.MT_REVIEW}
onClick={this.optionClicked.bind(this, this.MT_REVIEW)}>
onClick={this.optionClicked.bind(this, this.MT_REVIEW)}
disabled={true}>

<FormattedMessage id="textUnit.reviewModal.mtReview"/>
</Button>
Expand All @@ -95,7 +101,8 @@ class TextUnitsreviewModal extends React.Component {
getMTButton = () => {
return (
<Button active={this.state.currentReviewState === this.MACHINE_TRANSLATED}
onClick={this.optionClicked.bind(this, this.MACHINE_TRANSLATED)}>
onClick={this.optionClicked.bind(this, this.MACHINE_TRANSLATED)}
disabled={true}>

<FormattedMessage id="textUnit.reviewModal.mt"/>
</Button>
Expand All @@ -108,7 +115,8 @@ class TextUnitsreviewModal extends React.Component {
getReviewButton = () => {
return (
<Button active={this.state.currentReviewState === this.REVIEW}
onClick={this.optionClicked.bind(this, this.REVIEW)}>
onClick={this.optionClicked.bind(this, this.REVIEW)}
disabled={this.isMTState()}>

<FormattedMessage id="textUnit.reviewModal.needsReview"/>
</Button>
Expand All @@ -121,7 +129,8 @@ class TextUnitsreviewModal extends React.Component {
getAcceptButton = () => {
return (
<Button active={this.state.currentReviewState === this.ACCEPT}
onClick={this.optionClicked.bind(this, this.ACCEPT)}>
onClick={this.optionClicked.bind(this, this.ACCEPT)}
disabled={this.isMTState()}>

<FormattedMessage id="textUnit.reviewModal.accepted"/>
</Button>
Expand All @@ -131,7 +140,8 @@ class TextUnitsreviewModal extends React.Component {
getOverriddenButton = () => {
return (
<Button active={this.state.currentReviewState === this.OVERRIDDEN}
onClick={this.optionClicked.bind(this, this.OVERRIDDEN)}>
onClick={this.optionClicked.bind(this, this.OVERRIDDEN)}
disabled={this.isMTState()}>
<FormattedMessage id="textUnit.reviewModal.overridden"/>
</Button>
);
Expand All @@ -143,7 +153,8 @@ class TextUnitsreviewModal extends React.Component {
getTranslateButton = () => {
return (
<Button active={this.state.currentReviewState === this.TRANSLATE}
onClick={this.optionClicked.bind(this, this.TRANSLATE)}>
onClick={this.optionClicked.bind(this, this.TRANSLATE)}
disabled={this.isMTState()}>

<FormattedMessage id="textUnit.reviewModal.translationNeeded"/>
</Button>
Expand Down Expand Up @@ -270,7 +281,7 @@ class TextUnitsreviewModal extends React.Component {
</Modal.Body>
<Modal.Footer>
<Button bsStyle="primary" onClick={this.onReviewModalSaveClicked}
disabled={this.state.currentReviewState === ""}>
disabled={this.state.currentReviewState === "" || this.isMTState()} >
<FormattedMessage id="label.save"/>
</Button>
<Button onClick={this.closeModal}>
Expand Down

0 comments on commit 6d2257d

Please sign in to comment.