mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 01:09:55 +00:00
[Glitch] Update labels in Posting defaults settings
Port 872044484c to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -351,6 +351,31 @@ const setInputDisabled = (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setInputHint = (
|
||||||
|
input: HTMLInputElement | HTMLSelectElement,
|
||||||
|
hintPrefix: string,
|
||||||
|
) => {
|
||||||
|
const fieldWrapper = input.closest<HTMLElement>('.fields-group > .input');
|
||||||
|
if (!fieldWrapper) return;
|
||||||
|
|
||||||
|
const hint = fieldWrapper.dataset[`${hintPrefix}Hint`];
|
||||||
|
const hintElement =
|
||||||
|
fieldWrapper.querySelector<HTMLSpanElement>(':scope > .hint');
|
||||||
|
|
||||||
|
if (hint) {
|
||||||
|
if (hintElement) {
|
||||||
|
hintElement.textContent = hint;
|
||||||
|
} else {
|
||||||
|
const newHintElement = document.createElement('span');
|
||||||
|
newHintElement.className = 'hint';
|
||||||
|
newHintElement.textContent = hint;
|
||||||
|
fieldWrapper.appendChild(newHintElement);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hintElement?.remove();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Rails.delegate(
|
Rails.delegate(
|
||||||
document,
|
document,
|
||||||
'#account_statuses_cleanup_policy_enabled',
|
'#account_statuses_cleanup_policy_enabled',
|
||||||
@@ -379,6 +404,8 @@ const updateDefaultQuotePrivacyFromPrivacy = (
|
|||||||
);
|
);
|
||||||
if (!select) return;
|
if (!select) return;
|
||||||
|
|
||||||
|
setInputHint(select, privacySelect.value);
|
||||||
|
|
||||||
if (privacySelect.value === 'private') {
|
if (privacySelect.value === 'private') {
|
||||||
select.value = 'nobody';
|
select.value = 'nobody';
|
||||||
setInputDisabled(select, true);
|
setInputDisabled(select, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user