mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
1 line
6.4 KiB
JavaScript
Vendored
1 line
6.4 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1059],{8723:function(e,n,s){s.d(n,{e:function(){return m}});var t=s(85893),r=s(85402),l=s(71577),a=s(5152),i=s.n(a),o=s(58827);let d=i()(()=>Promise.all([s.e(2074),s.e(2461)]).then(s.t.bind(s,42461,23)),{loadableGenerated:{webpack:()=>[42461]},ssr:!1}),c=i()(()=>Promise.all([s.e(2074),s.e(1538)]).then(s.t.bind(s,11538,23)),{loadableGenerated:{webpack:()=>[11538]},ssr:!1}),u=i()(()=>Promise.all([s.e(2074),s.e(6773)]).then(s.t.bind(s,6773,23)),{loadableGenerated:{webpack:()=>[6773]},ssr:!1}),m=e=>{let{user:n,isEnabled:s,label:a,onClick:i}=e;async function m(e){let{id:n}=e;try{let e=await (0,o.rQ)(o.NM,{data:{userId:n,enabled:!s},method:"POST",auth:!0});return e.success}catch(e){console.error(e)}return!1}let h=s?"ban":"unban",b=s?(0,t.jsx)(d,{style:{color:"var(--ant-error)"}}):(0,t.jsx)(c,{style:{color:"var(--ant-warning)"}}),x=(0,t.jsxs)(t.Fragment,{children:["Are you sure you want to ",h," ",(0,t.jsx)("strong",{children:n.displayName}),s?" and remove their messages?":"?"]}),j=()=>{r.Z.confirm({title:"Confirm ".concat(h),content:x,onCancel:()=>{},onOk:()=>new Promise((e,s)=>{let t=m(n);t?setTimeout(()=>{e(t),null==i||i()},3e3):s()}),okType:"danger",okText:s?"Absolutely":null,icon:b})};return(0,t.jsx)(l.Z,{type:"primary",onClick:j,size:"small",icon:s?(0,t.jsx)(u,{twoToneColor:"#ff4d4f"}):null,className:"block-user-button",children:a||h})};m.defaultProps={label:"",onClick:null}},23445:function(e,n,s){s.d(n,{Z:function(){return N}});var t=s(85893),r=s(67294),l=s(94199),a=s(85402),i=s(85818),o=s(71230),d=s(15746),c=s(27049),u=s(26713),m=s(45938),h=s(58091),b=s(96486),x=s(8723),j=s(71577),p=s(5152),y=s.n(p),k=s(58827);let f=y()(()=>Promise.all([s.e(2074),s.e(2461)]).then(s.t.bind(s,42461,23)),{loadableGenerated:{webpack:()=>[42461]},ssr:!1}),w=y()(()=>Promise.all([s.e(2074),s.e(1538)]).then(s.t.bind(s,11538,23)),{loadableGenerated:{webpack:()=>[11538]},ssr:!1}),g=y()(()=>Promise.all([s.e(2074),s.e(6773)]).then(s.t.bind(s,6773,23)),{loadableGenerated:{webpack:()=>[6773]},ssr:!1}),C=y()(()=>Promise.all([s.e(2074),s.e(4612)]).then(s.t.bind(s,64612,23)),{loadableGenerated:{webpack:()=>[64612]},ssr:!1}),T=e=>{var n;let{user:s,onClick:r}=e;async function l(e,n){let{id:s}=e;try{let e=await (0,k.rQ)(k.jr,{data:{userId:s,isModerator:n},method:"POST",auth:!0});return e.success}catch(e){console.error(e)}return!1}let i=null===(n=s.scopes)||void 0===n?void 0:n.includes("MODERATOR"),o=i?"remove moderator":"add moderator",d=i?(0,t.jsx)(f,{style:{color:"var(--ant-error)"}}):(0,t.jsx)(w,{style:{color:"var(--ant-warning)"}}),c=(0,t.jsxs)(t.Fragment,{children:["Are you sure you want to ",o," ",(0,t.jsx)("strong",{children:s.displayName}),"?"]}),u=()=>{a.Z.confirm({title:"Confirm ".concat(o),content:c,onCancel:()=>{},onOk:()=>new Promise((e,n)=>{let t=l(s,!i);t?setTimeout(()=>{e(t),null==r||r()},3e3):n()}),okType:"danger",okText:i?"Yup!":null,icon:d})};return(0,t.jsx)(j.Z,{type:"primary",onClick:u,size:"small",icon:i?(0,t.jsx)(g,{twoToneColor:"#ff4d4f"}):(0,t.jsx)(C,{twoToneColor:"#22bb44"}),className:"block-user-button",children:o})};T.defaultProps={onClick:null};var Z=s(3539),v=s(2766);let N=e=>{let{user:n,connectionInfo:s,children:j}=e,[p,y]=(0,r.useState)(!1),k=()=>{y(!0)},f=()=>{y(!1)},{displayName:w,createdAt:g,previousNames:C,nameChangedAt:N,disabledAt:P}=n,{connectedAt:A,messageCount:D,userAgent:O}=s||{},G=null,M=C&&[...C];C&&C.length>1&&N&&(G=new Date(N),M.reverse());let E=new Date(g),I=(0,h.Z)(E,"PP pp"),S=G?(0,m.Z)(G):null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Z,{title:(0,t.jsxs)(t.Fragment,{children:["Created at: ",I,".",(0,t.jsx)("br",{})," Click for more info."]}),placement:"bottomLeft",children:(0,t.jsx)("button",{type:"button","aria-label":"Display more details about this user",className:"user-item-container",onClick:k,children:j})}),(0,t.jsx)(a.Z,{destroyOnClose:!0,width:600,cancelText:"Close",okButtonProps:{style:{display:"none"}},title:"User details: ".concat(w),open:p,onOk:f,onCancel:f,children:(0,t.jsxs)("div",{className:"user-details",children:[(0,t.jsx)(i.Z.Title,{level:4,children:w}),(0,t.jsxs)("p",{className:"created-at",children:["User created at ",I,"."]}),(0,t.jsxs)(o.Z,{gutter:16,children:[s&&(0,t.jsxs)(d.Z,{md:G?12:24,children:[(0,t.jsx)(i.Z.Title,{level:5,children:"This user is currently connected to Chat."}),(0,t.jsxs)("ul",{className:"connection-info",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"Active for:"})," ",(0,m.Z)(new Date(A))]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"Messages sent:"})," ",D]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"User Agent:"}),(0,t.jsx)("br",{}),(0,v.AB)(O)]})]})]}),G&&(0,t.jsxs)(d.Z,{md:s?12:24,children:[(0,t.jsx)(i.Z.Title,{level:5,children:"This user is also seen as:"}),(0,t.jsx)("ul",{className:"previous-names-list",children:(0,b.uniq)(M).map((e,n)=>(0,t.jsxs)("li",{className:0===n?"latest":"",children:[(0,t.jsx)("span",{className:"user-name-item",children:e}),0===n?" (Changed ".concat(S," ago)"):""]}))})]})]}),(0,t.jsx)(c.Z,{}),(0,t.jsxs)(u.Z,{direction:"horizontal",children:[P?(0,t.jsxs)(t.Fragment,{children:["This user was banned on ",(0,t.jsx)("code",{children:(0,Z.u)(P)}),".",(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)(x.e,{label:"Unban this user",user:n,isEnabled:!1,onClick:f})]}):(0,t.jsx)(x.e,{label:"Ban this user",user:n,isEnabled:!0,onClick:f}),(0,t.jsx)(T,{user:n,onClick:f})]})]})})]})};N.defaultProps={connectionInfo:null}},3539:function(e,n,s){s.d(n,{K:function(){return d},u:function(){return o}});var t=s(85893),r=s(54398),l=s(58091),a=s(23445),i=s(8723);function o(e){return(0,l.Z)(new Date(e),"MMM d H:mma")}let d=e=>{let{data:n}=e;return(0,t.jsx)(r.Z,{pagination:{hideOnSinglePage:!0},className:"table-container",columns:[{title:"Last Known Display Name",dataIndex:"displayName",key:"displayName",render:(e,n)=>(0,t.jsx)(a.Z,{user:n,children:(0,t.jsx)("span",{className:"display-name",children:e})})},{title:"Created",dataIndex:"createdAt",key:"createdAt",render:e=>o(e),sorter:(e,n)=>new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime(),sortDirections:["descend","ascend"]},{title:"Disabled at",dataIndex:"disabledAt",key:"disabledAt",defaultSortOrder:"descend",render:e=>e?o(e):null,sorter:(e,n)=>new Date(e.disabledAt).getTime()-new Date(n.disabledAt).getTime(),sortDirections:["descend","ascend"]},{title:"",key:"block",className:"actions-col",render:(e,n)=>(0,t.jsx)(i.e,{user:n,isEnabled:!n.disabledAt})}],dataSource:n,size:"small",rowKey:"id"})}}}]); |