build/static/js/183.cc795f6f.chunk.js

1 line
2.5 KiB
JavaScript

(this.webpackJsonp=this.webpackJsonp||[]).push([[183],{f0GN:function(e,t,n){"use strict";n.r(t),n("2qtc");var a=n("kLXV"),c=n("zLi2"),o=n.n(c),i=n("o+MX"),r=n.n(i),s=n("Kwsy"),l=n.n(s),p=n("cDcd"),u=n.n(p),m=n("J66h"),w=(n("tdQw"),n("2iEm")),d=n("sYIF"),v=n("vDqi"),f=n.n(v),h={manager:"管理员",developer:"开发者",reporter:"报告者",owner:"所有者"};t.default=function(e){var t,n=e.history,c=e.current_user,i=e.match,s=e.projectDetail,v=e.showNotification;if(!c.login){var j,g=window.location,_=g.pathname,k=g.search;window.location.href=r()(j="/login?go_page=".concat(_)).call(j,k)}var b=s&&s.permission,E=i.params,N=E.projectsId,O=E.owner,L=window.location.search&&window.location.search.split("?invite=")[1],I=L&&JSON.parse(m.Base64.decode(L)),J=Object(p.useState)({}),x=o()(J,2),y=x[0],C=x[1],D=Object(p.useState)(!0),S=o()(D,2),q=S[0],Q=S[1];return Object(p.useEffect)((function(){b&&y.role&&y.role==b.toLocaleLowerCase()||"Owner"==b?(v("您已经是".concat(h[y.role],"了")),l()((function(){var e;n.push(r()(e="/".concat(O,"/")).call(e,N))}),2e3)):Q(!0)}),[b,y.role]),Object(p.useEffect)((function(){var e,t,n=r()(e=r()(t="/".concat(O,"/")).call(t,N,"/project_invite_links/show_link.json?invite_sign=")).call(e,I.sign);f.a.get(n).then((function(e){e&&e.data?C(e.data):v("查询邀请链接失败")}))}),[]),u.a.createElement("div",{className:""},I&&u.a.createElement(a.a,{visible:q,className:"invite_development",title:u.a.createElement("div",{className:"ownerImage"},u.a.createElement("img",{src:y.project&&Object(d.i)(y.project.owner.image_url)})),width:"548px",closable:!0,onCancel:function(){Q(!1),n.push("/".concat(c.login))},centered:!0,okText:"接受",cancelText:"拒绝",onOk:function(){var e,t,c=r()(e=r()(t="/".concat(O,"/")).call(t,N,"/project_invite_links/redirect_link.json?invite_sign=")).call(e,I.sign);f.a.post(c).then((function(e){var t;e&&"success"==e.data.message&&(y.is_apply?(Q(!1),a.a.success({content:"提交申请成功,请等待该仓库管理员审核"})):n.push(r()(t="/".concat(O,"/")).call(t,N)))})).catch((function(e){}))},maskClosable:!1},u.a.createElement(w.a,{className:"invite_project link",target:"_blank",to:r()(t="/".concat(I.ownerLogin,"/")).call(t,I.projectId)},y.project&&y.project.owner.name,"/",y.project&&y.project.name),u.a.createElement("div",{className:"invite_content"},u.a.createElement(w.a,{className:"link",to:"/".concat(y.user&&y.user.login)},y.user&&y.user.name)," 邀请您以",h[y.role],"的身份加入此代码库 是否接受邀请?")))}},tdQw:function(e,t,n){}}]);