PageSourceSearch

https://www.thoushaltnotclick.com/_next/static/chunks/app/admin/pl…/community-alerts/page-c8ad83ff777e95bc.js

js thoushaltnotclick.com collected 2026-10-02 00:59:18 UTC 9,328 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4050],{33291:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>l});var s=r(95155),o=r(12115),i=r(5865),n=r(18286),a=r(70437);function l(){(0,a.X4)();let[e,t]=(0,o.useState)("review"),[r,l]=(0,o.useState)("unreviewed"),[f,m]=(0,o.useState)([]),[h,g]=(0,o.useState)(!0),[x,y]=(0,o.useState)(null),[b,_]=(0,o.useState)(""),v=(0,o.useCallback)(async e=>{g(!0),_("");try{let t=await (0,n.request)(`/api/features/platform/community-alerts/review?status=${e}`);m(t.alerts||[])}catch(e){_(`Could not load alerts: ${e.message}`)}g(!1)},[]);(0,o.useEffect)(()=>{"review"===e&&v(r)},[e,r,v]);let j=async(e,t)=>{y(e),_("");try{await (0,n.request)(`/api/features/platform/community-alerts/${e}/review`,{method:"POST",body:JSON.stringify({decision:t})}),m(t=>t.filter(t=>t.id!==e))}catch(e){_(`Review failed: ${e.message}`)}y(null)},[w,S]=(0,o.useState)(""),[C,R]=(0,o.useState)(!1),[k,T]=(0,o.useState)(null),[z,A]=(0,o.useState)(""),P=async()=>{_(""),A(""),T(null),R(!0);try{let e=await (0,n.request)(`/api/platform/users?search=${encodeURIComponent(w.trim())}`),t=(e.users||[]).find(e=>e.email?.toLowerCase()===w.trim().toLowerCase())||(e.users||[])[0];if(!t){_("No user found with that email."),R(!1);return}let r=await (0,n.request)(`/api/features/platform/users/${t.id}/trusted-reporter`);T(r)}catch(e){_(`Lookup failed: ${e.message}`)}R(!1)},$=async e=>{if(k){_(""),A("");try{let t=await (0,n.request)(`/api/features/platform/users/${k.user_id}/trusted-reporter`,{method:"PUT",body:JSON.stringify({trusted:e})});T({...k,trusted_reporter:t.trusted_reporter,trusted_reporter_at:t.trusted_reporter?new Date().toISOString():null,source:t.trusted_reporter?"manual":null}),A(`✓ ${t.email} is ${t.trusted_reporter?"now a Trusted Reporter":"no longer a Trusted Reporter"}.`)}catch(e){_(`Update failed: ${e.message}`)}}};return(0,s.jsx)(i.A,{title:"Community Alerts",children:(0,s.jsxs)("div",{style:{maxWidth:820},children:[(0,s.jsx)("div",{style:{display:"flex",gap:8,marginBottom:18},children:["review","reporters"].map(r=>(0,s.jsx)("button",{onClick:()=>t(r),style:d(e===r),children:"review"===r?"Review Queue":"Trusted Reporters"},r))}),b&&(0,s.jsx)("div",{style:{color:"#b91c1c",fontSize:13,marginBottom:12},children:b}),"review"===e&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{style:{display:"flex",gap:8,marginBottom:14},children:["unreviewed","ok","abusive"].map(e=>{var t;return(0,s.jsx)("button",{onClick:()=>l(e),style:{padding:"5px 12px",background:(t=r===e)?"#0f172a":"#f1f5f9",color:t?"#fff":"#475569",border:"none",borderRadius:999,fontSize:12,cursor:"pointer",textTransform:"capitalize"},children:e},e)})}),h?(0,s.jsx)("div",{style:{color:"#64748b"},children:"Loading…"}):0===f.length?(0,s.jsxs)("div",{style:{fontSize:13,color:"#94a3b8"},children:["No ",(0,s.jsx)("strong",{children:r})," Community Alerts."]}):(0,s.jsxs)("table",{style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{textAlign:"left",color:"#94a3b8"},children:[(0,s.jsx)("th",{style:c,children:"When"}),(0,s.jsx)("th",{style:c,children:"Reporter"}),(0,s.jsx)("th",{style:c,children:"Sender flagged"}),(0,s.jsx)("th",{style:c})]})}),(0,s.jsx)("tbody",{children:f.map(e=>(0,s.jsxs)("tr",{style:{borderTop:"1px solid #f1f5f9"},children:[(0,s.jsx)("td",{style:p,children:new Date(e.created_at).toLocaleString()}),(0,s.jsx)("td",{style:p,children:e.reporter?.email||`#${e.user_id}`}),(0,s.jsxs)("td",{style:p,children:[(0,s.jsx)("strong",{children:e.sender_email}),e.subject?(0,s.jsx)("div",{style:{color:"#94a3b8"},children:e.subject.slice(0,60)}):null]}),(0,s.jsx)("td",{style:{...p,whiteSpace:"nowrap"},children:"unreviewed"===r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{disabled:x===e.id,onClick:()=>j(e.id,"ok"),style:u("#15803d"),children:"OK"}),(0,s.jsx)("button",{disabled:x===e.id,onClick:()=>j(e.id,"abusive"),style:u("#b91c1c"),children:"Abusive"})]}):(0,s.jsx)("span",{style:{color:"#94a3b8"},children:e.review_status})})]},e.id))})]})]}),"reporters"===e&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{style:{fontSize:13,color:"#64748b",marginBottom:14},children:'When two Trusted Reporters flag the same sender, TSNC automatically raises an org-wide Community Alert. Users become Trusted Reporters by completing the "Trusted Reporter" training module — use this to grant the status manually (e.g. a tester) or revoke it for abuse.'}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,marginBottom:18},children:[(0,s.jsx)("input",{type:"email",value:w,placeholder:"[email protected]",onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&P()},style:{flex:1,padding:"8px 12px",border:"1px solid #cbd5e1",borderRadius:8,fontSize:14}}),(0,s.jsx)("button",{onClick:P,disabled:C||!w.trim(),style:d(!0),children:C?"Looking up…":"Look up"})]}),z&&(0,s.jsx)("div",{style:{color:"#15803d",fontSize:13,marginBottom:12},children:z}),k&&(0,s.jsxs)("div",{style:{border:"1px solid #e2e8f0",borderRadius:12,padding:18},children:[(0,s.jsx)("div",{style:{fontWeight:700,color:"#0f172a"},children:k.email}),(0,s.jsxs)("div",{style:{fontSize:13,color:"#475569",margin:"8px 0 14px"},children:["Status: ",k.trusted_reporter?(0,s.jsx)("strong",{style:{color:"#15803d"},children:"Trusted Reporter"}):(0,s.jsx)("strong",{style:{color:"#b45309"},children:"Not a Trusted Reporter"}),k.trusted_reporter&&k.source?(0,s.jsxs)("span",{style:{color:"#94a3b8"},children:[" (",k.source,")"]}):null]}),k.trusted_reporter?(0,s.jsx)("button",{onClick:()=>$(!1),style:u("#b91c1c"),children:"Revoke"}):(0,s.jsx)("button",{onClick:()=>$(!0),style:u("#15803d"),children:"Grant Trusted Reporter"})]})]})]})})}function d(e){return{padding:"8px 16px",background:e?"#0f172a":"#e2e8f0",color:e?"#fff":"#334155",border:"none",borderRadius:8,fontWeight:600,fontSize:13,cursor:"pointer"}}function u(e){return{padding:"5px 12px",background:e,color:"#fff",border:"none",borderRadius:6,fontWeight:700,fontSize:12,cursor:"pointer",marginLeft:6}}let c={padding:"6px 8px",fontWeight:600},p={padding:"8px",color:"#475569",verticalAlign:"top"}},41071:(e,t,r)=>{Promise.resolve().then(r.bind(r,33291))},70437:(e,t,r)=>{"use strict";r.d(t,{P2:()=>d,X4:()=>a,gc:()=>l});var s=r(12115),o=r(73321),i=r(65576);function n(e){return!!e&&(!!e.is_platform_admin||!!e.is_support_admin&&e.platform_capabilities?.view_all_orgs===!0)}function a(){let{user:e,loading:t}=(0,i.A)(),r=(0,o.useRouter)();(0,s.useEffect)(()=>
1{if(!t){if(!e)return void r.push("/login");n(e)||r.push("/admin/dashboard")}},[t,e,r]);let a=t||!e||!n(e);return{user:e,gateLoading:a}}function l(){let{user:e,loading:t}=(0,i.A)(),r=(0,o.useRouter)(),n=!!(e&&(e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"principal"===e.role||"it_admin"===e.role||"enterprise_admin"===e.role)));(0,s.useEffect)(()=>{if(!t){if(!e)return void r.push("/login");n||r.push("/dashboard")}},[t,e,n,r]);let a=t||!e||!n;return{user:e,gateLoading:a}}function d(){let{user:e,loading:t}=(0,i.A)(),r=(0,o.useRouter)();(0,s.useEffect)(()=>{t||(e?e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"enterprise_admin"===e.role)||r.push("/admin/dashboard"):r.push("/login"))},[t,e,r]);let n=!!(e&&(e.is_platform_admin||e.is_support_admin||e.is_enterprise_admin||(e.org_roles||[]).some(e=>"enterprise_admin"===e.role))),a=t||!e||!n;return{user:e,gateLoading:a}}},73321:(e,t,r)=>{"use strict";var s=r(74645);r.o(s,"useParams")&&r.d(t,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},82849:(e,t,r)=>{"use strict";function s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)"__proto__"!==s&&(e[s]=r[s])}return e}r.r(t),r.d(t,{default:()=>o});var o=function e(t,r){function o(e,o,i){if("u">typeof document){"number"==typeof(i=s({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var n="";for(var a in i)i[a]&&(n+="; "+a,!0!==i[a]&&(n+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+n}}return Object.create({set:o,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],s={},o=0;o<r.length;o++){var i=r[o].split("="),n=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(a in s||(s[a]=t.read(n,a)),e===a)break}catch(e){}}return e?s[e]:s}},remove:function(e,t){o(e,"",s({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,s({},this.attributes,t))},withConverter:function(t){return e(s({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}},e=>{e.O(0,[8500,5772,8286,5576,3480,5865,8441,5254,7358],()=>e(e.s=41071)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.