2026-08-05 07:35:12 +00:00
// Module ID: 5783
// Function ID: 5784
2026-07-29 08:29:29 +00:00
// Name: useCanUnarchiveThread
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 4168, 1376, 1218, 1372, 3883, 5176, 676, 589, 506, 5784, 11, 12, 5785, 5786, 4468, 2]
2026-07-29 08:29:29 +00:00
// Exports: computeCanStartPrivateThread, computeCanStartPublicThread, computeIsReadOnlyThread, getIsActiveChannelOrUnarchivableThread, isNonModInLockedThread, isThreadModerator, useCanJoinThreadVoice, useCanManageThread, useCanRemoveThreadMember, useCanStartPrivateThread, useCanStartPublicThread, useCanStartThread, useCanViewThreadForMessage, useHasActiveThreads, useHasPermissionToJoinThreadVoice, useIsActiveChannelOrUnarchivableThread, useIsNonModInLockedThread, useIsThreadModerator
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 5783 (useCanUnarchiveThread)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray" ;
2026-07-29 08:29:29 +00:00
import { THREADED_CHANNEL_TYPES } from "createChannelRecord" ;
import fetchFingerprint from "fetchFingerprint" ;
import ensureGuildLoaded from "ensureGuildLoaded" ;
import getUncachedChannelPermissions from "getUncachedChannelPermissions" ;
import rebuild from "rebuild" ;
2026-07-23 10:11:24 +00:00
import ME from "ME" ;
2026-07-29 08:29:29 +00:00
import importDefaultResult from "createExperiment" ;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c10 ;
2026-07-23 10:11:24 +00:00
let closure_12 ;
2026-07-29 08:29:29 +00:00
let unpackModuleId ;
2026-07-23 10:11:24 +00:00
const require = arg1 ;
2026-07-20 16:05:17 +00:00
function useCanUnarchiveThread ( channel ) {
2026-07-29 08:29:29 +00:00
let _require = channel ;
const items = [ getUncachedChannelPermissions ] ;
let stateFromStores = _require ( 589 ) . useStateFromStores ( items , ( ) = > {
2026-07-23 10:11:24 +00:00
let canResult = null != closure_0 ;
2026-07-20 16:05:17 +00:00
if ( canResult ) {
2026-07-29 08:29:29 +00:00
canResult = outer1_8 . can ( outer1_10 . SEND_MESSAGES_IN_THREADS , tmp ) ;
2026-07-20 16:05:17 +00:00
}
if ( canResult ) {
2026-07-29 08:29:29 +00:00
canResult = outer1_8 . can ( outer1_10 . SEND_MESSAGES , tmp ) ;
2026-07-20 16:05:17 +00:00
}
return canResult ;
} ) ;
2026-07-29 08:29:29 +00:00
const obj = _require ( 589 ) ;
const items1 = [ getUncachedChannelPermissions , ensureGuildLoaded ] ;
2026-07-20 16:05:17 +00:00
const items2 = [ channel ] ;
2026-07-29 08:29:29 +00:00
_require = channel ;
const stateFromStores1 = _require ( 589 ) . useStateFromStores ( items1 , ( ) = > {
2026-07-20 16:05:17 +00:00
let channel = null ;
2026-07-29 08:29:29 +00:00
if ( null != closure_0 ) {
channel = outer1_7 . getChannel ( tmp . parent_id ) ;
2026-07-20 16:05:17 +00:00
}
let canResult = null != channel ;
if ( canResult ) {
2026-07-29 08:29:29 +00:00
canResult = outer1_8 . can ( outer1_10 . SEND_MESSAGES_IN_THREADS , tmp ) ;
2026-07-20 16:05:17 +00:00
}
if ( canResult ) {
2026-07-23 10:11:24 +00:00
canResult = outer1_8 . can ( outer1_10 . SEND_MESSAGES , channel ) ;
2026-07-20 16:05:17 +00:00
}
return canResult ;
} , items2 ) ;
2026-07-29 08:29:29 +00:00
const obj2 = _require ( 589 ) ;
const items3 = [ getUncachedChannelPermissions ] ;
const stateFromStores2 = _require ( 589 ) . useStateFromStores ( items3 , ( ) = > {
const items = [ outer1_8 ] ;
const first = outer1_4 ( items , 1 ) [ 0 ] ;
let canResult = null != closure_0 ;
if ( canResult ) {
canResult = first . can ( outer1_10 . MANAGE_THREADS , closure_0 ) ;
}
return canResult ;
} ) ;
2026-07-20 16:05:17 +00:00
if ( stateFromStores ) {
stateFromStores = stateFromStores1 ;
}
2026-07-29 08:29:29 +00:00
const tmp4 = null == channel || ! channel . isThread ( ) || channel . isMediaThread ( ) ;
let tmp5 = ! tmp4 ;
if ( ! tmp4 ) {
const threadMetadata = channel . threadMetadata ;
let locked ;
if ( threadMetadata != null ) {
locked = threadMetadata . locked ;
}
if ( locked ) {
stateFromStores = stateFromStores2 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp5 = stateFromStores ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp5 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
function canUnarchiveThread ( parent_id ) {
let canResult = null != parent_id ;
if ( canResult ) {
canResult = obj . can ( constants . SEND_MESSAGES_IN_THREADS , parent_id ) ;
}
let channel = null ;
if ( null != parent_id ) {
channel = channel . getChannel ( parent_id . parent_id ) ;
}
let canResult1 = null != channel ;
if ( canResult1 ) {
canResult1 = obj . can ( constants . SEND_MESSAGES_IN_THREADS , channel ) ;
2026-07-20 16:05:17 +00:00
}
if ( canResult ) {
2026-07-29 08:29:29 +00:00
canResult = canResult1 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const items = [ getUncachedChannelPermissions ] ;
const first = callback ( items , 1 ) [ 0 ] ;
let canResult2 = null != parent_id ;
if ( canResult2 ) {
canResult2 = first . can ( constants . MANAGE_THREADS , parent_id ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp9 = null == parent_id || ! parent_id . isThread ( ) || parent_id . isMediaThread ( ) ;
let tmp10 = ! tmp9 ;
if ( ! tmp9 ) {
const threadMetadata = parent_id . threadMetadata ;
let locked ;
if ( threadMetadata != null ) {
locked = threadMetadata . locked ;
}
if ( locked ) {
canResult = canResult2 ;
}
tmp10 = canResult ;
}
return tmp10 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
( { Permissions : c10 , MessageFlags : unpackModuleId , ChannelTypes : closure_12 } = ME ) ;
let items = [ { id : 1 , label : "On" , config : { enabled : true } } ] ;
const importDefaultResultResult = require ( "createExperiment" ) ( { id : "2022-07_voice_in_threads" , label : "Voice in Threads" , kind : "guild" , defaultConfig : { enabled : false } , treatments : items } ) ;
const result = require ( "createChannelRecord" ) . fileFinishedImporting ( "modules/threads/ThreadHooks.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const VoiceInThreadsExperiment = importDefaultResultResult ;
2026-07-29 08:29:29 +00:00
export const useCanStartPublicThread = function useCanStartPublicThread ( type ) {
const _require = type ;
const items = [ getUncachedChannelPermissions ] ;
const items1 = [ type ] ;
let flag = false ;
if ( obj . useStateFromStores ( items , ( ) = > {
if ( forumLikeChannel . isForumLikeChannel ( ) ) {
let SEND_MESSAGES = outer1_10 . SEND_MESSAGES ;
} else {
SEND_MESSAGES = outer1_2 ( outer1_3 [ 9 ] ) . combine ( outer1_10 . CREATE_PUBLIC_THREADS , outer1_10 . READ_MESSAGE_HISTORY ) ;
const obj = outer1_2 ( outer1_3 [ 9 ] ) ;
}
return outer1_8 . can ( SEND_MESSAGES , forumLikeChannel ) ;
} , items1 ) ) {
flag = false ;
if ( THREADED_CHANNEL_TYPES . has ( type . type ) ) {
flag = true ;
if ( null != arg1 ) {
flag = false ;
if ( ! arg1 . hasFlag ( constants2 . HAS_THREAD ) ) {
flag = true ;
2026-08-05 07:35:12 +00:00
if ( importDefault ( 5784 ) ( arg1 ) ) {
2026-07-29 08:29:29 +00:00
flag = false ;
}
}
}
}
}
return flag ;
} ;
2026-07-20 16:05:17 +00:00
export const computeCanStartPublicThread = function computeCanStartPublicThread ( channel , message ) {
if ( channel . isForumLikeChannel ( ) ) {
let SEND_MESSAGES = constants . SEND_MESSAGES ;
} else {
2026-07-29 08:29:29 +00:00
SEND_MESSAGES = importAll ( 506 ) . combine ( constants . CREATE_PUBLIC_THREADS , constants . READ_MESSAGE_HISTORY ) ;
const obj = importAll ( 506 ) ;
}
let flag = false ;
if ( getUncachedChannelPermissions . can ( SEND_MESSAGES , channel ) ) {
flag = false ;
if ( THREADED_CHANNEL_TYPES . has ( channel . type ) ) {
flag = true ;
if ( null != message ) {
flag = false ;
if ( ! message . hasFlag ( constants2 . HAS_THREAD ) ) {
flag = true ;
2026-08-05 07:35:12 +00:00
if ( importDefault ( 5784 ) ( message ) ) {
2026-07-29 08:29:29 +00:00
flag = false ;
}
}
}
}
}
return flag ;
} ;
export const useCanStartPrivateThread = function useCanStartPrivateThread ( type ) {
const _require = type ;
_require ( 589 ) ;
[ ] [ 0 ] = type ;
let tmp3 = type . type === constants3 . GUILD_TEXT ;
if ( tmp3 ) {
let flag = false ;
if ( tmp2 ) {
flag = false ;
if ( THREADED_CHANNEL_TYPES . has ( type . type ) ) {
flag = true ;
}
}
tmp3 = flag ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp3 ;
2026-07-20 16:05:17 +00:00
} ;
2026-07-29 08:29:29 +00:00
export const computeCanStartPrivateThread = function computeCanStartPrivateThread ( type , hasFlag ) {
let flag = false ;
if ( getUncachedChannelPermissions . can ( constants . CREATE_PRIVATE_THREADS , type ) ) {
flag = false ;
if ( THREADED_CHANNEL_TYPES . has ( type . type ) ) {
flag = true ;
if ( null != hasFlag ) {
flag = false ;
if ( ! hasFlag . hasFlag ( constants2 . HAS_THREAD ) ) {
flag = true ;
2026-08-05 07:35:12 +00:00
if ( importDefault ( 5784 ) ( hasFlag ) ) {
2026-07-29 08:29:29 +00:00
flag = false ;
}
}
}
}
}
return flag ;
2026-07-20 16:05:17 +00:00
} ;
export const useCanStartThread = function useCanStartThread ( channel ) {
2026-07-29 08:29:29 +00:00
let _require = channel ;
const items = [ getUncachedChannelPermissions ] ;
const items1 = [ channel ] ;
let flag = false ;
if ( obj . useStateFromStores ( items , ( ) = > {
if ( forumLikeChannel . isForumLikeChannel ( ) ) {
let SEND_MESSAGES = outer1_10 . SEND_MESSAGES ;
} else {
SEND_MESSAGES = outer1_2 ( outer1_3 [ 9 ] ) . combine ( outer1_10 . CREATE_PUBLIC_THREADS , outer1_10 . READ_MESSAGE_HISTORY ) ;
const obj = outer1_2 ( outer1_3 [ 9 ] ) ;
}
return outer1_8 . can ( SEND_MESSAGES , forumLikeChannel ) ;
} , items1 ) ) {
flag = false ;
if ( THREADED_CHANNEL_TYPES . has ( channel . type ) ) {
flag = true ;
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
_require = channel ;
_require ( 589 ) ;
[ ] [ 0 ] = channel ;
let tmp6 = channel . type === constants3 . GUILD_TEXT ;
if ( tmp6 ) {
let flag2 = false ;
if ( tmp5 ) {
flag2 = false ;
if ( THREADED_CHANNEL_TYPES . has ( channel . type ) ) {
flag2 = true ;
}
}
tmp6 = flag2 ;
}
if ( ! flag ) {
flag = tmp6 ;
}
return flag ;
2026-07-20 16:05:17 +00:00
} ;
export const useCanViewThreadForMessage = function useCanViewThreadForMessage ( hasFlag ) {
2026-07-23 10:11:24 +00:00
const _require = hasFlag ;
2026-07-29 08:29:29 +00:00
const items = [ ensureGuildLoaded ] ;
2026-07-20 16:05:17 +00:00
const items1 = [ hasFlag ] ;
2026-07-29 08:29:29 +00:00
const stateFromStores = _require ( 589 ) . useStateFromStores ( items , ( ) = > outer1_7 . getChannel ( stateFromStores ( outer1_3 [ 11 ] ) . castMessageIdAsChannelId ( hasFlag . id ) ) , items1 ) ;
const obj = _require ( 589 ) ;
const items2 = [ getUncachedChannelPermissions ] ;
2026-07-20 16:05:17 +00:00
const items3 = [ stateFromStores ] ;
2026-07-29 08:29:29 +00:00
const stateFromStores1 = _require ( 589 ) . useStateFromStores ( items2 , ( ) = > outer1_8 . can ( outer1_10 . VIEW_CHANNEL , stateFromStores ) , items3 ) ;
let hasFlagResult = hasFlag . hasFlag ( constants2 . HAS_THREAD ) ;
if ( hasFlagResult ) {
hasFlagResult = null != stateFromStores && stateFromStores1 ;
const tmp5 = null != stateFromStores && stateFromStores1 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return hasFlagResult ;
2026-07-20 16:05:17 +00:00
} ;
export const useHasActiveThreads = function useHasActiveThreads ( channel ) {
2026-07-23 10:11:24 +00:00
const _require = channel ;
2026-07-29 08:29:29 +00:00
const items = [ rebuild , getUncachedChannelPermissions ] ;
return _require ( 589 ) . useStateFromStoresObject ( items , ( ) = > {
2026-07-23 10:11:24 +00:00
const activeJoinedThreadsForParent = outer1_9 . getActiveJoinedThreadsForParent ( activeJoinedRelevantThreadsForParent . guild_id , activeJoinedRelevantThreadsForParent . id ) ;
activeJoinedRelevantThreadsForParent = outer1_9 . getActiveJoinedRelevantThreadsForParent ( activeJoinedRelevantThreadsForParent . guild_id , activeJoinedRelevantThreadsForParent . id ) ;
const activeUnjoinedThreadsForParent = outer1_9 . getActiveUnjoinedThreadsForParent ( activeJoinedRelevantThreadsForParent . guild_id , activeJoinedRelevantThreadsForParent . id ) ;
let obj = outer1_1 ( outer1_3 [ 12 ] ) ( activeJoinedRelevantThreadsForParent ) ;
2026-07-29 08:29:29 +00:00
const someResult = obj . some ( ( channel ) = > getUncachedChannelPermissions . can ( constants . VIEW_CHANNEL , channel . channel ) ) ;
2026-07-23 10:11:24 +00:00
const someResult1 = outer1_1 ( outer1_3 [ 12 ] ) ( activeJoinedThreadsForParent ) . some ( ( channel ) = > {
2026-07-29 08:29:29 +00:00
let canResult = ! ( channel . channel . id in activeJoinedRelevantThreadsForParent ) ;
if ( canResult ) {
canResult = outer1_8 . can ( outer1_10 . VIEW_CHANNEL , channel . channel ) ;
2026-07-20 16:05:17 +00:00
}
return canResult ;
} ) ;
2026-07-23 10:11:24 +00:00
const obj2 = outer1_1 ( outer1_3 [ 12 ] ) ( activeJoinedThreadsForParent ) ;
2026-07-29 08:29:29 +00:00
let someResult2 = outer1_1 ( outer1_3 [ 12 ] ) ( activeUnjoinedThreadsForParent ) . some ( ( arg0 ) = > getUncachedChannelPermissions . can ( constants . VIEW_CHANNEL , arg0 ) ) ;
let tmp7 = someResult ;
2026-07-20 16:05:17 +00:00
if ( ! someResult ) {
2026-07-29 08:29:29 +00:00
tmp7 = someResult1 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( ! tmp7 ) {
tmp7 = someResult2 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { hasActiveThreads : tmp7 , hasMoreActiveThreads : null } ;
2026-07-20 16:05:17 +00:00
if ( ! someResult2 ) {
someResult2 = someResult1 ;
}
2026-07-29 08:29:29 +00:00
obj [ 1 ] = someResult2 ;
2026-07-20 16:05:17 +00:00
return obj ;
} ) ;
} ;
export const useCanManageThread = function useCanManageThread ( channel ) {
2026-07-23 10:11:24 +00:00
const _require = channel ;
2026-07-29 08:29:29 +00:00
const items = [ ensureGuildLoaded ] ;
const stateFromStores = _require ( 589 ) . useStateFromStores ( items , ( ) = > {
2026-07-20 16:05:17 +00:00
let parent_id ;
2026-07-29 08:29:29 +00:00
if ( parent_id != null ) {
2026-07-23 10:11:24 +00:00
parent_id = parent_id . parent_id ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
return outer1_7 . getChannel ( parent_id ) ;
2026-07-20 16:05:17 +00:00
} ) ;
2026-07-29 08:29:29 +00:00
const obj = _require ( 589 ) ;
const items1 = [ getUncachedChannelPermissions ] ;
2026-07-20 16:05:17 +00:00
const items2 = [ stateFromStores ] ;
2026-07-29 08:29:29 +00:00
const stateFromStores1 = _require ( 589 ) . useStateFromStores ( items1 , ( ) = > {
2026-07-20 16:05:17 +00:00
let canResult = null != stateFromStores ;
if ( canResult ) {
2026-07-29 08:29:29 +00:00
canResult = outer1_8 . can ( outer1_10 . MANAGE_THREADS , tmp ) ;
2026-07-20 16:05:17 +00:00
}
return canResult ;
} , items2 ) ;
2026-07-29 08:29:29 +00:00
const obj2 = _require ( 589 ) ;
const items3 = [ fetchFingerprint ] ;
2026-07-20 16:05:17 +00:00
let tmp4 = null != channel ;
2026-07-29 08:29:29 +00:00
const stateFromStores2 = _require ( 589 ) . useStateFromStores ( items3 , ( ) = > id . getId ( ) ) ;
2026-07-20 16:05:17 +00:00
if ( tmp4 ) {
tmp4 = null != stateFromStores ;
}
if ( tmp4 ) {
2026-07-29 08:29:29 +00:00
let isThreadResult = channel . isThread ( ) ;
if ( isThreadResult ) {
let tmp6 = stateFromStores1 ;
if ( ! tmp6 ) {
const isLockedThreadResult = channel . isLockedThread ( ) ;
let tmp8 = ! isLockedThreadResult ;
if ( ! isLockedThreadResult ) {
tmp8 = channel . ownerId === stateFromStores2 ;
}
tmp6 = tmp8 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
isThreadResult = tmp6 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = isThreadResult ;
2026-07-20 16:05:17 +00:00
}
return tmp4 ;
} ;
export { useCanUnarchiveThread } ;
export { canUnarchiveThread } ;
2026-07-29 08:29:29 +00:00
export const useIsActiveChannelOrUnarchivableThread = function useIsActiveChannelOrUnarchivableThread ( channel ) {
let tmp2 = null != channel ;
if ( tmp2 ) {
const isThreadResult = channel . isThread ( ) ;
let isActiveThreadResult = ! isThreadResult ;
if ( isThreadResult ) {
isActiveThreadResult = channel . isActiveThread ( ) ;
}
if ( ! isActiveThreadResult ) {
let isArchivedThreadResult = channel . isArchivedThread ( ) ;
if ( isArchivedThreadResult ) {
const threadMetadata = channel . threadMetadata ;
let locked ;
if ( threadMetadata != null ) {
locked = threadMetadata . locked ;
}
isArchivedThreadResult = true !== locked ;
}
if ( isArchivedThreadResult ) {
isArchivedThreadResult = tmp ;
}
isActiveThreadResult = isArchivedThreadResult ;
}
tmp2 = isActiveThreadResult ;
}
return tmp2 ;
} ;
2026-07-20 16:05:17 +00:00
export const getIsActiveChannelOrUnarchivableThread = function getIsActiveChannelOrUnarchivableThread ( channel ) {
let tmp = null != channel ;
if ( tmp ) {
2026-07-29 08:29:29 +00:00
const isThreadResult = channel . isThread ( ) ;
let isActiveThreadResult = ! isThreadResult ;
if ( isThreadResult ) {
isActiveThreadResult = channel . isActiveThread ( ) ;
}
if ( ! isActiveThreadResult ) {
2026-07-20 16:05:17 +00:00
let isArchivedThreadResult = channel . isArchivedThread ( ) ;
if ( isArchivedThreadResult ) {
const threadMetadata = channel . threadMetadata ;
let locked ;
2026-07-29 08:29:29 +00:00
if ( threadMetadata != null ) {
2026-07-20 16:05:17 +00:00
locked = threadMetadata . locked ;
}
isArchivedThreadResult = true !== locked ;
}
if ( isArchivedThreadResult ) {
isArchivedThreadResult = canUnarchiveThread ( channel ) ;
}
2026-07-29 08:29:29 +00:00
isActiveThreadResult = isArchivedThreadResult ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = isActiveThreadResult ;
2026-07-20 16:05:17 +00:00
}
return tmp ;
} ;
2026-07-29 08:29:29 +00:00
export const computeIsReadOnlyThread = function computeIsReadOnlyThread ( messageChannel ) {
if ( messageChannel . isMediaThread ( ) ) {
2026-07-20 16:05:17 +00:00
return true ;
} else {
2026-07-29 08:29:29 +00:00
const canResult = getUncachedChannelPermissions . can ( constants . MANAGE_THREADS , messageChannel ) ;
return messageChannel . isArchivedLockedThread ( ) && ! getUncachedChannelPermissions . can ( constants . MANAGE_THREADS , messageChannel ) ;
}
} ;
export const useIsThreadModerator = function useIsThreadModerator ( channel ) {
const _require = channel ;
const items = [ getUncachedChannelPermissions ] ;
return _require ( 589 ) . useStateFromStores ( items , ( ) = > {
const items = [ outer1_8 ] ;
const first = outer1_4 ( items , 1 ) [ 0 ] ;
let canResult = null != closure_0 ;
if ( canResult ) {
canResult = first . can ( outer1_10 . MANAGE_THREADS , closure_0 ) ;
}
return canResult ;
} ) ;
} ;
export const isThreadModerator = function isThreadModerator ( arg0 ) {
let tmp = arg1 ;
if ( arg1 === undefined ) {
const items = [ getUncachedChannelPermissions ] ;
tmp = items ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const first = callback ( tmp , 1 ) [ 0 ] ;
let canResult = null != arg0 ;
if ( canResult ) {
canResult = first . can ( constants . MANAGE_THREADS , arg0 ) ;
}
return canResult ;
2026-07-20 16:05:17 +00:00
} ;
export const useCanRemoveThreadMember = function useCanRemoveThreadMember ( channelId ) {
2026-07-23 10:11:24 +00:00
const _require = channelId ;
2026-07-29 08:29:29 +00:00
let items = [ ensureGuildLoaded , getUncachedChannelPermissions , fetchFingerprint ] ;
return _require ( 589 ) . useStateFromStores ( items , ( ) = > {
2026-07-23 10:11:24 +00:00
const channel = outer1_7 . getChannel ( closure_0 ) ;
2026-07-20 16:05:17 +00:00
if ( null == channel ) {
return false ;
} else {
2026-07-23 10:11:24 +00:00
let tmp5 = channel . type === outer1_12 . PRIVATE_THREAD && channel . ownerId === tmp3 ;
2026-07-20 16:05:17 +00:00
if ( ! tmp5 ) {
2026-07-23 10:11:24 +00:00
const items = [ outer1_8 ] ;
2026-07-29 08:29:29 +00:00
const first = outer1_4 ( items , 1 ) [ 0 ] ;
let canResult = null != channel ;
if ( canResult ) {
canResult = first . can ( outer1_10 . MANAGE_THREADS , channel ) ;
}
tmp5 = canResult ;
2026-07-20 16:05:17 +00:00
}
return tmp5 ;
}
} ) ;
} ;
2026-07-29 08:29:29 +00:00
export const useHasPermissionToJoinThreadVoice = function useHasPermissionToJoinThreadVoice ( isThread ) {
const _require = isThread ;
const items = [ getUncachedChannelPermissions ] ;
let stateFromStores = _require ( 589 ) . useStateFromStores ( items , ( ) = > outer1_8 . can ( outer1_10 . CONNECT , closure_0 ) ) ;
let tmp3 = null != isThread ;
if ( tmp3 ) {
const isThreadResult = isThread . isThread ( ) ;
let isActiveThreadResult = ! isThreadResult ;
if ( isThreadResult ) {
isActiveThreadResult = isThread . isActiveThread ( ) ;
}
if ( ! isActiveThreadResult ) {
let isArchivedThreadResult = isThread . isArchivedThread ( ) ;
if ( isArchivedThreadResult ) {
const threadMetadata = isThread . threadMetadata ;
let locked ;
if ( threadMetadata != null ) {
locked = threadMetadata . locked ;
}
isArchivedThreadResult = true !== locked ;
}
if ( isArchivedThreadResult ) {
isArchivedThreadResult = tmp2 ;
}
isActiveThreadResult = isArchivedThreadResult ;
}
tmp3 = isActiveThreadResult ;
}
if ( stateFromStores ) {
stateFromStores = tmp3 ;
}
return stateFromStores ;
} ;
2026-07-20 16:05:17 +00:00
export const useCanJoinThreadVoice = function useCanJoinThreadVoice ( channel ) {
2026-08-05 07:35:12 +00:00
const tmp2 = importDefault ( 5785 ) ( ) ;
2026-07-29 08:29:29 +00:00
const _require = channel ;
let obj = _require ( 589 ) ;
const items = [ getUncachedChannelPermissions ] ;
let stateFromStores = obj . useStateFromStores ( items , ( ) = > outer1_8 . can ( outer1_10 . CONNECT , closure_0 ) ) ;
let tmp6 = null != channel ;
if ( tmp6 ) {
const isThreadResult = channel . isThread ( ) ;
let isActiveThreadResult = ! isThreadResult ;
if ( isThreadResult ) {
isActiveThreadResult = channel . isActiveThread ( ) ;
}
if ( ! isActiveThreadResult ) {
let isArchivedThreadResult = channel . isArchivedThread ( ) ;
if ( isArchivedThreadResult ) {
const threadMetadata = channel . threadMetadata ;
let locked ;
if ( threadMetadata != null ) {
locked = threadMetadata . locked ;
}
isArchivedThreadResult = true !== locked ;
}
if ( isArchivedThreadResult ) {
isArchivedThreadResult = tmp5 ;
}
isActiveThreadResult = isArchivedThreadResult ;
}
tmp6 = isActiveThreadResult ;
}
if ( stateFromStores ) {
stateFromStores = tmp6 ;
}
obj = { guildId : channel.guild_id , location : "e791ea_1" } ;
2026-07-20 16:05:17 +00:00
let enabled = importDefaultResultResult . useExperiment ( obj , { autoTrackExposure : false } ) . enabled ;
2026-08-05 07:35:12 +00:00
let tmp3Result = tmp3 ( 5786 ) ;
2026-07-29 08:29:29 +00:00
const isGameInvitesPost = tmp3Result . useIsGameInvitesPost ( channel ) ;
2026-08-05 07:35:12 +00:00
tmp3Result = tmp3 ( 4468 ) ;
2026-07-29 08:29:29 +00:00
let shouldAgeVerifyForAgeGate = tmp3Result . useShouldAgeVerifyForAgeGate ( ) ;
2026-07-20 16:05:17 +00:00
if ( shouldAgeVerifyForAgeGate ) {
2026-08-05 07:35:12 +00:00
shouldAgeVerifyForAgeGate = tmp3 ( 4468 ) . shouldShowAgeGateForChannelId ( channel . id ) ;
const tmp3Result1 = tmp3 ( 4468 ) ;
2026-07-29 08:29:29 +00:00
}
let isVocalThreadResult = ! tmp2 ;
if ( ! tmp2 ) {
isVocalThreadResult = channel . isVocalThread ( ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( isVocalThreadResult ) {
2026-07-20 16:05:17 +00:00
if ( ! enabled ) {
enabled = isGameInvitesPost ;
}
2026-07-29 08:29:29 +00:00
isVocalThreadResult = enabled ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( isVocalThreadResult ) {
isVocalThreadResult = stateFromStores ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( isVocalThreadResult ) {
isVocalThreadResult = ! shouldAgeVerifyForAgeGate ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return isVocalThreadResult ;
2026-07-20 16:05:17 +00:00
} ;
2026-07-29 08:29:29 +00:00
export const useIsNonModInLockedThread = function useIsNonModInLockedThread ( channel ) {
const _require = channel ;
let items = [ getUncachedChannelPermissions ] ;
const stateFromStores = _require ( 589 ) . useStateFromStores ( items , ( ) = > {
const items = [ outer1_8 ] ;
const first = outer1_4 ( items , 1 ) [ 0 ] ;
let canResult = null != closure_0 ;
if ( canResult ) {
canResult = first . can ( outer1_10 . MANAGE_THREADS , closure_0 ) ;
}
return canResult ;
} ) ;
const obj = _require ( 589 ) ;
return channel . isLockedThread ( ) && ! stateFromStores ;
2026-07-20 16:05:17 +00:00
} ;
2026-07-29 08:29:29 +00:00
export const isNonModInLockedThread = function isNonModInLockedThread ( isLockedThread ) {
const items = [ getUncachedChannelPermissions ] ;
const first = callback ( items , 1 ) [ 0 ] ;
let canResult = null != isLockedThread ;
if ( canResult ) {
canResult = first . can ( constants . MANAGE_THREADS , isLockedThread ) ;
}
return isLockedThread . isLockedThread ( ) && ! canResult ;
2026-07-20 16:05:17 +00:00
} ;