Fix setting chat reactions

This commit is contained in:
Eduard Kuzmenko 2022-02-11 21:13:46 +04:00
parent 9f4fbab03f
commit abb1c021f6
2 changed files with 4 additions and 3 deletions

View File

@ -84,10 +84,10 @@ export default class AppChatReactionsTab extends SliderSuperTabEventable {
this.listenerSetter.add(toggleRow.checkboxField.input)('change', () => {
if(!toggleCheckboxField.checked) {
checkboxFields.forEach(checkboxField => checkboxField.setValueSilently(false));
checkboxFields.forEach(checkboxField => checkboxField.checked = false);
saveReactionsDebounced();
} else if(checkboxFields.every(checkboxField => !checkboxField.checked)) {
checkboxFields.forEach(checkboxField => checkboxField.setValueSilently(true));
checkboxFields.forEach(checkboxField => checkboxField.checked = true);
saveReactionsDebounced();
}
});

View File

@ -150,7 +150,8 @@ export default class AppEditChatTab extends SliderSuperTab {
const availableReactions = await appReactionsManager.getAvailableReactions();
const availableReactionsLength = availableReactions.filter(availableReaction => !availableReaction.pFlags.inactive).length;
const setReactionsLength = () => {
reactionsRow.subtitle.innerHTML = chatFull.available_reactions.length + '/' + availableReactionsLength;
const reactions = chatFull.available_reactions ?? [];
reactionsRow.subtitle.innerHTML = reactions.length + '/' + availableReactionsLength;
};
setReactionsLength();