Files
owncast/static/web/_next/static/chunks/9640-e282810d6fb4f58d.js
2022-10-04 18:25:24 +00:00

1 line
6.4 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9640],{77891:function(e,n,t){t.d(n,{e:function(){return h}});var r=t(47568),s=t(70655),a=t(85893),i=t(85402),l=t(71577),o=t(21640),c=t(82911),u=t(84674),d=t(58827),h=function(e){var n=e.user,t=e.isEnabled,h=e.label,m=e.onClick;function f(){return f=(0,r.Z)((function(e){var n,r,a;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:n=e.id,r={userId:n,enabled:!t},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,d.rQ)(d.NM,{data:r,method:"POST",auth:!0})];case 2:return[2,s.sent().success];case 3:return a=s.sent(),console.error(a),[3,4];case 4:return[2,!1]}}))})),f.apply(this,arguments)}var x=t?"ban":"unban",j=t?(0,a.jsx)(o.Z,{style:{color:"var(--ant-error)"}}):(0,a.jsx)(c.Z,{style:{color:"var(--ant-warning)"}}),b=(0,a.jsxs)(a.Fragment,{children:["Are you sure you want to ",x," ",(0,a.jsx)("strong",{children:n.displayName}),t?" and remove their messages?":"?"]});return(0,a.jsx)(l.Z,{onClick:function(){i.Z.confirm({title:"Confirm ".concat(x),content:b,onCancel:function(){},onOk:function(){return new Promise((function(e,t){var r=function(e){return f.apply(this,arguments)}(n);r?setTimeout((function(){e(r),null===m||void 0===m||m()}),3e3):t()}))},okType:"danger",okText:t?"Absolutely":null,icon:j})},size:"small",icon:t?(0,a.jsx)(u.Z,{twoToneColor:"#ff4d4f"}):null,className:"block-user-button",children:h||x})};h.defaultProps={label:"",onClick:null}},11085:function(e,n,t){t.d(n,{Z:function(){return A}});var r=t(29815),s=t(85893),a=t(67294),i=t(94199),l=t(85402),o=t(84485),c=t(25968),u=t(6226),d=t(27049),h=t(26713),m=t(45938),f=t(58091),x=t(96486),j=t(77891),b=t(47568),p=t(70655),v=t(71577),y=t(21640),g=t(82911),Z=t(84674),k=t(24478),C=t(58827),w=function(e){var n,t=e.user,r=e.onClick;function a(){return a=(0,b.Z)((function(e,n){var t,r,s;return(0,p.__generator)(this,(function(a){switch(a.label){case 0:t=e.id,r={userId:t,isModerator:n},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(0,C.rQ)(C.jr,{data:r,method:"POST",auth:!0})];case 2:return[2,a.sent().success];case 3:return s=a.sent(),console.error(s),[3,4];case 4:return[2,!1]}}))})),a.apply(this,arguments)}var i=null===(n=t.scopes)||void 0===n?void 0:n.includes("MODERATOR"),o=i?"remove moderator":"add moderator",c=i?(0,s.jsx)(y.Z,{style:{color:"var(--ant-error)"}}):(0,s.jsx)(g.Z,{style:{color:"var(--ant-warning)"}}),u=(0,s.jsxs)(s.Fragment,{children:["Are you sure you want to ",o," ",(0,s.jsx)("strong",{children:t.displayName}),"?"]});return(0,s.jsx)(v.Z,{onClick:function(){l.Z.confirm({title:"Confirm ".concat(o),content:u,onCancel:function(){},onOk:function(){return new Promise((function(e,n){var s=function(e,n){return a.apply(this,arguments)}(t,!i);s?setTimeout((function(){e(s),null===r||void 0===r||r()}),3e3):n()}))},okType:"danger",okText:i?"Yup!":null,icon:c})},size:"small",icon:i?(0,s.jsx)(Z.Z,{twoToneColor:"#ff4d4f"}):(0,s.jsx)(k.Z,{twoToneColor:"#22bb44"}),className:"block-user-button",children:o})};w.defaultProps={onClick:null};var T=t(41542),N=t(2766),A=function(e){var n=e.user,t=e.connectionInfo,b=e.children,p=(0,a.useState)(!1),v=p[0],y=p[1],g=function(){y(!1)},Z=n.displayName,k=n.createdAt,C=n.previousNames,A=n.nameChangedAt,D=n.disabledAt,P=t||{},O=P.connectedAt,_=P.messageCount,E=P.userAgent,I=null,M=C&&(0,r.Z)(C);C&&C.length>1&&A&&(I=new Date(A),M.reverse());var S=new Date(k),F=(0,f.Z)(S,"PP pp"),z=I?(0,m.Z)(I):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{title:(0,s.jsxs)(s.Fragment,{children:["Created at: ",F,".",(0,s.jsx)("br",{})," Click for more info."]}),placement:"bottomLeft",children:(0,s.jsx)("button",{type:"button","aria-label":"Display more details about this user",className:"user-item-container",onClick:function(){y(!0)},children:b})}),(0,s.jsx)(l.Z,{destroyOnClose:!0,width:600,cancelText:"Close",okButtonProps:{style:{display:"none"}},title:"User details: ".concat(Z),visible:v,onOk:g,onCancel:g,children:(0,s.jsxs)("div",{className:"user-details",children:[(0,s.jsx)(o.Z.Title,{level:4,children:Z}),(0,s.jsxs)("p",{className:"created-at",children:["User created at ",F,"."]}),(0,s.jsxs)(c.Z,{gutter:16,children:[t&&(0,s.jsxs)(u.Z,{md:I?12:24,children:[(0,s.jsx)(o.Z.Title,{level:5,children:"This user is currently connected to Chat."}),(0,s.jsxs)("ul",{className:"connection-info",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Active for:"})," ",(0,m.Z)(new Date(O))]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Messages sent:"})," ",_]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"User Agent:"}),(0,s.jsx)("br",{}),(0,N.AB)(E)]})]})]}),I&&(0,s.jsxs)(u.Z,{md:t?12:24,children:[(0,s.jsx)(o.Z.Title,{level:5,children:"This user is also seen as:"}),(0,s.jsx)("ul",{className:"previous-names-list",children:(0,x.uniq)(M).map((function(e,n){return(0,s.jsxs)("li",{className:0===n?"latest":"",children:[(0,s.jsx)("span",{className:"user-name-item",children:e}),0===n?" (Changed ".concat(z," ago)"):""]})}))})]})]}),(0,s.jsx)(d.Z,{}),(0,s.jsxs)(h.Z,{direction:"horizontal",children:[D?(0,s.jsxs)(s.Fragment,{children:["This user was banned on ",(0,s.jsx)("code",{children:(0,T.u)(D)}),".",(0,s.jsx)("br",{}),(0,s.jsx)("br",{}),(0,s.jsx)(j.e,{label:"Unban this user",user:n,isEnabled:!1,onClick:g})]}):(0,s.jsx)(j.e,{label:"Ban this user",user:n,isEnabled:!0,onClick:g}),(0,s.jsx)(w,{user:n,onClick:g})]})]})})]})};A.defaultProps={connectionInfo:null}},41542:function(e,n,t){t.d(n,{K:function(){return c},u:function(){return o}});var r=t(85893),s=t(93626),a=t(58091),i=t(11085),l=t(77891);function o(e){return(0,a.Z)(new Date(e),"MMM d H:mma")}var c=function(e){var n=e.data,t=[{title:"Last Known Display Name",dataIndex:"displayName",key:"displayName",render:function(e,n){return(0,r.jsx)(i.Z,{user:n,children:(0,r.jsx)("span",{className:"display-name",children:e})})}},{title:"Created",dataIndex:"createdAt",key:"createdAt",render:function(e){return o(e)},sorter:function(e,n){return new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime()},sortDirections:["descend","ascend"]},{title:"Disabled at",dataIndex:"disabledAt",key:"disabledAt",defaultSortOrder:"descend",render:function(e){return e?o(e):null},sorter:function(e,n){return new Date(e.disabledAt).getTime()-new Date(n.disabledAt).getTime()},sortDirections:["descend","ascend"]},{title:"",key:"block",className:"actions-col",render:function(e,n){return(0,r.jsx)(l.e,{user:n,isEnabled:!n.disabledAt})}}];return(0,r.jsx)(s.Z,{pagination:{hideOnSinglePage:!0},className:"table-container",columns:t,dataSource:n,size:"small",rowKey:"id"})}}}]);