34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// Metro module 12811 (f12812).
|
|
import GuildChannelStore from "../GuildChannelStore";
|
|
import UserStore from "../UserStore";
|
|
import { MFALevels } from "../../Constants";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let mfaEnabled;
|
|
const handleUserStoreUpdates = function handleUserStoreUpdates() {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser != null && currentUser.mfaEnabled !== mfaEnabled) {
|
|
mfaEnabled = currentUser.mfaEnabled;
|
|
return void 0;
|
|
}
|
|
return false;
|
|
};
|
|
mfaEnabled = null;
|
|
class GuildMFAWarningStore extends Module589.Store {
|
|
static displayName = "GuildMFAWarningStore";
|
|
initialize() {
|
|
this.waitFor(UserStore, GuildChannelStore);
|
|
this.syncWith([UserStore, GuildChannelStore], handleUserStoreUpdates);
|
|
}
|
|
isVisible(a0) {
|
|
return a0 != null && a0.mfaLevel === MFALevels.ELEVATED && mfaEnabled === false && GuildChannelStore.hasElevatedPermissions(a0.id);
|
|
}
|
|
}
|
|
const guildMFAWarningStore = new GuildMFAWarningStore(Dispatcher, {
|
|
CONNECTION_OPEN: handleUserStoreUpdates,
|
|
GUILD_UPDATE: function handleGuildPermissionsUpdate() {
|
|
return true;
|
|
}
|
|
});
|
|
export default guildMFAWarningStore;
|