decord/alpha/source/modules/calls/useCanRing.tsx
github-actions 72019a2d0c chore: update source for alpha 348.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-25 08:38:05 +00:00

65 lines
2.2 KiB
TypeScript

// Module ID: 9176
// Function ID: 9177
// Name: useCanRing
// Dependencies: [502, 5585, 2044, 4476, 1074, 504, 2]
// Exports: canRingUsersInChannel, useCanRing
// Module 9176 (useCanRing)
import AuthenticationStore from "AuthenticationStore" /* 502 */;
import CallStore from "CallStore" /* 5585 */;
import ChannelStore from "ChannelStore" /* 2044 */;
import RelationshipStore from "RelationshipStore" /* 4476 */;
const require = globalThis.__r;
const require = fn;
const ChannelTypesSets = fn(1074).ChannelTypesSets;
const size = fn(2);
const result = size.fileFinishedImporting("modules/calls/useCanRing.tsx");
export const useCanRing = function useCanRing(user, selectedVoiceChannelId) {
_require = user;
dependencyMap = selectedVoiceChannelId;
const items = [ChannelStore];
const stateFromStores = require("initialize").useStateFromStores(items, () => ChannelStore.getChannel(closure_1));
const obj = require("initialize");
const items1 = [AuthenticationStore];
const stateFromStores1 = require("initialize").useStateFromStores(items1, () => AuthenticationStore.getId() === user.id);
const obj2 = require("initialize");
const items2 = [RelationshipStore];
let stateFromStores2 = require("initialize").useStateFromStores(items2, () => RelationshipStore.isFriend(user.id));
let type;
if (stateFromStores != null) {
type = stateFromStores.type;
}
let hasItem = null != type;
if (hasItem) {
const CALLABLE = ChannelTypesSets.CALLABLE;
hasItem = CALLABLE.has(type);
}
if (stateFromStores2) {
stateFromStores2 = !stateFromStores1;
}
if (stateFromStores2) {
stateFromStores2 = !user.bot;
}
if (stateFromStores2) {
stateFromStores2 = !user.system;
}
if (stateFromStores2) {
stateFromStores2 = !user.isProvisional;
}
if (stateFromStores2) {
stateFromStores2 = hasItem;
}
return stateFromStores2;
};
export const canRingUsersInChannel = function canRingUsersInChannel(channel) {
const CALLABLE = ChannelTypesSets.CALLABLE;
if (CALLABLE.has(channel.type)) {
const call = CallStore.getCall(channel.id);
return null != call && null != call.messageId && !CallStore.isCallUnavailable(channel.id);
} else {
return false;
}
};