mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-17 07:43:17 +00:00
Update labels in Posting defaults settings (#36084)
This commit is contained in:
parent
e35dfbfdef
commit
872044484c
117 changed files with 38 additions and 120 deletions
|
|
@ -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(
|
||||
document,
|
||||
'#account_statuses_cleanup_policy_enabled',
|
||||
|
|
@ -379,6 +404,8 @@ const updateDefaultQuotePrivacyFromPrivacy = (
|
|||
);
|
||||
if (!select) return;
|
||||
|
||||
setInputHint(select, privacySelect.value);
|
||||
|
||||
if (privacySelect.value === 'private') {
|
||||
select.value = 'nobody';
|
||||
setInputDisabled(select, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue