Build 574548stable
Module 747926
2,266 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{JA:()=>O,Tv:()=>R,bA:()=>b,xu:()=>v});var i=n(284009),r=n.n(i),s=n(735438),a=n.n(s),o=n(228366),l=n(465532),u=n(608299),c=n(95561),d=n(584682),_=n(9588),h=n(267102),f=n(892340),E=n(976860),p=n(378570),m=n(885386),g=n(761640),A=n(31717),I=n(309010),T=n(977997),S=n(625494),N=n(37411),C=n(652215),y=n(746080);function O(e,t,n){if(!(0,f.C$)(e.id))return void(0,_.showInaccessibleReportPostModal)();h.Uw.dispatch(C.jej.POPOUT_CLOSE);let i=!a().isEmpty(T.A.getVoiceStatesForChannel(e.id)),s={state:{hideThreadCallUI:!0}};if(t||!m.SY.getSetting()||__OVERLAY__||i){o.h.dispatch({type:"SIDEBAR_CLOSE",baseChannelId:e.parent_id}),null!=n?(0,p.N9)(e,{...s,source:n}):(0,p.iN)(e.id,s);return}r()(null!=e.parent_id,"all threads must have parents");let l=e.getGuildId();if(null!=l&&null!=g.Ay.getGuildSidebarState(l)){o.h.dispatch({type:"SIDEBAR_CLOSE",baseChannelId:e.parent_id}),null!=n?(0,p.N9)(e,{...s,source:n}):(0,p.iN)(e.id,s);return}let u=I.A.getChannelId();e.parent_id===u||(0,y.mP)(u)||(0,p.iN)(e.parent_id),(0,E.pX)(C.BVt.CHANNEL_THREAD_VIEW((0,d.j)(e),(0,y.mP)(u)?y.VV.GUILD_HOME:e.parent_id,e.id),e.isForumPost()?{source:N.H9.FORUM}:void 0),setTimeout(()=>{S._.dispatch(C.jej.FOCUS_CHANNEL_TEXT_AREA,{channelId:e.id})},0)}function R(e,t,n){if(r()(!e.isForumLikeChannel(),"cannot open thread creation sidebar in forums"),r()(!__OVERLAY__,"Cannot create threads in the overlay."),(0,c.zV)(C.HAw.THREAD_CREATION_STARTED,{location:n,channel_id:e.id,guild_id:e.guild_id}),h.Uw.dispatch(C.jej.POPOUT_CLOSE),I.A.getChannelId()!==e.id&&(0,p.iN)(e.id),""===A.A.getDraft(e.id,A.C.FirstThreadMessage)){let t=A.A.getDraft(e.id,A.C.ChannelMessage);l.A.saveDraft(e.id,"",A.C.ChannelMessage),l.A.saveDraft(e.id,t,A.C.FirstThreadMessage)}setTimeout(()=>{o.h.dispatch({type:"SIDEBAR_CREATE_THREAD",parentChannelId:e.id,parentMessageId:t?.id,location:n})},0)}function v(e,t){(0,E.pX)(C.BVt.CHANNEL(e,(0,y.mP)(t)?y.VV.GUILD_HOME:t)),o.h.dispatch({type:"SIDEBAR_CLOSE",baseChannelId:t})}function b(e){o.h.dispatch({type:"SIDEBAR_CLOSE",baseChannelId:e}),u.A.clearAll(e,A.C.FirstThreadMessage),o.h.dispatch({type:"DRAFT_CLEAR",channelId:e,draftType:A.C.FirstThreadMessage}),o.h.dispatch({type:"DRAFT_CLEAR",channelId:e,draftType:A.C.ThreadSettings})}}