mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
[Glitch] Split invite_users permission into invite_bypass_approval
Port 1ee457f2d3 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -166,6 +166,38 @@ on('change', '#domain_block_severity', ({ target }) => {
|
||||
if (target instanceof HTMLSelectElement) onDomainBlockSeverityChange(target);
|
||||
});
|
||||
|
||||
const onChangeInviteUsersPermission = (target: HTMLInputElement) => {
|
||||
const inviteBypassApprovalCheckbox = document.querySelector<HTMLInputElement>(
|
||||
'input#user_role_permissions_as_keys_invite_bypass_approval',
|
||||
);
|
||||
|
||||
if (inviteBypassApprovalCheckbox) {
|
||||
inviteBypassApprovalCheckbox.disabled = !target.checked;
|
||||
|
||||
if (target.checked) {
|
||||
inviteBypassApprovalCheckbox.parentElement?.classList.remove('disabled');
|
||||
inviteBypassApprovalCheckbox.parentElement?.parentElement?.classList.remove(
|
||||
'disabled',
|
||||
);
|
||||
} else {
|
||||
inviteBypassApprovalCheckbox.parentElement?.classList.add('disabled');
|
||||
inviteBypassApprovalCheckbox.parentElement?.parentElement?.classList.add(
|
||||
'disabled',
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
on(
|
||||
'change',
|
||||
'input#user_role_permissions_as_keys_invite_users',
|
||||
({ target }) => {
|
||||
if (target instanceof HTMLInputElement) {
|
||||
onChangeInviteUsersPermission(target);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function onEnableBootstrapTimelineAccountsChange(target: HTMLInputElement) {
|
||||
const bootstrapTimelineAccountsField =
|
||||
document.querySelector<HTMLInputElement>(
|
||||
@@ -291,6 +323,13 @@ ready(() => {
|
||||
);
|
||||
if (registrationMode) onChangeRegistrationMode(registrationMode);
|
||||
|
||||
const inviteUsersPermissionChecbkox =
|
||||
document.querySelector<HTMLInputElement>(
|
||||
'input#user_role_permissions_as_keys_invite_users',
|
||||
);
|
||||
if (inviteUsersPermissionChecbkox)
|
||||
onChangeInviteUsersPermission(inviteUsersPermissionChecbkox);
|
||||
|
||||
const checkAllElement = document.querySelector<HTMLInputElement>(
|
||||
'#batch_checkbox_all',
|
||||
);
|
||||
|
||||
@@ -507,6 +507,10 @@ code {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
label.checkbox {
|
||||
|
||||
Reference in New Issue
Block a user