Build 608660stable
Module 474399
1,093 characters · in 80baf32b4b561962.jsDependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>f});var r=n(284009),u=n.n(r),i=n(17928),l=n(228366),a=n(970278),d=n(734057),s=n(573163);let o={},c=new Set;class A extends i.Ay.Store{static displayName="ForumPostUnreadCountStore";initialize(){this.waitFor(a.A,d.A,s.Ay)}getCount(e){return o[e]}getThreadIdsMissingCounts(e,t){return u()(a.A.hasLoaded(e),"must wait for THREAD_LIST_SYNC before calling this"),t.filter(e=>!(e in o)&&!c.has(e))}}let f=new A(l.h,{CONNECTION_OPEN:function(){o={},c=new Set},THREAD_CREATE:function(e){let{channel:t,isNewlyCreated:n}=e;if(!n||!a.A.hasLoaded(t.guild_id))return!1;o[t.id]=0},MESSAGE_CREATE:function(e){let{channelId:t,optimistic:n,isPushNotification:r}=e;if(n||r||!(t in o))return!1;o[t]++},FORUM_UNREADS:function(e){let{threads:t}=e;t.forEach(e=>{null!=e.count&&(o[e.threadId]=e.count)})},MESSAGE_ACK:function(e){let{channelId:t}=e;if(!(t in o)){let e=d.A.getChannel(t),n=d.A.getChannel(e?.parent_id);if(!n?.isForumLikeChannel())return!1}o[t]=s.Ay.getUnreadCount(t)},REQUEST_FORUM_UNREADS:function(e){let{threads:t}=e;t.forEach(e=>{let{threadId:t}=e;return c.add(t)})}})}