This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,563 @@
// Metro module 6718 (f6719).
import { ChannelTypes, ChannelTypesSets, HelpdeskArticles, Permissions } from "../../Constants";
import { intl, t } from "../../intl/index.native";
import ForumPlatformUtils_native from "../forums/ForumPlatformUtils.native";
import HelpdeskUtils from "../../utils/HelpdeskUtils";
import GuildTiVPlatformUtils_native from "../text_in_voice/GuildTiVPlatformUtils.native";
const r24 = {
EMPTY_STATE: 0,
0: "EMPTY_STATE",
ADMINISTRATOR: 1,
1: "ADMINISTRATOR",
ROLE: 2,
2: "ROLE",
OWNER: 3,
3: "OWNER",
MEMBER: 4,
4: "MEMBER",
USER: 5,
5: "USER",
GUILD: 6,
6: "GUILD"
};
const r34 = {
ROLES: 0,
0: "ROLES",
MEMBERS: 1,
1: "MEMBERS",
USERS: 2,
2: "USERS",
GUILDS: 3,
3: "GUILDS"
};
const r39 = {
SETTINGS_PAGE: "settings-page",
MEMBERS_LIST: "members-list",
EMPTY_STATE: "empty-state",
CREATE_CHANNEL: "create-channel"
};
const r44 = {
BASIC: "basic",
ADVANCED: "advanced"
};
export { r24 as RowType };
export { r34 as AudienceSelectorSections };
export const MEMBER_REQUEST_COUNT = 20;
export const ADVANCED_MODE_ON_KEY = "channelPermissionSettingsAdvancedModeOn";
export { r39 as TrackExposureLocations };
export { r44 as SettingMode };
export function getChannelPermissionSpecMap(a0, a1, a2) {
let r49, r172, r182, r546, r659, r669, r707, r717, r739, r749, r771, r781, r798, r808, r825, r835, r910, r920, r942, r952, r1015, r1025, r1047, r1057, r1075, r1085, r1159, r1250, DlIVcN, S31soU, XcrieN, XmoyRD, amZ5vn, bcuobK, bgIY3H, description, description3, description4, description6, description7, description8, fUYPly, iXhS6R, maNzCO;
const type = a0.type;
const r4 = Permissions.VIEW_CHANNEL.toString();
const title = type === ChannelTypes.GUILD_CATEGORY ? intl.string(t.uV83yi) : intl.string(t["W/A4Qp"]);
L14: {
r49 = {
title,
description: null,
flag: null
};
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
if (a1) {
if (GUILD_CATEGORY === type) {
description = t["o/vBzj"];
} else {
if (ChannelTypes.GUILD_VOICE !== type && ChannelTypes.GUILD_STAGE_VOICE !== type) {
description = t["3jG0Bo"];
break L14;
}
description = t.ejL1Wo;
}
} else {
description = type === GUILD_CATEGORY ? t.SzosGs : t.M2iEy3;
}
}
const r74 = {};
r49.description = description;
r49.flag = Permissions.VIEW_CHANNEL;
r74[r4] = r49;
r74[Permissions.MANAGE_CHANNELS.toString()] = {
title: type === ChannelTypes.GUILD_CATEGORY ? intl.string(t["9qLtWs"]) : intl.string(t.nAw15L),
description: ChannelTypes.GUILD_CATEGORY === type ? t.KJ2JnG : ChannelTypes.GUILD_VOICE === type ? t["+gl2ne"] : ChannelTypes.GUILD_STAGE_VOICE === type ? t.SDX669 : t.ydL28i,
flag: Permissions.MANAGE_CHANNELS
};
r74[Permissions.MANAGE_ROLES.toString()] = {
title: intl.string(t.ICb6am),
description: ChannelTypes.GUILD_CATEGORY === type ? t.TyyCMD : ChannelTypes.GUILD_STAGE_VOICE === type ? t.hcw4mx : t.hOMXOv,
flag: Permissions.MANAGE_ROLES
};
const r150 = Permissions.MANAGE_WEBHOOKS.toString();
const r160 = {
title: intl.string(t["/ADKmM"]),
description: null,
flag: null
};
const description2 = type === ChannelTypes.GUILD_CATEGORY ? t["K5+ZZ7"] : t.CYBZry;
L38: {
r160.description = description2;
r160.flag = Permissions.MANAGE_WEBHOOKS;
r74[r150] = r160;
r172 = Permissions.CREATE_INSTANT_INVITE.toString();
r182 = {
title: intl.string(t.zJrgTG),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
description3 = t["3YFAAX"];
} else {
if (ChannelTypes.GUILD_VOICE !== type && ChannelTypes.GUILD_STAGE_VOICE !== type) {
description3 = t.q4g2aI;
break L38;
}
description3 = t.lUCs1n;
}
}
r182.description = description3;
r182.flag = Permissions.CREATE_INSTANT_INVITE;
r74[r172] = r182;
r74[Permissions.SEND_MESSAGES.toString()] = {
title: ChannelTypesSets.GUILD_THREADS_ONLY.has(type) ? intl.string(t.nJwAHX) : type === ChannelTypes.GUILD_CATEGORY ? intl.string(t.S1VOwd) : intl.string(t.T32rkC),
description: ChannelTypes.GUILD_CATEGORY === type ? t.IjeLuu : ChannelTypes.GUILD_FORUM === type ? a2?.createPostsDisabled && !a0.isMediaChannel() ? ForumPlatformUtils_native.getForumChannelPermissionText() : t.LG9VAi : ChannelTypes.GUILD_MEDIA === type ? t.LG9VAi : ChannelTypes.GUILD_ANNOUNCEMENT === type ? intl.format(t.WFwfSD, {
articleURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.ANNOUNCEMENT_CHANNELS)
}) : ChannelTypes.GUILD_VOICE === type ? GuildTiVPlatformUtils_native.getTextInVoiceSendMessageChannelPermissionText(a2?.sendMessagesDisabled) : t.WQ6zpT,
flag: Permissions.SEND_MESSAGES
};
r74[Permissions.EMBED_LINKS.toString()] = {
title: intl.string(t["969dEL"]),
description: type === ChannelTypes.GUILD_CATEGORY ? t["7zlUay"] : t.XFFhA0,
flag: Permissions.EMBED_LINKS
};
r74[Permissions.ATTACH_FILES.toString()] = {
title: intl.string(t["3AS4UM"]),
description: type === ChannelTypes.GUILD_CATEGORY ? t.XREf9l : t.WK9r7F,
flag: Permissions.ATTACH_FILES
};
r74[Permissions.ADD_REACTIONS.toString()] = {
title: intl.string(t.yEoJAr),
description: ChannelTypes.GUILD_CATEGORY === type ? t.pZT2Zh : ChannelTypes.GUILD_VOICE === type ? t.xSSbIs : t.PVjR1Y,
flag: Permissions.ADD_REACTIONS
};
r74[Permissions.USE_EXTERNAL_EMOJIS.toString()] = {
title: intl.string(t["+bxf3H"]),
description: type === ChannelTypes.GUILD_CATEGORY ? t.mWAbK4 : t.Qc5vOr,
flag: Permissions.USE_EXTERNAL_EMOJIS
};
r74[Permissions.USE_EXTERNAL_STICKERS.toString()] = {
title: intl.string(t.ERNhYf),
description: type === ChannelTypes.GUILD_CATEGORY ? t["39whJ4"] : t.VF4fZZ,
flag: Permissions.USE_EXTERNAL_STICKERS
};
r74[Permissions.MENTION_EVERYONE.toString()] = {
title: type === ChannelTypes.GUILD_STAGE_VOICE ? intl.string(t.VDUAHO) : intl.string(t.Y78KGC),
description: type === ChannelTypes.GUILD_CATEGORY ? t["HOhg/B"] : type === ChannelTypes.GUILD_STAGE_VOICE ? t.rZn1oO : t["6IUSdt"],
flag: Permissions.MENTION_EVERYONE
};
r74[Permissions.MANAGE_MESSAGES.toString()] = {
title: intl.string(t["6lU9xM"]),
description: ChannelTypes.GUILD_CATEGORY === type ? t["5R9nYh"] : ChannelTypes.GUILD_ANNOUNCEMENT === type ? intl.format(t.XRxOo0, {
articleURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.ANNOUNCEMENT_CHANNELS)
}) : t["SeA+G9"],
flag: Permissions.MANAGE_MESSAGES
};
r74[Permissions.PIN_MESSAGES.toString()] = {
title: intl.string(t.Y5BI39),
description: type === ChannelTypes.GUILD_CATEGORY ? t.gmbD87 : t["0l2EjL"],
flag: Permissions.PIN_MESSAGES
};
r74[Permissions.BYPASS_SLOWMODE.toString()] = {
title: intl.string(t.kqcjeV),
description: type === ChannelTypes.GUILD_CATEGORY ? t.C4t1Xu : t.Ha1xbw,
flag: Permissions.BYPASS_SLOWMODE
};
r74[Permissions.MANAGE_OFFICIAL_MESSAGES.toString()] = {
title: intl.string(t.Aj9ruN),
description: type === ChannelTypes.GUILD_CATEGORY ? t["Pf0e/Q"] : t.qEbw4W,
flag: Permissions.MANAGE_OFFICIAL_MESSAGES
};
const r532 = Permissions.READ_MESSAGE_HISTORY.toString();
const title2 = ChannelTypesSets.GUILD_THREADS_ONLY.has(type) ? intl.string(t["0RQwtn"]) : intl.string(t.l9ufaR);
L116: {
r546 = {
title: title2,
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
description4 = t["cJRv/g"];
} else if (ChannelTypes.GUILD_VOICE === type) {
description4 = GuildTiVPlatformUtils_native.getTextInVoiceReadMessageHistoryChannelPermissionText(a2?.readMessageHistoryDisabled);
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
description4 = t.cuMfH0;
break L116;
}
description4 = t.RqCc7i;
}
}
r546.description = description4;
r546.flag = Permissions.READ_MESSAGE_HISTORY;
r74[r532] = r546;
r74[Permissions.SEND_TTS_MESSAGES.toString()] = {
title: intl.string(t.mMbwh7),
description: type === ChannelTypes.GUILD_CATEGORY ? t.b7pc9U : t.CpakGz,
flag: Permissions.SEND_TTS_MESSAGES
};
r74[Permissions.USE_APPLICATION_COMMANDS.toString()] = {
title: intl.string(t.nkoPOt),
description: type === ChannelTypes.GUILD_CATEGORY ? t["D+qW0J"] : t.ReG3gG,
flag: Permissions.USE_APPLICATION_COMMANDS
};
r74[Permissions.SEND_VOICE_MESSAGES.toString()] = {
title: intl.string(t.WlWSBT),
description: type === ChannelTypes.GUILD_CATEGORY ? t.gavGfv : t.BhEo9V,
flag: Permissions.SEND_VOICE_MESSAGES
};
const r637 = Permissions.SEND_POLLS.toString();
const r647 = {
title: intl.string(t.UMQ7Ww),
description: null,
flag: null
};
const description5 = type === ChannelTypes.GUILD_CATEGORY ? t["18Ya7L"] : t.ckKKIO;
L147: {
r647.description = description5;
r647.flag = Permissions.SEND_POLLS;
r74[r637] = r647;
r659 = Permissions.CONNECT.toString();
r669 = {
title: intl.string(t.S0W8Z5),
description: null,
flag: null
};
const GUILD_CATEGORY2 = ChannelTypes.GUILD_CATEGORY;
if (a1) {
if (GUILD_CATEGORY2 === type) {
XcrieN = t.XcrieN;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
XcrieN = t.SOFNhP;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
XcrieN = t.j4AyO8;
break L147;
}
XcrieN = t.LsS8xT;
}
} else if (GUILD_CATEGORY2 === type) {
XcrieN = t.stA0Hl;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
XcrieN = t["G9+Qie"];
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
XcrieN = t.HvG8uR;
break L147;
}
XcrieN = t["QU/Rw8"];
}
}
L156: {
r669.description = XcrieN;
r669.flag = Permissions.CONNECT;
r74[r659] = r669;
r707 = Permissions.SPEAK.toString();
r717 = {
title: intl.string(t["8w1tIR"]),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
iXhS6R = t.iXhS6R;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
iXhS6R = t.a8n741;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
iXhS6R = t["568E6d"];
break L156;
}
iXhS6R = t["+VXsJI"];
}
}
L165: {
r717.description = iXhS6R;
r717.flag = Permissions.SPEAK;
r74[r707] = r717;
r739 = Permissions.STREAM.toString();
r749 = {
title: intl.string(t.FlNoSV),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
description6 = t["ryG0/J"];
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
if (ChannelTypes.GUILD_STAGE_VOICE === type) {
description6 = t.swJcN6;
break L165;
}
description6 = t.RY8rIc;
break L165;
}
description6 = t.AuEQEC;
}
}
L171: {
r749.description = description6;
r749.flag = Permissions.STREAM;
r74[r739] = r749;
r771 = Permissions.USE_EMBEDDED_ACTIVITIES.toString();
r781 = {
title: intl.string(t.rLSGeh),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
maNzCO = t.maNzCO;
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
maNzCO = t.qinvMU;
break L171;
}
maNzCO = t.RyEwla;
}
}
L177: {
r781.description = maNzCO;
r781.flag = Permissions.USE_EMBEDDED_ACTIVITIES;
r74[r771] = r781;
r798 = Permissions.USE_EXTERNAL_APPS.toString();
r808 = {
title: intl.string(t["3TzAk0"]),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
bgIY3H = t.bgIY3H;
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
bgIY3H = t.czqMLp;
break L177;
}
bgIY3H = t.qPUPip;
}
}
L184: {
r808.description = bgIY3H;
r808.flag = Permissions.USE_EXTERNAL_APPS;
r74[r798] = r808;
r825 = Permissions.USE_SOUNDBOARD.toString();
r835 = {
title: intl.string(t.Bco7NG),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
description7 = intl.format(t["0kBp/0"], {
helpCenterArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.SOUNDBOARD)
});
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
description7 = intl.format(t.GEi6Ym, {
helpCenterArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.SOUNDBOARD)
});
break L184;
}
description7 = intl.format(t["6eYqU1"], {
helpCenterArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.SOUNDBOARD)
});
}
}
L193: {
r835.description = description7;
r835.flag = Permissions.USE_SOUNDBOARD;
r74[r825] = r835;
r74[Permissions.USE_EXTERNAL_SOUNDS.toString()] = {
title: intl.string(t.pwaVJ6),
description: t.qDpPtX,
flag: Permissions.USE_EXTERNAL_SOUNDS
};
r910 = Permissions.USE_VAD.toString();
r920 = {
title: intl.string(t["08zAV7"]),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
fUYPly = t.fUYPly;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
fUYPly = t.BJKqsW;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
fUYPly = t.s2eihY;
break L193;
}
fUYPly = t["3GJwsc"];
}
}
L200: {
r920.description = fUYPly;
r920.flag = Permissions.USE_VAD;
r74[r910] = r920;
r942 = Permissions.PRIORITY_SPEAKER.toString();
r952 = {
title: intl.string(t.BVK71i),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
description8 = intl.format(t.g5MzON, {
keybind: intl.string(t.DkSwJ2)
});
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
description8 = intl.format(t.Ij0yKX, {
keybind: intl.string(t.DkSwJ2)
});
break L200;
}
description8 = intl.format(t["4nbjL0"], {
keybind: intl.string(t.DkSwJ2)
});
}
}
L209: {
r952.description = description8;
r952.flag = Permissions.PRIORITY_SPEAKER;
r74[r942] = r952;
r1015 = Permissions.MUTE_MEMBERS.toString();
r1025 = {
title: intl.string(t["8EI30/"]),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
bcuobK = t.bcuobK;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
bcuobK = t.EbvdH9;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
bcuobK = t.LW5C9P;
break L209;
}
bcuobK = t.KYDG2K;
}
}
L216: {
r1025.description = bcuobK;
r1025.flag = Permissions.MUTE_MEMBERS;
r74[r1015] = r1025;
r1047 = Permissions.DEAFEN_MEMBERS.toString();
r1057 = {
title: intl.string(t["9L47Fr"]),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
amZ5vn = t.amZ5vn;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
amZ5vn = t.UAdIxo;
break L216;
}
amZ5vn = t["d+i1nX"];
}
}
L225: {
r1057.description = amZ5vn;
r1057.flag = Permissions.DEAFEN_MEMBERS;
r74[r1047] = r1057;
r1075 = Permissions.MOVE_MEMBERS.toString();
r1085 = {
title: intl.string(t.YtjJPQ),
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
XmoyRD = t.XmoyRD;
} else if (ChannelTypes.GUILD_STAGE_VOICE === type) {
XmoyRD = t.bizKz6;
} else {
if (ChannelTypes.GUILD_TEXT !== type && ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
XmoyRD = t.nSD1ah;
break L225;
}
XmoyRD = t.cbdQy2;
}
}
r1085.description = XmoyRD;
r1085.flag = Permissions.MOVE_MEMBERS;
r74[r1075] = r1085;
r74[Permissions.REQUEST_TO_SPEAK.toString()] = {
title: intl.string(t["5kicT2"]),
description: type === ChannelTypes.GUILD_CATEGORY ? t.T1lMSl : t.uzlYFE,
flag: Permissions.REQUEST_TO_SPEAK
};
const r1129 = Permissions.MANAGE_THREADS.toString();
const title3 = ChannelTypesSets.GUILD_THREADS_ONLY.has(type) ? intl.string(t.ossiZD) : type === ChannelTypes.GUILD_CATEGORY ? intl.string(t.QKe7Q3) : intl.string(t.kEqgr7);
L240: {
r1159 = {
title: title3,
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
S31soU = t.S31soU;
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
S31soU = t.yvan0j;
break L240;
}
S31soU = t["XLi/jG"];
}
}
r1159.description = S31soU;
r1159.flag = Permissions.MANAGE_THREADS;
r74[r1129] = r1159;
r74[Permissions.CREATE_PUBLIC_THREADS.toString()] = {
title: intl.string(t["25rKnX"]),
description: type === ChannelTypes.GUILD_CATEGORY ? t["+M1yLj"] : t["5SDtGB"],
flag: Permissions.CREATE_PUBLIC_THREADS
};
r74[Permissions.CREATE_PRIVATE_THREADS.toString()] = {
title: intl.string(t.QwbTSa),
description: type === ChannelTypes.GUILD_CATEGORY ? t["hBS/zn"] : t.Chg2zd,
flag: Permissions.CREATE_PRIVATE_THREADS
};
const r1220 = Permissions.SEND_MESSAGES_IN_THREADS.toString();
const title4 = ChannelTypesSets.GUILD_THREADS_ONLY.has(type) ? intl.string(t.fqhqWm) : type === ChannelTypes.GUILD_CATEGORY ? intl.string(t["5QlVGy"]) : intl.string(t.fTE74g);
L258: {
r1250 = {
title: title4,
description: null,
flag: null
};
if (ChannelTypes.GUILD_CATEGORY === type) {
DlIVcN = t.DlIVcN;
} else {
if (ChannelTypes.GUILD_FORUM !== type && ChannelTypes.GUILD_MEDIA !== type) {
DlIVcN = t.xHO6Me;
break L258;
}
DlIVcN = t.XTnrPH;
}
}
r1250.description = DlIVcN;
r1250.flag = Permissions.SEND_MESSAGES_IN_THREADS;
r74[r1220] = r1250;
r74[Permissions.MANAGE_EVENTS.toString()] = {
title: intl.string(t.HIgA5a),
description: type === ChannelTypes.GUILD_CATEGORY ? t.CP2sz4 : t["4pO/TY"],
flag: Permissions.MANAGE_EVENTS
};
r74[Permissions.CREATE_EVENTS.toString()] = {
title: intl.string(t.qyjZua),
description: type === ChannelTypes.GUILD_CATEGORY ? t.XpibmC : t.sPoBLa,
flag: Permissions.CREATE_EVENTS
};
r74[Permissions.SET_VOICE_CHANNEL_STATUS.toString()] = {
title: intl.string(t.VBwkUf),
description: a2?.enableHangoutWindow ? t.CYcJ6H : t.C6BzXx,
flag: Permissions.SET_VOICE_CHANNEL_STATUS
};
return r74;
}
@@ -0,0 +1,486 @@
// Metro module 8277 (f8278).
import { isGuildVocalChannelType } from "../../records/ChannelRecord";
import { isGuildOwner } from "../../records/GuildRecord";
import { hasPermission, isEveryoneRole } from "../../records/GuildRoleRecord";
import GuildMemberStore from "../../stores/GuildMemberStore";
import UserStore from "../../stores/UserStore";
import { RowType } from "./ChannelPermissionsConstants";
import { Permissions, DEFAULT_ROLE_COLOR_HEX, ChannelTypes } from "../../Constants";
import { compareGuildRoles } from "../../utils/GuildRoleUtils";
import { intl, t } from "../../intl/index.native";
import { has, remove, add } from "../../_bundle/HighLow";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import UserUtils from "../../utils/UserUtils";
import { isNotNullish } from "../../utils/GlobalUtils";
import { makeEveryoneOverwrite, NONE } from "../../utils/PermissionUtils";
import { updatePermission, savePermissionUpdates } from "../../actions/ChannelSettingsPermissionsActionCreators";
import { PermissionOverwriteType } from "../../flow/Server";
import { permissionOverwriteForRole, permissionOverwriteForUser } from "../../utils/ChannelUtils";
function $mk80289($env) {
return (a0) => {
const r5 = $env.$parent;
let r14 = (0, r5[6])(a0, r5[11].ADMINISTRATOR);
if (!r14) {
const r15 = $env;
const r9 = r15[0];
const id = a0.id;
const r12 = r15[1];
const r10 = r15[2];
const currentUser = r5[9].getCurrentUser();
const r3 = currentUser == null;
let r1 = false;
if (!r3) {
if (r9 == null) {
r1 = currentUser.id !== id;
} else {
let r19 = r9.permissionOverwrites[id];
if ((r10 == null ? void 0 : r10[id]) != null) {
r19 = r10[id];
}
r1 = r19 == null || !(0, r5[2])(r5[3][9]).has(r19.allow, r12);
}
}
r14 = r1 ? !r1 : !(0, r5[7])(a0);
}
return r14;
};
}
function $mk80290($env) {
return (a0) => {
const r5 = $env;
const r7 = $env.$parent;
let r15 = (0, r7[6])(a0, r7[11].ADMINISTRATOR);
if (!r15) {
const r10 = r5[0];
const id = a0.id;
const r13 = r5[1];
const r11 = r5[2];
const currentUser = r7[9].getCurrentUser();
const r3 = currentUser == null;
let r1 = false;
if (!r3) {
if (r10 == null) {
r1 = currentUser.id !== id;
} else {
let r19 = r10.permissionOverwrites[id];
if ((r11 == null ? void 0 : r11[id]) != null) {
r19 = r11[id];
}
r1 = r19 == null || !(0, r7[2])(r7[3][9]).has(r19.allow, r13);
}
}
r15 = r1 ? !r1 : !(0, r7[7])(a0);
}
if (!r15) {
const r34 = r7[2];
const r35 = r7[3];
r15 = r34(r35[9]).has(r34(r35[9]).combine(a0.permissions, r5[0].permissionOverwrites[a0.id]?.allow), r5[1]);
}
return r15;
};
}
function $mk80291($env) {
return (a0) => {
const r6 = $env;
const r5 = $env.$parent;
const r9 = r6[0];
const id = a0.id;
const r12 = r6[2];
const r10 = r6[3];
const currentUser = r5[9].getCurrentUser();
const r2 = currentUser == null;
let r0 = false;
if (!r2) {
if (r9 == null) {
r0 = currentUser.id !== id;
} else {
let r15 = r9.permissionOverwrites[id];
if ((r10 == null ? void 0 : r10[id]) != null) {
r15 = r10[id];
}
r0 = r15 == null || !(0, r5[2])(r5[3][9]).has(r15.allow, r12);
}
}
return r0 ? (0, r5[5])(r6[1], a0) : !r0;
};
}
let sortRoles, getMemberRowData, sortMembers;
let env5272 = {};
export function getRoleRowData(a0, r5 = false) {
const rowType = hasPermission(a0, Permissions.ADMINISTRATOR) ? RowType.ADMINISTRATOR : RowType.ROLE;
let colorString = a0.colorString;
if (colorString == null) {
colorString = DEFAULT_ROLE_COLOR_HEX;
}
return {
rowType,
colorString,
name: a0.name,
id: a0.id,
disabled: hasPermission(a0, Permissions.ADMINISTRATOR) || r5,
key: `${rowType}:${a0.id}`,
tags: a0.tags
};
}
sortRoles = function sortRoles(a0, a1) {
const hasPermission2 = hasPermission(a0, Permissions.ADMINISTRATOR);
let r0 = 1;
const r1 = hasPermission2 ? 0 : 1;
if (hasPermission(a1, Permissions.ADMINISTRATOR)) {
r0 = 0;
}
return r1 !== r0 ? r1 - r0 : compareGuildRoles(a0, a1);
};
getMemberRowData = function getMemberRowData(a0, a1) {
const rowType = isGuildOwner(a1, a0) ? RowType.OWNER : RowType.MEMBER;
let name = GuildMemberStore.getNick(a1.id, a0.id);
if (name == null) {
name = UserUtils.getName(a0);
}
return {
rowType,
name,
username: UserUtils.getUserTag(a0),
id: a0.id,
avatarURL: a0.getAvatarURL(a1.id, 24),
bot: a0.bot,
verifiedBot: a0.isVerifiedBot(),
disabled: isGuildOwner(a1, a0),
key: `${rowType}:${a0.id}`
};
};
sortMembers = function sortMembers(a0, a1) {
return a0.rowType !== a1.rowType ? a0.rowType - a1.rowType : a0.name.toLocaleLowerCase().localeCompare(a1.name.toLocaleLowerCase());
};
export { sortRoles };
export function getNoRolesRow(name = intl.string(t["gnsna/"])) {
return [{
rowType: RowType.EMPTY_STATE,
colorString: DEFAULT_ROLE_COLOR_HEX,
name,
disabled: true,
id: "EMPTY_STATE"
}];
}
export function isEveryoneRoleId(a0, a1) {
return SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(a0) === a1;
}
export function getRolesRows(a0, a1, c16444_0, c16444_1, r3 = () => true) {
let c16444_2;
c16444_2 = r3;
return a1.filter((item) => {
const r15 = (0, hasPermission)(item, Permissions.ADMINISTRATOR);
let r16 = !r15;
if (!r15) {
const id = item.id;
const currentUser = UserStore.getCurrentUser();
const r3 = currentUser == null;
let r1 = false;
if (!r3) {
if (c16444_0 == null) {
r1 = currentUser.id !== id;
} else {
const r20 = c16444_0.permissionOverwrites[id];
r1 = r20 == null || !has(r20.allow, c16444_1);
}
}
r16 = r1;
}
if (r16) {
r16 = !(0, isEveryoneRole)(item);
}
if (r16) {
r16 = c16444_2(item.name);
}
return r16;
}).sort(sortRoles).map((item) => getRoleRowData(item));
}
export function getRolesRowsWithPermissionDisabled(a0, a1, c16445_0, c16445_1, r3 = () => true) {
let c16445_2;
c16445_2 = r3;
return a1.filter((item) => {
const r15 = (0, hasPermission)(item, Permissions.ADMINISTRATOR);
let r16 = !r15;
if (!r15) {
const id = item.id;
const currentUser = UserStore.getCurrentUser();
const r3 = currentUser == null;
let r1 = false;
if (!r3) {
if (c16445_0 == null) {
r1 = currentUser.id !== id;
} else {
const r20 = c16445_0.permissionOverwrites[id];
r1 = r20 == null || !has(r20.allow, c16445_1);
}
}
r16 = r1;
}
if (r16) {
r16 = !(0, isEveryoneRole)(item);
}
if (r16) {
r16 = c16445_2(item.name);
}
return r16;
}).sort(sortRoles).map((item) => getRoleRowData(item, (0, hasPermission)(item, c16445_1)));
}
export function getExistingRoles(a0, a1, a2, a3, a4) {
let env16441;
const r0 = env16441 = {
$parent: env5272
};
env16441[0] = a2;
env16441[1] = a3;
env16441[2] = a4;
return a1.filter($mk80289(r0));
}
export function getAllExistingRolesWithPermission(a0, a1, a2, a3, a4) {
let env16442;
const r0 = env16442 = {
$parent: env5272
};
env16442[0] = a2;
env16442[1] = a3;
env16442[2] = a4;
return a1.filter($mk80290(r0));
}
export function getExistingRolesRows(a0, a1, a2, a3, a4) {
let env16446;
const r2 = env16446 = {
$parent: env5272
};
env16446[0] = a2;
env16446[1] = a3;
env16446[2] = a4;
let r19 = a1.filter($mk80289(r2)).sort(sortRoles).map((item) => getRoleRowData(item));
if (r19.length === 0) {
let name = intl.string(t.nZfHsf);
if (name === void 0) {
name = intl.string(t["gnsna/"]);
}
r19 = [{
rowType: RowType.EMPTY_STATE,
colorString: DEFAULT_ROLE_COLOR_HEX,
name,
disabled: true,
id: "EMPTY_STATE"
}];
}
return r19;
}
export function getExistingRolesRowWithPermissionDisabled(a0, a1, a2, a3, a4) {
let env16448;
const r3 = env16448 = {
$parent: env5272
};
env16448[0] = a2;
env16448[1] = a3;
env16448[2] = a4;
let r18 = a1.filter($mk80290(r3)).sort(sortRoles).map((item) => getRoleRowData(item, (0, hasPermission)(item, a3)));
if (r18.length === 0) {
let name = intl.string(t.nZfHsf);
if (name === void 0) {
name = intl.string(t["gnsna/"]);
}
r18 = [{
rowType: RowType.EMPTY_STATE,
colorString: DEFAULT_ROLE_COLOR_HEX,
name,
disabled: true,
id: "EMPTY_STATE"
}];
}
return r18;
}
export function getMembersRows(a0, c16449_0, c16449_1, c16449_2, r3 = () => true) {
let c16449_3;
c16449_3 = r3;
return a0.map(UserStore.getUser).filter(isNotNullish).filter((item) => {
const isGuildOwner2 = isGuildOwner(c16449_1, item);
let r15 = !isGuildOwner2;
if (!isGuildOwner2) {
const id = item.id;
const currentUser = UserStore.getCurrentUser();
const r3 = currentUser == null;
let r1 = false;
if (!r3) {
if (c16449_0 == null) {
r1 = currentUser.id !== id;
} else {
const r19 = c16449_0.permissionOverwrites[id];
r1 = r19 == null || !has(r19.allow, c16449_2);
}
}
r15 = r1;
}
if (r15) {
let r33 = GuildMemberStore.getNick(c16449_1.id, item.id);
if (r33 == null) {
r33 = UserUtils.getName(item);
}
r15 = c16449_3(r33) || c16449_3(item.username) || c16449_3(item.discriminator);
}
return r15;
}).map((item) => getMemberRowData(item, c16449_1)).sort(sortMembers);
}
export function getExistingMembers(a0, a1, a2, a3, a4) {
let env16443;
const r1 = env16443 = {
$parent: env5272
};
env16443[0] = a1;
env16443[1] = a2;
env16443[2] = a3;
env16443[3] = a4;
return a0.map(UserStore.getUser).filter(isNotNullish).filter($mk80291(r1));
}
export function getExistingMembersRows(a0, a1, a2, a3, a4) {
let env16451;
const r3 = env16451 = {
$parent: env5272
};
env16451[0] = a1;
env16451[1] = a2;
env16451[2] = a3;
env16451[3] = a4;
return a0.map(UserStore.getUser).filter(isNotNullish).filter($mk80291(r3)).map((item) => getMemberRowData(item, a2)).sort(sortMembers);
}
export function getRowTypeLabel(a0, a1) {
if (RowType.ROLE === a0) {
return intl.string(t.ZxoFOG);
}
if (RowType.OWNER === a0) {
return intl.string(t.NWhYJg);
}
if (RowType.ADMINISTRATOR === a0) {
return intl.string(t["dwlcc+"]);
}
if (RowType.MEMBER === a0) {
return a1 ? intl.string(t.UAJxZi) : null;
}
if (RowType.USER === a0) {
return intl.string(t.KD6OJJ);
}
if (RowType.GUILD === a0) {
return intl.string(t["5qyruI"]);
}
if (RowType.EMPTY_STATE === a0) {
return null;
}
}
export function getRemoveTooltipHint(a0) {
if (RowType.ROLE === a0) {
return intl.string(t["Gzc/a8"]);
}
if (RowType.OWNER === a0) {
return intl.string(t.icuNBM);
}
if (RowType.ADMINISTRATOR === a0) {
return intl.string(t.eTmN5a);
}
if (RowType.MEMBER === a0) {
return intl.string(t["Gzc/a8"]);
}
RowType.EMPTY_STATE;
return null;
}
export function flipEveryonePermission(a0, a1, a2) {
let r11 = a0.permissionOverwrites[a0.guild_id];
if (r11 == null) {
r11 = makeEveryoneOverwrite(a0.guild_id);
}
const r20 = {
...r11
};
r20.deny = remove(r20.deny, a1);
r20.allow = remove(r20.allow, a1);
if (!a2) {
r20.deny = add(r20.deny, a1);
}
return r20;
}
export function toggleChannelEveryonePermission(a0, a1, a2) {
let r16 = a0.permissionOverwrites[a0.guild_id];
if (r16 == null) {
r16 = makeEveryoneOverwrite(a0.guild_id);
}
const r23 = {
...r16
};
r23.deny = remove(r23.deny, a1);
r23.allow = remove(r23.allow, a1);
if (!a2) {
r23.deny = add(r23.deny, a1);
}
updatePermission(a0, r23.id, r23.allow, r23.deny);
}
export function grantUserChannelAccess(a0, a1) {
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
const r19 = a0.permissionOverwrites[currentUser.id];
if (r19 == null) {
return savePermissionUpdates(a0.id, [{
id: currentUser.id,
type: PermissionOverwriteType.MEMBER,
allow: add(NONE, a1),
deny: NONE
}], true);
}
const { allow, deny } = r19;
return updatePermission(a0, r19.id, add(allow, a1), deny);
}
}
export function isPrivateGuildChannel(a0, a1) {
if (a0 == null) {
return false;
}
let r8 = a0.permissionOverwrites[a0.guild_id];
if ((a1 == null ? void 0 : a1[a0.guild_id]) != null) {
r8 = a1[a0.guild_id];
}
return r8 != null && has(r8.deny, a0.accessPermissions);
}
export function isPrivateTextChannel(a0) {
const r6 = a0.permissionOverwrites[a0.guild_id];
return r6 != null && a0.type === ChannelTypes.GUILD_TEXT && has(r6.deny, Permissions.VIEW_CHANNEL);
}
export function canCreatePrivateChannel(a0, a1, a2) {
const GUILD_TEXT = ChannelTypes.GUILD_TEXT;
let r1 = a1;
if (a0 !== GUILD_TEXT) {
const GUILD_ANNOUNCEMENT = ChannelTypes.GUILD_ANNOUNCEMENT;
r1 = a1;
if (a0 !== GUILD_ANNOUNCEMENT) {
const r9 = (0, isGuildVocalChannelType)(a0);
r1 = (r9 ? !r9 : a0 !== ChannelTypes.GUILD_CATEGORY) || (a1 ? a2 : a1);
}
}
return r1;
}
export function getPrivateChannelHintText(a0) {
if (ChannelTypes.GUILD_TEXT !== a0 && ChannelTypes.GUILD_ANNOUNCEMENT !== a0) {
if (ChannelTypes.GUILD_VOICE === a0) {
return intl.format(t.iZAMty, {});
}
if (ChannelTypes.GUILD_CATEGORY === a0) {
return intl.format(t.PhnARV, {});
}
return null;
}
return intl.format(t.ZDtA0T, {});
}
export function extractPermissionOverwrites(a0, c16452_0) {
const r5 = [];
let c16452_1 = r5;
Object.values(a0).forEach(({ row }) => {
if (row.id != null && row.id !== "") {
if (row.rowType === RowType.ROLE) {
c16452_1.push(permissionOverwriteForRole(row.id, c16452_0));
} else if (row.rowType === RowType.MEMBER) {
c16452_1.push(permissionOverwriteForUser(row.id, c16452_0));
}
}
});
return r5;
}
@@ -0,0 +1,22 @@
// Metro module 10918 (f10919).
import { AnalyticEvents } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
export function openAddMembersActionSheet(a0, canSkip = false) {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Grant Channel Access"
});
ActionSheetActionCreators.openLazy(import("./action_sheets/AddMembersActionSheet"), `channel-add-members-${a0.id}`, {
channel: a0,
canSkip
});
}
export function openChannelMembersActionSheet(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Manage Channel Access"
});
ActionSheetActionCreators.openLazy(import("./action_sheets/ChannelMembersActionSheet"), `channel-members-${a0}`, {
channelId: a0,
guildId: a1
});
}
@@ -0,0 +1,509 @@
// Metro module 8284 (f8285).
import _objectWithoutProperties from "../../../../_bundle/_objectWithoutProperties";
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useEffect } from "react";
import { ScrollView, View } from "react-native";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../../stores/GuildRoleStore";
import GuildStore from "../../../../stores/GuildStore";
import UserStore from "../../../../stores/UserStore";
import { MEMBER_REQUEST_COUNT, RowType } from "../../ChannelPermissionsConstants";
import { Permissions } from "../../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { NONE, canEveryoneRole } from "../../../../utils/PermissionUtils";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import RegexUtils from "../../../../utils/RegexUtils";
import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/Module589";
import { getRolesRows, getNoRolesRow, getMembersRows } from "../../ChannelPermissionsUtils";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import { intl, t } from "../../../../intl/index.native";
import { HelpMessage, HelpMessageTypes, EmptyState, Avatar } from "../../../../design/void/native";
import { Text } from "../../../../design/components/Text/native/Text";
import { ChannelOverwritesCheckboxItem } from "../components/ChannelOverwritesItem";
import { BottomSheetScrollView } from "../../../../_bundle/Module5245";
import { BottomSheetFlashList, FlashList } from "../../../../_bundle/noop_6676";
import TagListInput_native from "../../../../design/components/TagListInput/native/TagListInput.native";
import GuildUtils from "../../../../utils/GuildUtils";
import { NoResultsAlt } from "../../../../design/components/Illustration/native/redesign/generated/NoResultsAlt";
import useChannelName from "../../../channel/useChannelName";
import { permissionOverwriteForRole, permissionOverwriteForUser } from "../../../../utils/ChannelUtils";
import { savePermissionUpdates } from "../../../../actions/ChannelSettingsPermissionsActionCreators";
import { memberOrRoleAddedToast } from "../../../toast/native/ToastUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { HermesBuiltin } from "../../../../_hermes/prelude";
let AddMembersBody, useStyles;
let env5279 = {};
const _toPropertyKey = function _toPropertyKey(a0) {
let r2 = a0;
if (typeof a0 === "object") {
r2 = a0;
if (a0) {
const r5 = a0[Symbol.toPrimitive];
if (r5 !== void 0) {
r2 = r5.call(a0, "string");
if (typeof r2 === "object") {
throw new TypeError("@@toPrimitive must return a primitive value.");
}
} else {
r2 = String(a0);
}
}
}
let r19 = r2;
if (typeof r19 !== "symbol") {
r19 = "" + r2;
}
return r19;
};
AddMembersBody = function AddMembersBody(props) {
let data;
let c16460_3, state, setState, state2, setState2, count, c16460_9, c16460_10, c16460_11, c16460_12;
const { channel, guild, pendingAdditions, setPendingAdditions, permission = NONE, inActionSheet, ...rest } = props;
c16460_3 = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
count = void 0;
c16460_9 = void 0;
c16460_10 = void 0;
c16460_11 = void 0;
c16460_12 = void 0;
const filterByQuery = function filterByQuery(a0) {
const r11 = state2.trim();
return new RegExp(`${RegexUtils.escape(state ? r11.slice(1) : r11)}`, "i").test(a0);
};
const styles = useStyles();
c16460_3 = styles;
[state, setState] = useState(false);
[state2, setState2] = useState("");
const insets = useSafeAreaInsetsKeyboardAware_native({
isKeyboardAwareOnAndroid: !inActionSheet
}).insets;
let r27 = canEveryoneRole(Permissions.ADMINISTRATOR, guild);
const stateFromStores = useStateFromStores([GuildRoleStore], () => GuildRoleStore.getSortedRoles(guild.id));
const stateFromStoresArray = useStateFromStoresArray([GuildMemberStore], () => GuildMemberStore.getMemberIds(guild.id));
if (state) {
data = [];
} else {
const rolesRows = getRolesRows(guild, stateFromStores, channel, permission, filterByQuery);
data = rolesRows.length === 0 && state2.trim() === "" && stateFromStores.length === 1 ? getNoRolesRow() : rolesRows;
}
const membersRows = getMembersRows(stateFromStoresArray, channel, guild, permission, filterByQuery);
count = data.length + membersRows.length;
useEffect(() => {
if (state2 !== "") {
AccessibilityAnnouncer.announce(intl.formatToPlainString(t.ZGVL3g, {
count
}), "polite");
}
}, [count, state2]);
const r113 = data.length > 0 ? [intl.string(t["LPJmL/"])] : [];
const data2 = [];
const r0 = HermesBuiltin.arraySpread(data2, data, HermesBuiltin.arraySpread(data2, r113, 0));
HermesBuiltin.arraySpread(data2, membersRows, HermesBuiltin.arraySpread(data2, membersRows.length > 0 ? [intl.string(t["9Oq93m"])] : [], r0));
const r152 = data.length > 0 ? 1 : 0;
c16460_9 = r152;
const r4 = r152 + data.length - 1;
c16460_10 = r4;
const r2 = membersRows.length > 0 ? r4 + 2 : r4;
const r157 = [];
c16460_11 = r2;
c16460_12 = r2 + membersRows.length - 1;
r157.push({
title: intl.string(t["LPJmL/"]),
data
});
r157.push({
title: intl.string(t["9Oq93m"]),
data: membersRows
});
const tags = Object.values(pendingAdditions).map((item) => ({
...item.display,
id: item.row.id
}));
const Component = inActionSheet ? BottomSheetScrollView : ScrollView;
const Component2 = inActionSheet ? BottomSheetFlashList : FlashList;
const r227 = [<View style={styles.inputContainer}>
<TagListInput_native accessibilityLabel={intl.string(t["5h0QOP"])} placeholder={intl.string(t.TVZdKh)} tags={tags} onChangeText={function onChangeText(text) {
const r11 = text.trim();
const r2 = r11.charAt(0) === "@";
GuildUtils.requestMembers(guild.id, r2 ? r11.slice(1) : r11, MEMBER_REQUEST_COUNT);
setState2(text);
setState(r2);
}} onRemove={function onRemove(event) {
let c26172_0 = Object.keys(pendingAdditions)[event];
setPendingAdditions((prevPendingAdditions) => {
prevPendingAdditions[c26172_0];
return _objectWithoutProperties(prevPendingAdditions, [c26172_0].map(_toPropertyKey));
});
}} />
</View>, , ,];
if (r27) {
r27 = <View style={styles.adminWarning}>
<HelpMessage messageType={HelpMessageTypes.WARNING}>
{intl.string(t["5f3HIC"])}
</HelpMessage>
</View>;
}
r227[1] = r27;
r227[2] = state2 !== "" && (data.length === 0 && membersRows.length === 0) ? <Component {...rest}>
<EmptyState Illustration={NoResultsAlt} style={styles.emptyState} bodyStyle={styles.emptyStateText} body={intl.format(t.ErpIY3, {
query: state2
})} />
</Component> : <Component2 {...rest} extraData={pendingAdditions} data={data2} contentContainerStyle={{
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16 + insets.bottom
}} renderItem={function renderRow({ item, index }) {
return typeof item === "string" ? <Text style={[c16460_3.sectionRowWrapper, index === 0 ? {
paddingTop: 0
} : {}]} maxFontSizeMultiplier={2} accessibilityRole="header" variant="text-sm/semibold" color="interactive-text-default">{item}</Text> : <ChannelOverwritesCheckboxItem start={c16460_9 === index || c16460_11 === index} end={c16460_10 === index || c16460_12 === index} item={item} guildId={guild.id} onPress={() => {
const item2 = item;
if (item.rowType !== RowType.EMPTY_STATE) {
setPendingAdditions((prevPendingAdditions) => {
let display;
const r2 = {
...prevPendingAdditions
};
const r20 = `${item2.rowType}:${item2.id}`;
if (r20 in r2) {
delete r2[r20];
} else {
L8: {
const rowType = item2.rowType;
if (RowType.ROLE !== rowType && RowType.ADMINISTRATOR !== rowType) {
if (RowType.MEMBER !== rowType) {
const OWNER = RowType.OWNER;
display = void 0;
if (OWNER !== rowType) {
break L8;
}
}
const user = UserStore.getUser(item2.id);
const r1 = user != null;
display = void 0;
if (!r1) {
break L8;
}
display = {
text: item2.name,
icon: (0, jsx)(Avatar, {
user,
guildId: guild.id,
avatarStyle: c16460_3.tagAvatar,
style: c16460_3.tagAvatar
})
};
} else {
display = {
text: item2.name,
icon: (0, jsx)(View, {
style: [c16460_3.tagRoleColor, {
backgroundColor: item2.colorString
}]
})
};
}
}
if (display != null) {
r2[r20] = {
display,
row: item2
};
}
}
return r2;
});
}
}} checked={`${item.rowType}:${item.id}` in pendingAdditions} />;
}} keyboardShouldPersistTaps="handled" />;
return <>{r227}</>;
};
useStyles = createStyles({
container: {
flex: 1
},
inputContainer: {
alignItems: "stretch",
paddingHorizontal: Module712.space.PX_16,
paddingVertical: Module712.space.PX_12
},
tagRoleColor: {
height: 12,
width: 12,
borderRadius: 6
},
tagAvatar: {
width: 16,
height: 16,
borderRadius: Module712.radii.sm
},
emptyState: {
paddingTop: Module712.space.PX_16
},
emptyStateText: {
color: Module712.colors.TEXT_DEFAULT
},
sectionRowWrapper: {
paddingVertical: Module712.space.PX_12
},
adminWarning: {
marginHorizontal: 16,
marginVertical: 8
}
});
export default function AddMembersActionSheet(props) {
let env16461 = {
$parent: env5279
};
const channel = props.channel;
env16461[0] = channel;
const canSkip = props.canSkip;
env16461[1] = void 0;
env16461[2] = function _handleAddPressed() {
const r9 = async () => {
let c29938_0, c29938_1, c29938_2;
let c29938_4 = 0;
let c29938_3 = 0;
let r27 = void 0;
let r4 = 0;
let r12 = env16461;
L37: {
L30: {
L31: {
L38: {
L13: {
L14: {
try {
const r29 = c29938_4;
if (r29 !== 0) {
if (r29 === 1) {
c29938_3 = 0;
break L13;
}
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
c29938_3 = 0;
break L14;
}
memberOrRoleAddedToast(env31463[2], env31463[1]);
ActionSheetActionCreators.hideActionSheet();
c29938_3 = 0;
break L13;
}
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
break L38;
}
let env31463;
c29938_1 = r12;
const r51 = env31463 = {
$parent: r12
};
c29938_0 = r51;
const r52 = [];
env31463[0] = r52;
env31463[1] = 0;
Object.values(env16461[1]).forEach(({ row }) => {
if (row.id != null && row.id !== "") {
if (row.rowType === RowType.ROLE) {
env31463[2] = env31463[2] + 1;
env31463[0].push(permissionOverwriteForRole(row.id, env16461[0].type));
} else if (row.rowType === RowType.MEMBER) {
env31463[1] = env31463[1] + 1;
env31463[0].push(permissionOverwriteForUser(row.id, env16461[0].type));
}
}
});
c29938_3 = 1;
const r67 = savePermissionUpdates(env16461[0].id, r52);
c29938_4 = 2;
r27 = await r67;
r4 = 0;
r12 = env16461;
while (true) {
const r80 = c29938_4;
if (r80 !== 0) {
if (r80 === 1) {
c29938_3 = 0;
break L30;
}
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
c29938_3 = 0;
break L31;
}
memberOrRoleAddedToast(env31463[2], env31463[1]);
ActionSheetActionCreators.hideActionSheet();
c29938_3 = 0;
break L30;
}
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
break L37;
}
let env31463;
c29938_1 = r12;
const r104 = env31463 = {
$parent: r12
};
c29938_0 = r104;
const r105 = [];
env31463[0] = r105;
env31463[1] = 0;
Object.values(env16461[1]).forEach(({ row }) => {
if (row.id != null && row.id !== "") {
if (row.rowType === RowType.ROLE) {
env31463[2] = env31463[2] + 1;
env31463[0].push(permissionOverwriteForRole(row.id, env16461[0].type));
} else if (row.rowType === RowType.MEMBER) {
env31463[1] = env31463[1] + 1;
env31463[0].push(permissionOverwriteForUser(row.id, env16461[0].type));
}
}
});
c29938_3 = 1;
const r120 = savePermissionUpdates(env16461[0].id, r105);
c29938_4 = 2;
r27 = await r120;
r4 = 0;
r12 = env16461;
}
} catch ($e) {
const r30 = $e;
let r7 = r30;
c29938_2 = r30;
if (c29938_3 !== 0) {
while (true) {
c29938_4 = 1;
try {
let r134 = c29938_4;
while (r134 === 0) {
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
break L37;
}
let env31463;
c29938_1 = r12;
const r160 = env31463 = {
$parent: r12
};
c29938_0 = r160;
const r161 = [];
env31463[0] = r161;
env31463[1] = 0;
Object.values(env16461[1]).forEach(({ row }) => {
if (row.id != null && row.id !== "") {
if (row.rowType === RowType.ROLE) {
env31463[2] = env31463[2] + 1;
env31463[0].push(permissionOverwriteForRole(row.id, env16461[0].type));
} else if (row.rowType === RowType.MEMBER) {
env31463[1] = env31463[1] + 1;
env31463[0].push(permissionOverwriteForUser(row.id, env16461[0].type));
}
}
});
c29938_3 = 1;
const r176 = savePermissionUpdates(env16461[0].id, r161);
c29938_4 = 2;
r27 = await r176;
r4 = 0;
r12 = env16461;
r134 = c29938_4;
}
if (r134 === 1) {
c29938_3 = 0;
break L30;
}
if (r4 === 1) {
throw r27;
}
if (r4 === 2) {
c29938_3 = 0;
break L31;
}
memberOrRoleAddedToast(env31463[2], env31463[1]);
ActionSheetActionCreators.hideActionSheet();
c29938_3 = 0;
break L30;
} catch (r135) {
r7 = r135;
c29938_2 = r135;
if (c29938_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
return r27;
}
return void 0;
}
return r27;
}
return r27;
}
return void 0;
}
return r27;
};
env16461[2] = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const r27 = _slicedToArray(useState({}), 2);
const pendingAdditions2 = r27[0];
env16461[1] = pendingAdditions2;
const setPendingAdditions2 = r27[1];
const stateFromStores = useStateFromStores([GuildStore], () => {
const r5 = env16461[0];
return GuildStore.getGuild(r5 == null ? void 0 : r5.getGuildId());
});
let subtitle = useChannelName(channel, true);
if (subtitle == null) {
subtitle = "";
}
if (stateFromStores == null) {
return null;
}
const disabled = Object.keys(pendingAdditions2).length === 0;
return <BottomSheet scrollable header={<BottomSheetTitleHeader title={intl.string(t.dMJ3Y6)} subtitle={subtitle} trailing={<Button {...canSkip && disabled ? {
size: "sm",
text: intl.string(t["5Wxrcd"]),
onPress: () => {
ActionSheetActionCreators.hideActionSheet();
},
variant: "secondary"
} : {
size: "sm",
text: intl.string(t.OYkgVk),
onPress: function handleAddPressed() {
return env16461[2].apply(this, arguments);
},
variant: disabled ? "secondary" : "primary",
disabled
}} />} />} startExpanded>
<View style={styles.container}>
<AddMembersBody channel={channel} guild={stateFromStores} permission={channel.accessPermissions} pendingAdditions={pendingAdditions2} setPendingAdditions={setPendingAdditions2} inActionSheet />
</View>
</BottomSheet>;
};
export { AddMembersBody };
@@ -0,0 +1,106 @@
// Metro module 10919 (f10920).
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../../stores/GuildRoleStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { ChannelSettingsSections, Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores, useStateFromStoresObject, useStateFromStoresArray } from "../../../../_bundle/Module589";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useChannelName from "../../../channel/useChannelName";
import { getExistingRolesRows, getExistingMembersRows } from "../../ChannelPermissionsUtils";
import { intl, t } from "../../../../intl/index.native";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import ChannelSettingsActionCreators from "../../../../actions/ChannelSettingsActionCreators";
import { navigateToChannelDetailsScreen } from "../../../main_tabs_v2/native/sidebar/details/ChannelDetailsUtils";
import { SettingsIcon } from "../../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import { RowButton } from "../../../../design/components/TableRow/native/RowButton.native";
import { openAddMembersActionSheet } from "../ChannelPermissionsUtils";
import { GroupPlusIcon } from "../../../../design/components/Icon/native/redesign/generated/GroupPlusIcon";
import { HelpMessage, HelpMessageTypes } from "../../../../design/void/native";
import { BottomSheetSectionList } from "../../../../_bundle/Module5245";
import ChannelOverwritesItem from "../components/ChannelOverwritesItem";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
paddingHorizontal: 16,
flex: 1
},
sectionRowWrapper: {
paddingVertical: Module712.space.PX_12
},
warning: {
margin: 16,
marginBottom: 0
}
});
export default function ChannelMembersActionSheet(props) {
let navigation, showRemove;
const { channelId, guildId } = props;
navigation = void 0;
showRemove = void 0;
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const stateFromStoresObject = useStateFromStoresObject([GuildStore, GuildRoleStore], () => {
const guild = GuildStore.getGuild(stateFromStores == null ? void 0 : stateFromStores.getGuildId());
return {
guild,
sortedGuildRoles: guild != null ? GuildRoleStore.getSortedRoles(guild.id) : void 0
};
}, [stateFromStores]);
const { guild, sortedGuildRoles } = stateFromStoresObject;
const stateFromStoresArray = useStateFromStoresArray([GuildMemberStore], () => GuildMemberStore.getMemberIds(stateFromStores == null ? void 0 : stateFromStores.getGuildId()), [stateFromStores]);
navigation = useNavigation();
const channelName = useChannelName(stateFromStores);
if (stateFromStores != null && guild != null && sortedGuildRoles != null) {
showRemove = PermissionStore.can(Permissions.MANAGE_ROLES, stateFromStores);
const existingRolesRows = getExistingRolesRows(guild, sortedGuildRoles, stateFromStores, stateFromStores.accessPermissions);
const existingMembersRows = getExistingMembersRows(stateFromStoresArray, stateFromStores, guild, stateFromStores.accessPermissions);
const sections = [];
sections.push({
title: intl.string(t["LPJmL/"]),
data: existingRolesRows
});
sections.push({
title: intl.string(t["9Oq93m"]),
data: existingMembersRows
});
return <BottomSheet scrollable header={<BottomSheetTitleHeader title={intl.string(t.ES4CC6)} subtitle={`#${channelName}`} trailing={showRemove ? <PressableOpacity onPress={function onPress() {
ActionSheetActionCreators.hideActionSheet();
ChannelSettingsActionCreators.init(channelId);
navigateToChannelDetailsScreen(navigation, ChannelSettingsSections.PERMISSIONS, channelId, "channel-members-action-sheet");
}} accessibilityRole="button" accessibilityLabel={intl.string(t.XPDhcc)}>
<SettingsIcon />
</PressableOpacity> : showRemove} />} startExpanded>
<View style={styles.container}>
{showRemove ? <RowButton label={intl.string(t.dMJ3Y6)} onPress={() => openAddMembersActionSheet(stateFromStores)} icon={<GroupPlusIcon />} /> : <View style={styles.warning}>
<HelpMessage messageType={HelpMessageTypes.INFO}>
{intl.string(t.VOuiSj)}
</HelpMessage>
</View>}
<BottomSheetSectionList contentContainerStyle={{
paddingBottom: safeAreaInsets_native.bottom + Module712.space.PX_16
}} renderItem={function renderItem(info) {
const { item, index } = info;
return <ChannelOverwritesItem start={index === 0} end={index === info.section.data.length - 1} guildId={guildId} item={item} channelId={channelId} showType showRemove={showRemove} />;
}} renderSectionHeader={function renderSectionHeader({ section }) {
return <Text style={styles.sectionRowWrapper} maxFontSizeMultiplier={2} accessibilityRole="header" variant="text-sm/semibold" color="interactive-text-default">
{intl.format(t.u8CWLl, {
numberOfItems: section.data.length,
sectionTitle: section.title
})}
</Text>;
}} sections={sections} stickySectionHeadersEnabled={false} />
</View>
</BottomSheet>;
}
return null;
};
@@ -0,0 +1,129 @@
// Metro module 11563 (f11564).
import { View } from "react-native";
import { isGuildOwner } from "../../../../records/GuildRecord";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../../stores/GuildRoleStore";
import { Fragment, jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { useStateFromStoresArray } from "../../../../_bundle/Module589";
import { getExistingRoles, getExistingMembers } from "../../ChannelPermissionsUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { openChannelMembersActionSheet } from "../ChannelPermissionsUtils";
import { Avatar, AvatarSizes, Icon } from "../../../../design/void/native";
import Module11562 from "../../../../_bundle/Module11562";
import { GroupIcon } from "../../../../design/components/Icon/native/redesign/generated/GroupIcon";
import Module8288 from "../../../../_bundle/Module8288";
import { ShieldUserIcon } from "../../../../design/components/Icon/native/redesign/generated/ShieldUserIcon";
import Module10737 from "../../../../_bundle/Module10737";
const count = 100;
const useStyles = createStyles({
section: {
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.sm,
color: Module712.colors.TEXT_DEFAULT,
flexDirection: "row",
marginBottom: 8,
marginTop: 8,
padding: 16
},
sectionContent: {
alignItems: "center",
flexDirection: "row",
flexGrow: 1
},
avatar: {
marginRight: 8
},
labelDetail: {
marginRight: 12
},
sectionIcon: {
marginRight: 6
}
});
let c7887_13 = {
MEMBERS: 0,
0: "MEMBERS",
ROLES: 1,
1: "ROLES"
};
export default function ChannelAccessInfo(props) {
let props3;
const { guild, channel } = props;
const styles = useStyles();
const accessibilityLabel = intl.string(t.li1wKf);
const stateFromStoresArray = useStateFromStoresArray([GuildRoleStore], () => getExistingRoles(guild, GuildRoleStore.getSortedRoles(guild.id), channel, channel.accessPermissions), [guild, channel]);
const existingMembers = getExistingMembers(GuildMemberStore.getMemberIds(guild?.id), channel, guild, channel.accessPermissions);
const user = stateFromStoresArray.length === 0 && existingMembers.length === 1 && isGuildOwner(guild, existingMembers[0]) ? existingMembers[0] : null;
const r64 = [<Text variant="eyebrow">{accessibilityLabel}</Text>, ,];
const props2 = {
accessibilityLabel,
accessibilityRole: "button",
onPress: function onPress() {
openChannelMembersActionSheet(channel.id, channel.guild_id);
},
style: styles.section,
children: null
};
if (user != null) {
props3 = {
children: [<Avatar style={styles.avatar} user={user} guildId={guild.id} size={AvatarSizes.XSMALL} />, <View>
<Text variant="text-sm/semibold">{user.tag}</Text>
<Text variant="text-xs/medium">
{intl.string(t.rt0ERW)}
</Text>
</View>]
};
} else {
const renderCounts = function renderCounts(a0, a1, a2, a3) {
let r10;
if (a1 === 0) {
return null;
}
if (c7887_13.MEMBERS === a0) {
r10 = a1 > count ? intl.formatToPlainString(t.PR5l07, {
count
}) : intl.formatToPlainString(t.bu5sya, {
count: a1
});
} else if (c7887_13.ROLES === a0) {
r10 = a1 > count ? intl.formatToPlainString(t["+OYnFQ"], {
count
}) : intl.formatToPlainString(t.T2BEtm, {
count: a1
});
} else {
assertNever(a0);
r10 = void 0;
}
return <>
{jsx(a3, {
size: "sm",
style: styles.sectionIcon
})}
<Text style={styles.labelDetail} variant="text-sm/medium">{r10}</Text>
</>;
};
const MEMBERS = c7887_13.MEMBERS;
const length = existingMembers.length;
Module11562;
const children = [renderCounts(MEMBERS, length, 0, GroupIcon), ,];
const ROLES = c7887_13.ROLES;
const length2 = stateFromStoresArray.length;
Module8288;
children[1] = renderCounts(ROLES, length2, 0, ShieldUserIcon);
props3 = {
children
};
}
props2.children = [<View style={styles.sectionContent}>
<Fragment {...props3} />
</View>, <Icon source={Module10737} size={Icon.Sizes.SMALL} />];
r64[1] = <PressableOpacity {...props2} />;
return <>{r64}</>;
};
@@ -0,0 +1,168 @@
// Metro module 8285 (f8286).
import { View } from "react-native";
import UserStore from "../../../../stores/UserStore";
import { RowType } from "../../ChannelPermissionsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { showConfirmModal } from "../../../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../../../intl/index.native";
import ChannelActionCreators from "../../../../actions/ChannelActionCreators";
import { memberOrRoleRemovedToast } from "../../../toast/native/ToastUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { CircleXIcon } from "../../../../design/components/Icon/native/redesign/generated/CircleXIcon";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { ShieldUserIcon } from "../../../../design/components/Icon/native/redesign/generated/ShieldUserIcon";
import { getRowTypeLabel } from "../../ChannelPermissionsUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { Icon, Avatar, AvatarSizes, IconSizes } from "../../../../design/void/native";
import Module8287 from "../../../../_bundle/Module8287";
import Module8288 from "../../../../_bundle/Module8288";
import { useCheckboxA11yNative } from "../../../../_bundle/Module3907";
import { FormCheckbox } from "../../../../design/components/Forms/native/FormCheckbox.native";
let useStyles, RoleItem, MemberItem, EmptyRoleItem, ChannelOverwritesItem;
const RemoveIcon = function RemoveIcon(props) {
const { item, channelId, onRemove } = props;
const styles = useStyles();
return channelId != null ? <PressableOpacity disabled={item.disabled} accessibilityRole="button" accessibilityLabel={intl.string(t.N86XcP)} onPress={() => {
if (onRemove != null) {
return onRemove(item);
}
const { id: id2, name: name2 } = item;
const id = id2;
const name = name2;
const channelId2 = channelId;
showConfirmModal({
key: `remove-channel-overwrite-${id}`,
title: intl.string(t.GuPYQB),
content: intl.format(t.xERCnZ, {
name
}),
confirmText: intl.string(t.fKxYb0),
onConfirm: () => {
ChannelActionCreators.clearPermissionOverwrite(channelId2, id).then(() => {
memberOrRoleRemovedToast(name);
});
}
});
}}>
<CircleXIcon style={item.disabled ? styles.rowRemoveIconDisabled : void 0} />
</PressableOpacity> : null;
};
RoleItem = function RoleItem(props) {
const { disabled, item: item2 } = props;
let subLabel = props.subLabel;
const { channelId: channelId3, showType, showRemove, start, end } = props;
let trailing = props.trailing;
const { onPress: onPress2, accessibilityRole, accessibilityState, accessible } = props;
const props2 = {
icon: <ShieldUserIcon size="lg" color={item2.colorString} />,
label: item2.name,
subLabel: null,
start: null,
end: null,
trailing: null,
onPress: null,
disabled: null,
accessibilityRole: null,
accessibilityState: null,
accessible: null
};
if (showType) {
subLabel = getRowTypeLabel(item2.rowType);
}
props2.subLabel = subLabel;
props2.start = start;
props2.end = end;
if (showRemove) {
trailing = <RemoveIcon item={item2} channelId={channelId3} />;
}
props2.trailing = trailing;
props2.onPress = onPress2;
props2.disabled = disabled;
props2.accessibilityRole = accessibilityRole;
props2.accessibilityState = accessibilityState;
props2.accessible = accessible;
return <TableRow {...props2} />;
};
MemberItem = function MemberItem(props) {
const { item: item2, channelId: channelId3, showRemove, onRemove: onRemove2, guildId, start, end } = props;
let trailing = props.trailing;
const { onPress: onPress2, disabled, accessibilityRole, accessibilityState, accessible } = props;
const styles = useStyles();
const label = <View style={styles.nameWrapper}>
<Text style={[styles.name, styles.memberName]} lineClamp={1} variant="text-md/semibold" color="interactive-text-active">{item2.name}</Text>
{item2.rowType === RowType.OWNER ? <Icon size={Icon.Sizes.REFRESH_SMALL_16} source={Module8287} disableColor style={styles.ownerIcon} /> : null}
</View>;
const user = UserStore.getUser(item2.id);
const props2 = {
icon: <Avatar source={user == null ? void 0 : user.getAvatarSource(guildId)} size={AvatarSizes.SMALL} />,
label,
subLabel: item2.username,
start,
end,
trailing: null,
onPress: null,
disabled: null,
accessibilityRole: null,
accessibilityState: null,
accessible: null
};
if (showRemove) {
trailing = <RemoveIcon item={item2} channelId={channelId3} onRemove={onRemove2} />;
}
props2.trailing = trailing;
props2.onPress = onPress2;
props2.disabled = disabled;
props2.accessibilityRole = accessibilityRole;
props2.accessibilityState = accessibilityState;
props2.accessible = accessible;
return <TableRow {...props2} />;
};
EmptyRoleItem = function EmptyRoleItem(props) {
const item2 = props.item;
return <TableRow icon={<Icon source={Module8288} color={item2.colorString} size={IconSizes.MEDIUM} style={useStyles().roleIcon} />} label={item2.name} />;
};
ChannelOverwritesItem = function ChannelOverwritesItem(props) {
const { item: item2, ...props2 } = props;
const rowType = item2.rowType;
if (RowType.ADMINISTRATOR !== rowType && RowType.ROLE !== rowType) {
if (RowType.OWNER !== rowType && RowType.MEMBER !== rowType) {
if (RowType.EMPTY_STATE === rowType) {
return <EmptyRoleItem item={item2} {...props2} />;
}
return null;
}
return <MemberItem item={item2} {...props2} />;
}
return <RoleItem item={item2} {...props2} />;
};
useStyles = createStyles({
nameWrapper: {
flexDirection: "row",
alignItems: "flex-end",
marginRight: 16
},
name: {
paddingRight: 4
},
memberName: {
flexShrink: 1
},
ownerIcon: {
alignSelf: "center"
},
roleIcon: {
height: 30,
width: 30
},
rowRemoveIconDisabled: {
opacity: 0.3
}
});
export default ChannelOverwritesItem;
export function ChannelOverwritesCheckboxItem(props) {
const { checked, ...props2 } = props;
const checkboxA11yNative = useCheckboxA11yNative({
checked
});
return <ChannelOverwritesItem {...props2} accessible accessibilityRole={checkboxA11yNative.accessibilityRole} accessibilityState={checkboxA11yNative.accessibilityState} trailing={<FormCheckbox checked={checked} />} />;
}
@@ -0,0 +1,331 @@
// Metro module 15650 (f15651).
import { useLayoutEffect, useMemo, useState, useEffect, useCallback } from "react";
import { View, ScrollView } from "react-native";
import ChannelSettingsPermissionsStore from "../../../../stores/ChannelSettingsPermissionsStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../../stores/GuildRoleStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import UserStore from "../../../../stores/UserStore";
import { SettingMode } from "../../ChannelPermissionsConstants";
import { Permissions, ChannelTypes, AnalyticEvents, ChannelSettingsSections, SettingsPaneTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
import * as _ChannelPermissionsUtils from "../../ChannelPermissionsUtils";
import { flipEveryonePermission, grantUserChannelAccess, getExistingRolesRows, getExistingMembersRows } from "../../ChannelPermissionsUtils";
import { savePermissionUpdates, setAdvancedMode } from "../../../../actions/ChannelSettingsPermissionsActionCreators";
import { checkChattableChannelThresholdMetAfterChannelPermissionDeny } from "../../../guild_onboarding/DefaultChannelThresholdUtils";
import { intl, t } from "../../../../intl/index.native";
import { computeChannelName } from "../../../channel/useChannelName";
import AlertActionCreators from "../../../../actions/AlertActionCreators";
import ChannelOverwritesItem from "./ChannelOverwritesItem";
import * as _PermissionUtils from "../../../../utils/PermissionUtils";
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableSwitchRow } from "../../../../design/components/TableRow/native/TableSwitchRow.native";
import { HelpMessage, HelpMessageTypes } from "../../../../design/void/native";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { CirclePlusIcon } from "../../../../design/components/Icon/native/redesign/generated/CirclePlusIcon";
import { openAddMembersActionSheet } from "../ChannelPermissionsUtils";
import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native";
import AppAnalyticsUtils from "../../../app_analytics/AppAnalyticsUtils";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { SegmentedControl } from "../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import ViewModerators from "../../../stage_channels/native/channel_permissions/ViewModerators";
import ChannelSettingsPermissionsOverview from "../../../../components_native/channel_settings/ChannelSettingsPermissionsOverview";
function $mk118501($env) {
return () => {
const r1 = $env;
const r2 = r1[2];
r2(_ChannelPermissionsUtils.isPrivateGuildChannel(r1[0]));
};
}
let onBack, c11171_25, useStyles;
let env11171 = {};
const ChannelPermissionSettingsBasicView = function ChannelPermissionSettingsBasicView(props) {
let env22287 = {
$parent: env11171
};
const channel = props.channel;
env22287[0] = channel;
const privateToggleState = props.privateToggleState;
env22287[1] = privateToggleState;
env22287[2] = props.setPrivateToggleState;
env22287[3] = void 0;
env22287[4] = void 0;
env22287[5] = void 0;
env22287[9] = void 0;
env22287[6] = function togglePrivateChannel() {
return env22287[7].apply(this, arguments);
};
env22287[7] = function _togglePrivateChannel() {
const r9 = async () => {
const isPrivateGuildChannel = _ChannelPermissionsUtils.isPrivateGuildChannel(env22287[0]);
const accessPermissions = env22287[0].accessPermissions;
let c31778_0 = flipEveryonePermission(env22287[0], accessPermissions, isPrivateGuildChannel);
const currentUser = UserStore.getCurrentUser();
const r51 = PermissionStore.can(Permissions.ADMINISTRATOR, env22287[4]);
if (env22287[9] || currentUser == null || r51) {
await savePermissionUpdates(env22287[0].id, [c31778_0]);
} else {
await grantUserChannelAccess(env22287[0], accessPermissions);
await savePermissionUpdates(env22287[0].id, [c31778_0]);
}
};
env22287[7] = r9;
return r9.apply(this, arguments);
};
env22287[8] = function _onPrivateChannelSwitchChange() {
const r9 = async () => {
let c30911_0, c30911_1;
L28: {
L21: {
L14: {
let env31779;
const r9 = env22287;
c30911_1 = r9;
const r29 = env31779 = {
$parent: r9
};
c30911_0 = r29;
env31779[0] = void 0;
env31779[1] = void 0;
env31779[2] = void 0;
if (env22287[0].guild_id != null && !env22287[1]) {
if (await checkChattableChannelThresholdMetAfterChannelPermissionDeny(env22287[0], Permissions.VIEW_CHANNEL)) {
env31779[0] = env22287[1] ? intl.string(t.vw48TT) : intl.string(t["47gQYL"]);
env31779[1] = computeChannelName(env22287[0], UserStore, RelationshipStore);
env31779[2] = env22287[1] ? intl.format(t.hGzPnx, {
channelName: env31779[1]
}) : intl.format(t.rKzX1E, {
channelName: env31779[1]
});
(0, env22287[2])(!env22287[1]);
AlertActionCreators.show({
title: env31779[0],
body: env31779[2],
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t.p89ACt),
onConfirm: env22287[6],
hideActionSheet: false,
onCancel: $mk118501(env22287)
});
break L21;
}
break L14;
}
env31779[0] = env22287[1] ? intl.string(t.vw48TT) : intl.string(t["47gQYL"]);
env31779[1] = computeChannelName(env22287[0], UserStore, RelationshipStore);
env31779[2] = env22287[1] ? intl.format(t.hGzPnx, {
channelName: env31779[1]
}) : intl.format(t.rKzX1E, {
channelName: env31779[1]
});
(0, env22287[2])(!env22287[1]);
AlertActionCreators.show({
title: env31779[0],
body: env31779[2],
cancelText: intl.string(t["ETE/oC"]),
confirmText: intl.string(t.p89ACt),
onConfirm: env22287[6],
hideActionSheet: false,
onCancel: $mk118501(env22287)
});
break L28;
}
return void 0;
}
return void 0;
}
};
env22287[8] = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const navigation = useNavigation();
env22287[3] = navigation;
const stateFromStoresObject = useStateFromStoresObject([GuildStore, GuildRoleStore], () => {
const guild = GuildStore.getGuild(env22287[0].getGuildId());
return {
guild,
sortedGuildRoles: guild != null ? GuildRoleStore.getSortedRoles(guild.id) : void 0
};
});
const guild = stateFromStoresObject.guild;
env22287[4] = guild;
const sortedGuildRoles = stateFromStoresObject.sortedGuildRoles;
env22287[5] = sortedGuildRoles;
useLayoutEffect(() => {
env22287[3].setOptions({
headerRight: void 0
});
}, [navigation]);
const memo = useMemo(() => {
let r17;
const r6 = env22287[4];
if (r6 != null) {
const r5 = env22287[5];
if (r5 != null) {
const r16 = env22287[0];
r17 = getExistingRolesRows(r6, r5, r16, r16.accessPermissions);
} else {
r17 = [];
}
} else {
r17 = [];
}
return r17;
}, [guild, sortedGuildRoles, channel]);
if (guild != null && sortedGuildRoles != null) {
const isCategory = channel.isCategory();
const existingMembersRows = getExistingMembersRows(GuildMemberStore.getMemberIds(guild?.id), channel, guild, channel.accessPermissions);
const isPrivateGuildChannel = _ChannelPermissionsUtils.isPrivateGuildChannel(channel);
env22287[9] = isPrivateGuildChannel;
const canEveryoneRole2 = _PermissionUtils.canEveryoneRole(Permissions.VIEW_CHANNEL, guild);
const canEveryoneRole = _PermissionUtils.canEveryoneRole(Permissions.ADMINISTRATOR, guild);
const type = channel.type;
const r84 = intl.string(t.hfbjIH);
return <Stack style={{
paddingHorizontal: Module712.space.PX_16
}} spacing={Module712.space.PX_16}>
<TableRowGroup title={type === ChannelTypes.GUILD_CATEGORY ? intl.string(t.RQUk61) : type === ChannelTypes.GUILD_VOICE ? intl.string(t.cLjvKg) : r84} hasIcons={false}>
<TableSwitchRow label={isCategory ? intl.string(t.lEPAZ5) : intl.string(t.aUI70g)} value={privateToggleState} onValueChange={function onPrivateChannelSwitchChange() {
return env22287[8].apply(this, arguments);
}} />
</TableRowGroup>
{canEveryoneRole && <View style={styles.adminWarning}>
<HelpMessage messageType={HelpMessageTypes.WARNING}>
{intl.string(t["5f3HIC"])}
</HelpMessage>
</View>}
{(canEveryoneRole ? !canEveryoneRole : !canEveryoneRole2) && !isPrivateGuildChannel && <View style={styles.adminWarning}>
<HelpMessage messageType={HelpMessageTypes.WARNING}>
{intl.string(t.ZAk4Q9)}
</HelpMessage>
</View>}
<TableRowGroup hasIcons>
<TableRow arrow icon={<CirclePlusIcon />} label={intl.string(t.dMJ3Y6)} onPress={() => {
const r3 = env22287[0];
if (r3 != null) {
openAddMembersActionSheet(r3);
}
}} />
</TableRowGroup>
<TableRowGroup title={intl.string(t.ES4CC6)} hasIcons>
{memo.map((a0) => {
const r10 = env22287[0];
return <ChannelOverwritesItem key={a0.id} item={a0} channelId={r10.id} showType showRemove guildId={r10.guild_id} />;
})}
</TableRowGroup>
<TableRowGroup hasIcons>
{existingMembersRows.map((existingMembersRow) => {
const r10 = env22287[0];
return <ChannelOverwritesItem key={existingMembersRow.id} item={existingMembersRow} channelId={r10.id} showType showRemove guildId={r10.guild_id} />;
})}
</TableRowGroup>
</Stack>;
}
return null;
};
onBack = function onBack() {
AlertActionCreators.close();
return false;
};
c11171_25 = {
BASIC: 0,
0: "BASIC",
ADVANCED: 1,
1: "ADVANCED",
MODERATORS: 2,
2: "MODERATORS"
};
useStyles = createStyles({
container: {
flex: 1,
paddingTop: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
content: {
marginTop: 16,
flex: 1
},
adminWarning: {
marginTop: Module712.space.PX_12
}
});
export default function EasyChannelPermissionSettings(props) {
let r43, MODERATORS;
let state, setState, setState2;
const { channelId, origin } = props;
state = void 0;
setState = void 0;
setState2 = void 0;
useNavigatorBackPressHandler(onBack);
const styles = useStyles();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const stateFromStores2 = useStateFromStores([ChannelSettingsPermissionsStore], () => ChannelSettingsPermissionsStore.advancedMode);
const r10 = stateFromStores == null ? void 0 : stateFromStores.isGuildStageVoice();
if (r10) {
MODERATORS = c11171_25.MODERATORS;
r43 = c11171_25;
} else if (stateFromStores2) {
MODERATORS = c11171_25.ADVANCED;
r43 = c11171_25;
} else {
MODERATORS = c11171_25.BASIC;
r43 = c11171_25;
}
[state, setState] = useState(MODERATORS);
let privateToggleState;
[privateToggleState, setState2] = useState(_ChannelPermissionsUtils.isPrivateGuildChannel(stateFromStores));
useEffect(() => {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SETTINGS_PANE_VIEWED, {
settings_type: "channel",
origin_pane: origin === ChannelSettingsSections.OVERVIEW ? SettingsPaneTypes.CHANNEL_SETTINGS : null,
destination_pane: ChannelSettingsSections.PERMISSIONS
});
}, [origin]);
const callback = useCallback((a0) => {
if (a0 === c11171_25.ADVANCED) {
setAdvancedMode(true);
} else {
setState2(_ChannelPermissionsUtils.isPrivateGuildChannel(stateFromStores));
setAdvancedMode(false);
}
setState(a0);
}, [stateFromStores]);
const r20 = [intl.string(t["Mw/UDN"]), intl.string(t["0a6awf"])];
if ((stateFromStores == null ? void 0 : stateFromStores.isGuildStageVoice()) === true) {
r20.push(intl.string(t.YIIUJ3));
}
const segmentedControlState = useSegmentedControlState({
pageWidth: 0,
defaultIndex: state,
onSetActiveIndex: callback,
items: r20.map((item) => ({
id: item,
label: item,
page: null
}))
});
useEffect(() => {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.CHANNEL_PERMISSIONS_PAGE_VIEWED, {
mode: state === c11171_25.BASIC ? SettingMode.BASIC : SettingMode.ADVANCED,
channel_is_private: _ChannelPermissionsUtils.isPrivateGuildChannel(stateFromStores)
});
}, [stateFromStores, state]);
return stateFromStores != null ? <View style={styles.container}>
<View style={{
paddingHorizontal: Module712.space.PX_12
}}>
<SegmentedControl state={segmentedControlState} />
</View>
<ScrollView style={styles.content}>
{state === r43.BASIC ? <ChannelPermissionSettingsBasicView channel={stateFromStores} privateToggleState={privateToggleState} setPrivateToggleState={setState2} /> : state === r43.MODERATORS ? <ViewModerators channel={stateFromStores} /> : <ChannelSettingsPermissionsOverview channelId={stateFromStores.id} />}
</ScrollView>
</View> : null;
};