From 310ecddb6c4c3a8de0bdee19b278e8a99a6a8f9b Mon Sep 17 00:00:00 2001 From: Xianming Zhong Date: Sun, 8 Oct 2017 12:27:46 +0800 Subject: [PATCH] feat(issue): Disable merge button if not possible (#425) --- src/components/issue-description.component.js | 113 ++++++++++-------- src/issue/issue.action.js | 25 ++++ src/issue/issue.reducer.js | 19 +++ src/issue/issue.type.js | 3 + src/issue/screens/issue.screen.js | 95 ++++++++------- 5 files changed, 158 insertions(+), 97 deletions(-) diff --git a/src/components/issue-description.component.js b/src/components/issue-description.component.js index 16c58c67d..90c58d428 100644 --- a/src/components/issue-description.component.js +++ b/src/components/issue-description.component.js @@ -73,6 +73,7 @@ export class IssueDescription extends Component { props: { issue: Object, diff: string, + isMergeable: boolean, isMerged: boolean, isPendingDiff: boolean, isPendingCheckMerge: boolean, @@ -92,6 +93,7 @@ export class IssueDescription extends Component { const { diff, issue, + isMergeable, isMerged, isPendingDiff, isPendingCheckMerge, @@ -113,7 +115,7 @@ export class IssueDescription extends Component { return ( - {issue.repository_url && + {issue.repository_url && ( onRepositoryPress(issue.repository_url)} hideChevron - />} + /> + )} )} + !isPendingCheckMerge && ( + + ))} - {issue.pull_request && + {issue.pull_request && ( - {isPendingDiff && - } + {isPendingDiff && ( + + )} {!isPendingDiff && - (lineAdditions !== 0 || lineDeletions !== 0) && - - navigation.navigate('PullDiff', { - title: translate('repository.pullDiff.title', language), - language, - diff, - })} - />} - } + (lineAdditions !== 0 || lineDeletions !== 0) && ( + + navigation.navigate('PullDiff', { + title: translate('repository.pullDiff.title', language), + language, + diff, + })} + /> + )} + + )} {issue.labels && - issue.labels.length > 0 && - - {this.renderLabelButtons(issue.labels)} - } + issue.labels.length > 0 && ( + + {this.renderLabelButtons(issue.labels)} + + )} {issue.assignees && - issue.assignees.length > 0 && - - - } + issue.assignees.length > 0 && ( + + + + )} {issue.pull_request && !isMerged && issue.state === 'open' && - userHasPushPermission && - -