branch 转义

This commit is contained in:
caishi 2021-12-28 15:50:25 +08:00
parent ec2d51e0d3
commit e096e1aa50
14 changed files with 137 additions and 37 deletions

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2340181 */ font-family: "iconfont"; /* Project id 2340181 */
src: url('iconfont.woff2?t=1639038498486') format('woff2'), src: url('iconfont.woff2?t=1640585290619') format('woff2'),
url('iconfont.woff?t=1639038498486') format('woff'), url('iconfont.woff?t=1640585290619') format('woff'),
url('iconfont.ttf?t=1639038498486') format('truetype'); url('iconfont.ttf?t=1640585290619') format('truetype');
} }
.iconfont { .iconfont {
@ -13,6 +13,26 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-shengming:before {
content: "\e90b";
}
.icon-chenggong1:before {
content: "\e907";
}
.icon-a-bitian2x1:before {
content: "\e908";
}
.icon-xiala1:before {
content: "\e909";
}
.icon-xiala2:before {
content: "\e90a";
}
.icon-jiantou1:before { .icon-jiantou1:before {
content: "\e905"; content: "\e905";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,41 @@
"css_prefix_text": "icon-", "css_prefix_text": "icon-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "12505154",
"name": "声明",
"font_class": "shengming",
"unicode": "e90b",
"unicode_decimal": 59659
},
{
"icon_id": "26470597",
"name": "成功",
"font_class": "chenggong1",
"unicode": "e907",
"unicode_decimal": 59655
},
{
"icon_id": "26470599",
"name": "必填@2x",
"font_class": "a-bitian2x1",
"unicode": "e908",
"unicode_decimal": 59656
},
{
"icon_id": "26470600",
"name": "下拉",
"font_class": "xiala1",
"unicode": "e909",
"unicode_decimal": 59657
},
{
"icon_id": "26470601",
"name": "下拉2",
"font_class": "xiala2",
"unicode": "e90a",
"unicode_decimal": 59658
},
{ {
"icon_id": "26363219", "icon_id": "26363219",
"name": "箭头", "name": "箭头",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -435,7 +435,7 @@ function CoderDepot(props){
<div className="addOptionBtn"> <div className="addOptionBtn">
{ {
baseOperate && baseOperate &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile> <CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/compare/master...${turnbar(branchName || defaultBranch)}`)} >+ 合并请求</CheckProfile>
} }
<a onClick={createIssue}>+ 疑修</a> <a onClick={createIssue}>+ 疑修</a>
{/* { {/* {

View File

@ -1,6 +1,6 @@
import React , { Component } from 'react'; import React , { Component } from 'react';
import { Spin , Pagination, Timeline } from 'antd'; import { Spin , Pagination, Timeline } from 'antd';
import { getImageUrl } from 'educoder'; import { getImageUrl , returnbar } from 'educoder';
import { truncateCommitId ,timeFormat } from '../common/util'; import { truncateCommitId ,timeFormat } from '../common/util';
import { AlignTop } from '../Component/layout'; import { AlignTop } from '../Component/layout';
import SelectBranch from '../Branch/Select'; import SelectBranch from '../Branch/Select';
@ -15,12 +15,6 @@ import CopyTool from '../Component/CopyTool';
import './tree/Index.scss' import './tree/Index.scss'
function returnbar(str){
if(str && str.length>0 && str.indexOf("%2F")>-1){
return str.replaceAll('%2F','/');
}
return str;
}
//代码库--提交页面 //代码库--提交页面
class CoderRootCommit extends Component{ class CoderRootCommit extends Component{
@ -79,7 +73,7 @@ class CoderRootCommit extends Component{
isSpining:true, isSpining:true,
page:realPage page:realPage
}) })
this.getCommitList( branchName , realPage , limit ); this.getCommitList( returnbar(branchName) , realPage , limit );
} }
getCommitList=(branch , page , limit)=>{ getCommitList=(branch , page , limit)=>{

View File

@ -3,6 +3,8 @@ import { Input, Select, Spin, Alert } from 'antd';
import axios from 'axios'; import axios from 'axios';
import MergeForm from './merge_form'; import MergeForm from './merge_form';
import MergeFooter from './merge_footer'; import MergeFooter from './merge_footer';
import { returnbar , turnbar } from 'educoder';
import { Base64 } from 'js-base64';
import '../Order/order.css'; import '../Order/order.css';
import './merge.css'; import './merge.css';
@ -72,8 +74,8 @@ class CreateMerge extends Component {
pullBranches: undefined, pullBranches: undefined,
mergeBranches: undefined, mergeBranches: undefined,
mergeProjects: undefined, mergeProjects: undefined,
merge: mergeBranch || 'master', merge: returnbar(mergeBranch) || 'master',
pull: pullBranch || 'master', pull: returnbar(pullBranch) || 'master',
id: undefined, id: undefined,
// isFork: false, // isFork: false,
projects_names: undefined, projects_names: undefined,
@ -127,11 +129,11 @@ class CreateMerge extends Component {
// 如果url上的分支不存在取默认值master // 如果url上的分支不存在取默认值master
const noMergeBranch = const noMergeBranch =
(result.data.branches || []).filter( (result.data.branches || []).filter(
(branch) => branch.name === mergeBranch (branch) => branch.name === returnbar(mergeBranch)
).length === 0; ).length === 0;
const noPullBranch = const noPullBranch =
(result.data.branches || []).filter( (result.data.branches || []).filter(
(branch) => branch.name === pullBranch (branch) => branch.name === returnbar(pullBranch)
).length === 0; ).length === 0;
this.setState({ this.setState({
// isFork: result.data.is_fork, // isFork: result.data.is_fork,
@ -141,8 +143,8 @@ class CreateMerge extends Component {
mergeBranches: result.data.branches, mergeBranches: result.data.branches,
project_id: result.data.project_id, project_id: result.data.project_id,
id: result.data.id, id: result.data.id,
merge: mergeBranch, merge: returnbar(mergeBranch),
pull: pullBranch, pull: returnbar(pullBranch),
}); });
//判断源分支是否存在 //判断源分支是否存在
@ -153,7 +155,7 @@ class CreateMerge extends Component {
isCompareSpin: false, isCompareSpin: false,
}); });
}else{ }else{
if(pullOwner === mergeOwner){ if(pullOwner === returnbar(mergeOwner)){
if (!noMergeBranch) { if (!noMergeBranch) {
this.compareProject(true, branchParams); this.compareProject(true, branchParams);
} else { } else {
@ -179,13 +181,13 @@ class CreateMerge extends Component {
// compare接口获取分支对比信息 // compare接口获取分支对比信息
compareProject = (sameProject, branchParams) => { compareProject = (sameProject, branchParams) => {
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams; const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
let url = `/${mergeOwner}/${projectId}/compare`; let url = `/${mergeOwner}/${projectId}/compare`;
if (sameProject) { if (sameProject) {
url += `/${pullBranch}...${mergeBranch}.json`; url += `/${Base64.encode(returnbar(pullBranch))}...${Base64.encode(returnbar(mergeBranch))}.json`;
} else { } else {
url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`; url += `/${Base64.encode(returnbar(mergeBranch))}...${pullOwner}/${projectId}:${Base64.encode(returnbar(pullBranch))}.json`;
} }
console.log(url);
this.setState({ isSpin: false, isCompareSpin: true }); this.setState({ isSpin: false, isCompareSpin: true });
axios axios
.get(url) .get(url)
@ -255,10 +257,10 @@ class CreateMerge extends Component {
let _mergeBranch = type === 'pull' ? mergeBranch : value; let _mergeBranch = type === 'pull' ? mergeBranch : value;
if (pullOwner === mergeOwner) { if (pullOwner === mergeOwner) {
// 如果仓库相同, compare/目标分支...源分支 // 如果仓库相同, compare/目标分支...源分支
_url += `${_mergeBranch}...${_pullBranch}`; _url += `${turnbar(_mergeBranch)}...${turnbar(_pullBranch)}`;
} else { } else {
// 如果仓库不同, compare/目标分支...源分支 // 如果仓库不同, compare/目标分支...源分支
_url += `${_mergeBranch}...${pullOwner}:${_pullBranch}`; _url += `${turnbar(_mergeBranch)}...${pullOwner}:${turnbar(_pullBranch)}`;
} }
this.props.history.push(_url); this.props.history.push(_url);
}; };
@ -292,11 +294,11 @@ class CreateMerge extends Component {
if (login === pullOwner) { if (login === pullOwner) {
// 如果切换后, 仓库与源仓库一致了 // 如果切换后, 仓库与源仓库一致了
this.props.history.push( this.props.history.push(
`/${login}/${identifier}/compare/master...${pullBranch}` `/${login}/${identifier}/compare/master...${turnbar(pullBranch)}`
); );
} else { } else {
this.props.history.push( this.props.history.push(
`/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}` `/${login}/${identifier}/compare/master...${pullOwner}:${turnbar(pullBranch)}`
); );
} }
} }

View File

@ -126,6 +126,30 @@ class UserSubmitComponent extends Component {
}); });
}; };
checkBranchName=(rule, value, callback)=>{
if(!value){
callback();
}
if (value) {
const str = '^*/';
let reg = /\\/g;
if(reg.test(value)){
callback(<span>分支名不能包含下列任何字符^*\/</span>);
}else{
for(var i=0;i<str.length;i++){
let s = str[i];
if(value.indexOf(s) > -1){
callback(<span>分支名不能包含下列任何字符^*\/</span>);
return;
}else{
continue;
}
}
}
}
callback();
}
render() { render() {
const { submitType, filename, isSpin } = this.state; const { submitType, filename, isSpin } = this.state;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
@ -211,6 +235,9 @@ class UserSubmitComponent extends Component {
required: true, required: true,
message: "请输入分支名称", message: "请输入分支名称",
}, },
{
validator:this.checkBranchName
}
], ],
})( })(
<Input <Input

View File

@ -1,4 +1,4 @@
import React, { Component } from "react"; import React, { Component, useRef } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import axios from "axios"; import axios from "axios";
@ -173,6 +173,15 @@ class Detail extends Component {
return <RenderHtml className="break_word_comments imageLayerParent" value={v} url={this.props.history.location} />; return <RenderHtml className="break_word_comments imageLayerParent" value={v} url={this.props.history.location} />;
}; };
bindCommentRef = (commentRef) => {
this.childComment = commentRef;
}
refreshFunc=()=> {
this.childComment && this.childComment.getjournalslist();
}
render() { render() {
const { projectsId, orderId, owner } = this.props.match.params; const { projectsId, orderId, owner } = this.props.match.params;
const { data, isSpins } = this.state; const { data, isSpins } = this.state;
@ -292,11 +301,12 @@ class Detail extends Component {
order_id={orderId} order_id={orderId}
showNotification={this.props.showNotification} showNotification={this.props.showNotification}
{...this.props} {...this.props}
bindCommentRef={this.bindCommentRef}
/> />
</div> </div>
<div className="list-left list-left-padding"> <div className="list-left list-left-padding">
<div className="list-right-item-padding background-f boder-4"> <div className="list-right-item-padding background-f boder-4">
<Claims issue_id={orderId} {...this.props} /> <Claims issue_id={orderId} {...this.props} refreshFunc={this.refreshFunc}/>
</div> </div>
<div className="list-right-item-padding background-f boder-4"> <div className="list-right-item-padding background-f boder-4">

View File

@ -692,7 +692,7 @@ a.issue-type-button.active:hover {
.issue-edit-form-right{margin-bottom: 0 !important;} .issue-edit-form-right{margin-bottom: 0 !important;}
.plr10{padding: 0 10px;} .plr10{padding: 0 10px;}
.issue-form-index .editormd-toolbar{position: absolute !important;} .issue-form-index .editormd-toolbar{position: absolute !important;}
.list-right-item-padding{padding: 20px 35px 10px 35px;} .list-right-item-padding{padding: 20px 35px 10px 35px;margin-bottom: 20px;}
.tagColor { .tagColor {
display: inline-block; display: inline-block;
width: 28px; width: 28px;

View File

@ -60,13 +60,13 @@
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: 2px; padding-bottom: 2px;
a{ a{
margin: 0px 17px 10px 0px; margin: 0px 10px 10px 0px;
img{ img{
border-radius: 50%; border-radius: 50%;
width: 40px; width: 40px;
height: 40px; height: 40px;
} }
&:nth-child(5n){ &:nth-child(4n){
margin-right: 0px; margin-right: 0px;
} }
} }

View File

@ -53,6 +53,8 @@ class claims extends React.Component {
claimNotePop:false, claimNotePop:false,
claimNoteBody:'', claimNoteBody:'',
}); });
const { refreshFunc } = this.props;
refreshFunc && refreshFunc();
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
@ -69,6 +71,7 @@ class claims extends React.Component {
yesClaim = ()=>{ yesClaim = ()=>{
const {issue_id,claimNoteBody} = this.state; const {issue_id,claimNoteBody} = this.state;
const { refreshFunc } = this.props;
axios.post(`/issues/${issue_id}/claims.json`, { axios.post(`/issues/${issue_id}/claims.json`, {
claim_note: claimNoteBody claim_note: claimNoteBody
@ -79,6 +82,7 @@ class claims extends React.Component {
currentUserClaimed: result.data.currentUserclaimed, currentUserClaimed: result.data.currentUserclaimed,
claimNotePop:false, claimNotePop:false,
}); });
refreshFunc && refreshFunc();
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
@ -99,6 +103,7 @@ class claims extends React.Component {
updateClaim = (claimId,key)=>{ updateClaim = (claimId,key)=>{
const {issue_id,claimNoteBody,claimNoteBodyChanged} = this.state; const {issue_id,claimNoteBody,claimNoteBodyChanged} = this.state;
const { refreshFunc } = this.props;
if(claimNoteBodyChanged){ if(claimNoteBodyChanged){
axios.put(`/issues/${issue_id}/claims.json`, { axios.put(`/issues/${issue_id}/claims.json`, {
claim_note: claimNoteBody, claim_note: claimNoteBody,
@ -109,6 +114,7 @@ class claims extends React.Component {
claimerdata: result.data.claimers, claimerdata: result.data.claimers,
currentUserClaimed: result.data.currentUserclaimed, currentUserClaimed: result.data.currentUserclaimed,
}); });
refreshFunc && refreshFunc();
}) })
.catch(error => { .catch(error => {
console.log(error); console.log(error);
@ -238,12 +244,12 @@ class claims extends React.Component {
return ( return (
<div> <div>
{currentUserClaimed==1?( {currentUserClaimed===1?(
<div><Button onClick={()=>this.delClaim()} > 取消声明 </Button> <div><Button onClick={()=>this.delClaim()} >取消声明</Button>
</div> </div>
):( ):(
<Popover visible={this.state.claimNotePop} content={renderClaim()} trigger='click' placement="bottom" overlayClassName="menuPanels"> <Popover visible={this.state.claimNotePop} content={renderClaim()} trigger='click' placement="bottom" overlayClassName="menuPanels">
<Button onClick={()=> this.addClaim()} type="primary" className="mr15" > </Button> <Button onClick={()=> this.addClaim()} type="primary"><i className="iconfont icon-shengming font-14 mr5 color-white"></i></Button>
</Popover> </Popover>
)} )}
@ -253,7 +259,10 @@ class claims extends React.Component {
{ {
claimerdata&&claimerdata.length>0?( claimerdata&&claimerdata.length>0?(
<div> <div>
<span>声明要关注/解决此疑修的用户</span><span className="infoCount">{claimerdata.length}</span> <div className="mt15">
<span>声明要关注/解决此疑修的用户</span>
<span className="infoCount">{claimerdata.length}</span>
</div>
<div className="attrPerson" onMouseLeave={()=>this.setVisibleFunc(false)}> <div className="attrPerson" onMouseLeave={()=>this.setVisibleFunc(false)}>
{claimerdata.map((item,key)=>{ {claimerdata.map((item,key)=>{
return( return(
@ -266,7 +275,10 @@ class claims extends React.Component {
})} })}
</div> </div>
</div>):( </div>):(
<div><span>声明要关注/解决此疑修的用户</span> <span className="infoCount">0</span></div> <div className='mt15'>
<span>声明要关注/解决此疑修的用户</span>
<span className="infoCount">0</span>
</div>
)} )}
</div> </div>