forked from Gitlink/forgeplus-react
修改PR发送逻辑
This commit is contained in:
parent
2f45383f46
commit
f1df8baf96
|
@ -102,7 +102,6 @@ function CoderDepot(props){
|
|||
}
|
||||
},[treeValue])
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
if (projectsId && owner && defaultBranch){
|
||||
let b = turnbar(branchName) ;
|
||||
|
@ -334,6 +333,15 @@ function CoderDepot(props){
|
|||
}
|
||||
}
|
||||
|
||||
// 如果项目是fork的项目,pr自动指向源仓库,否则指向本仓库默认分支
|
||||
function compare() {
|
||||
if (projectDetail && projectDetail.fork_info) {
|
||||
urlLink(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${turnbar(branchName || defaultBranch)}...${owner + ':' + turnbar(branchName || defaultBranch)}`)
|
||||
} else {
|
||||
urlLink(`/${owner}/${projectsId}/compare/${turnbar(defaultBranch)}...${turnbar(branchName || defaultBranch)}`);
|
||||
}
|
||||
}
|
||||
|
||||
let n = fileInfo && fileInfo.name;
|
||||
const mdFlag = n && n.substring(n.length-3,n.length) === ".md";
|
||||
|
||||
|
@ -436,10 +444,10 @@ function CoderDepot(props){
|
|||
</AlignCenter>
|
||||
<AlignCenter className="depotBtn">
|
||||
<div className="addOptionBtn">
|
||||
{
|
||||
baseOperate &&
|
||||
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/${turnbar(branchName || defaultBranch)}...${turnbar(branchName || defaultBranch)}`)} >+ 合并请求</CheckProfile>
|
||||
}
|
||||
{
|
||||
baseOperate &&
|
||||
<CheckProfile {...props} sureFunc={compare}>+ 合并请求</CheckProfile>
|
||||
}
|
||||
{
|
||||
issuesFlag &&
|
||||
<a onClick={createIssue}>+ 疑修</a>
|
||||
|
|
|
@ -85,7 +85,12 @@ function Index(props) {
|
|||
<div className="treeabout">
|
||||
{
|
||||
(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) &&
|
||||
<Link to={`/${owner}/${projectsId}/compare/${turnbar(defaultBranch)}...${turnbar(i.name)}`} className="btn-83">+ 合并请求</Link>
|
||||
<Link to={
|
||||
// 如果项目是fork的项目,pr自动指向源仓库,否则指向本仓库默认分支
|
||||
projectDetail && projectDetail.fork_info?
|
||||
`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${turnbar(i.name || defaultBranch)}...${owner + ':' + turnbar(i.name)}`
|
||||
:`/${owner}/${projectsId}/compare/${turnbar(defaultBranch)}...${turnbar(i.name)}`
|
||||
} className="btn-83">+ 合并请求</Link>
|
||||
}
|
||||
<Dropdown overlay={menu(i.zip_url,i.tar_url)} trigger={['click']} placement="bottomRight">
|
||||
<a className="btn-83 ml15">下载<i className="iconfont icon-sanjiaoxing-down font-14"></i></a>
|
||||
|
|
|
@ -223,12 +223,22 @@ class CreateMerge extends Component {
|
|||
return false;
|
||||
}
|
||||
if(type === "merge" && mfilter){
|
||||
this.setState({
|
||||
showMessage: mergebranch,
|
||||
defaultMessage: `目标分支不存在`,
|
||||
isCompareSpin: false
|
||||
});
|
||||
return false;
|
||||
const {projectDetail,location,history}=this.props;
|
||||
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } =
|
||||
getBranchParams(location.pathname);
|
||||
// 如果进来的第一次,查到目标分支不存在,自动切换到目标仓库默认分支
|
||||
if (pullOwner !== mergeOwner && pullBranch=== mergeBranch) {
|
||||
let _url = `/${mergeOwner}/${projectId}/compare/${(projectDetail.default_branch)}...${pullOwner}:${(pullBranch)}`;
|
||||
history.push(_url);
|
||||
return false;
|
||||
}else{
|
||||
this.setState({
|
||||
showMessage: mergebranch,
|
||||
defaultMessage: `目标分支不存在`,
|
||||
isCompareSpin: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -212,10 +212,14 @@ class merge extends Component {
|
|||
this.getIssueList();
|
||||
};
|
||||
checkOperation() {
|
||||
const { defaultBranch } = this.props;
|
||||
const { defaultBranch,projectDetail } = this.props;
|
||||
const { projectsId,owner } = this.props.match.params;
|
||||
let branch = turnbar(defaultBranch) || "master";
|
||||
this.props.history.push(`/${owner}/${projectsId}/compare/${branch}...${branch}`);
|
||||
if (projectDetail && projectDetail.fork_info) {
|
||||
this.props.history.push(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${branch}...${owner + ':' + branch}`)
|
||||
} else {
|
||||
this.props.history.push(`/${owner}/${projectsId}/compare/${branch}...${branch}`);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
|
|
Loading…
Reference in New Issue