diff --git a/src/components/chat/input.ts b/src/components/chat/input.ts index f58aa25e..a002b8c4 100644 --- a/src/components/chat/input.ts +++ b/src/components/chat/input.ts @@ -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); } diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts index fb1baa8c..009b9fd1 100644 --- a/src/lib/appManagers/appMessagesManager.ts +++ b/src/lib/appManagers/appMessagesManager.ts @@ -1924,7 +1924,7 @@ export class AppMessagesManager { keys.push('views', 'forwards'); } - if(!options.dropCaptions) { + if(!options.dropCaptions || !originalMessage.media) { keys.push('message'); }