Fix dropped captions when the option is disabled
This commit is contained in:
parent
58dd3ac8b7
commit
99bf4ec3fb
@ -1981,7 +1981,7 @@ export default class ChatInput {
|
||||
silent: sendSilent,
|
||||
scheduleDate: scheduleDate,
|
||||
dropAuthor: this.forwardElements.hideSender.checkboxField.checked,
|
||||
dropCaptions: this.forwardElements.hideCaption.checkboxField.checked
|
||||
dropCaptions: this.isDroppingCaptions()
|
||||
});
|
||||
}
|
||||
|
||||
@ -2035,6 +2035,10 @@ export default class ChatInput {
|
||||
findUpTag(hideCaptionCheckboxField.label, 'FORM').classList.contains('hide');
|
||||
}
|
||||
|
||||
private isDroppingCaptions() {
|
||||
return !this.canToggleHideAuthor();
|
||||
}
|
||||
|
||||
/* public sendSomething(callback: () => void, force = false) {
|
||||
if(this.chat.type === 'scheduled' && !force) {
|
||||
this.scheduleSending(() => this.sendSomething(callback, true));
|
||||
@ -2099,6 +2103,15 @@ export default class ChatInput {
|
||||
}
|
||||
});
|
||||
|
||||
const form = findUpTag(this.forwardElements.showCaption.checkboxField.label, 'FORM');
|
||||
form.classList.toggle('hide', !messagesWithCaptionsLength);
|
||||
const hideCaption = this.forwardElements.hideCaption.checkboxField.checked;
|
||||
if(messagesWithCaptionsLength && hideCaption) {
|
||||
this.forwardElements.hideSender.checkboxField.setValueSilently(true);
|
||||
} else if(this.forwardWasDroppingAuthor !== undefined) {
|
||||
(this.forwardWasDroppingAuthor ? this.forwardElements.hideSender : this.forwardElements.showSender).checkboxField.setValueSilently(true);
|
||||
}
|
||||
|
||||
const titleKey: LangPackKey = this.forwardElements.showSender.checkboxField.checked ? 'Chat.Accessory.Forward' : 'Chat.Accessory.Hidden';
|
||||
const title = i18n(titleKey, [length]);
|
||||
|
||||
@ -2151,15 +2164,6 @@ export default class ChatInput {
|
||||
intl.update();
|
||||
});
|
||||
|
||||
const form = findUpTag(this.forwardElements.showCaption.checkboxField.label, 'FORM');
|
||||
form.classList.toggle('hide', !messagesWithCaptionsLength);
|
||||
const hideCaption = this.forwardElements.hideCaption.checkboxField.checked;
|
||||
if(messagesWithCaptionsLength && hideCaption) {
|
||||
this.forwardElements.hideSender.checkboxField.setValueSilently(true);
|
||||
} else if(this.forwardWasDroppingAuthor !== undefined) {
|
||||
(this.forwardWasDroppingAuthor ? this.forwardElements.hideSender : this.forwardElements.showSender).checkboxField.setValueSilently(true);
|
||||
}
|
||||
|
||||
if(this.forwardHover) {
|
||||
this.forwardHover.attachButtonListener(newReply, this.listenerSetter);
|
||||
}
|
||||
|
@ -1924,7 +1924,7 @@ export class AppMessagesManager {
|
||||
keys.push('views', 'forwards');
|
||||
}
|
||||
|
||||
if(!options.dropCaptions) {
|
||||
if(!options.dropCaptions || !originalMessage.media) {
|
||||
keys.push('message');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user