Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): PasswordProtect #2637

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Conversation

ImLvna
Copy link
Contributor

@ImLvna ImLvna commented Jun 28, 2024

PasswordProtect

Allows you to password protect your dms and channels!

A popup warning you that a channel is password protected

@Scyye
Copy link
Contributor

Scyye commented Jun 30, 2024

Use case?
As was mentioned in the thread, you can just simply disable the plugin, i think its fine as a TPP, but i dont (personally) see much reason for it to be included in the plugin list.

Comment on lines +13 to +21
await openModalLazy(async () => {
return modalProps => <PasswordModal modalProps={modalProps} channelId={channelId} type={ModalType.Access} callback={async password => {
if (password) {
cb(await checkPassword(password, channelId));
} else {
cb(false);
}
}} />;
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await openModalLazy(async () => {
return modalProps => <PasswordModal modalProps={modalProps} channelId={channelId} type={ModalType.Access} callback={async password => {
if (password) {
cb(await checkPassword(password, channelId));
} else {
cb(false);
}
}} />;
});
openModal(modalProps => (
<PasswordModal
modalProps={modalProps}
channelId={channelId}
type={ModalType.Access}
callback={async password => {
if (password) {
cb(await checkPassword(password, channelId));
} else {
cb(false);
}
}}
/>;
));

Comment on lines +22 to +42
{!isProtected && (
<>
<Menu.MenuItem
id="vc-password-protect-lock"
label="Lock"
color="brand"
action={() => openLockModal(channelId)}
/>
</>
)}

{isProtected && (
<>
<Menu.MenuItem
id="vc-password-protect-unlock"
label="Unlock"
color="danger"
action={() => openUnlockModal(channelId)}
/>
</>
)}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{!isProtected && (
<>
<Menu.MenuItem
id="vc-password-protect-lock"
label="Lock"
color="brand"
action={() => openLockModal(channelId)}
/>
</>
)}
{isProtected && (
<>
<Menu.MenuItem
id="vc-password-protect-unlock"
label="Unlock"
color="danger"
action={() => openUnlockModal(channelId)}
/>
</>
)}
{!isProtected
? <>
<Menu.MenuItem
id="vc-password-protect-lock"
label="Lock"
color="brand"
action={() => openLockModal(channelId)}
/>
</>
: <>
<Menu.MenuItem
id="vc-password-protect-unlock"
label="Unlock"
color="danger"
action={() => openUnlockModal(channelId)}
/>
</>
}

{
find: ".gatedContent,",
replacement: {
match: /this.props/,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too generic

],

patchProps(props: NSFWBlockProps) {
const channel = getCurrentChannel();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const channel = getCurrentChannel();
const channelId = SelectedChannelStore.getChannelId();

Comment on lines +21 to +26
export async function reloadChannel() {
const channel = getCurrentChannel();
NavigationRouter.transitionTo("/channels/@me");
await new Promise(r => setTimeout(r, 0));
NavigationRouter.transitionTo(`/channels/${channel.guild_id || "@me"}/${channel.id}`);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants