Set preview as cancelled if no preview in editing message.
This commit is contained in:
		
							parent
							
								
									61f6851486
								
							
						
					
					
						commit
						dd401a063b
					
				
					 2 changed files with 21 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -1327,7 +1327,7 @@ void HistoryWidget::fieldChanged() {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	updateSendButtonType();
 | 
			
		||||
	if (showRecordButton()) {
 | 
			
		||||
	if (!HasSendText(_field)) {
 | 
			
		||||
		_previewCancelled = false;
 | 
			
		||||
	}
 | 
			
		||||
	if (updateCmdStartShown()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -5682,20 +5682,24 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
 | 
			
		|||
		editData.text.size(),
 | 
			
		||||
		QFIXED_MAX
 | 
			
		||||
	};
 | 
			
		||||
	const auto previewPage = [&]() -> WebPageData* {
 | 
			
		||||
		if (const auto media = item->media()) {
 | 
			
		||||
			return media->webpage();
 | 
			
		||||
		}
 | 
			
		||||
		return nullptr;
 | 
			
		||||
	}();
 | 
			
		||||
	const auto previewCancelled = !previewPage;
 | 
			
		||||
	_history->setLocalEditDraft(std::make_unique<Data::Draft>(
 | 
			
		||||
		editData,
 | 
			
		||||
		item->id,
 | 
			
		||||
		cursor,
 | 
			
		||||
		false));
 | 
			
		||||
		previewCancelled));
 | 
			
		||||
	applyDraft();
 | 
			
		||||
 | 
			
		||||
	_previewData = nullptr;
 | 
			
		||||
	if (const auto media = item->media()) {
 | 
			
		||||
		if (const auto page = media->webpage()) {
 | 
			
		||||
			_previewData = page;
 | 
			
		||||
	_previewData = previewPage;
 | 
			
		||||
	if (_previewData) {
 | 
			
		||||
		updatePreview();
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	updateBotKeyboard();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1223,7 +1223,7 @@ void ComposeControls::fieldChanged() {
 | 
			
		|||
		_sendActionUpdates.fire({ Api::SendProgressType::Typing });
 | 
			
		||||
	}
 | 
			
		||||
	updateSendButtonType();
 | 
			
		||||
	if (showRecordButton()) {
 | 
			
		||||
	if (!HasSendText(_field)) {
 | 
			
		||||
		_previewCancelled = false;
 | 
			
		||||
	}
 | 
			
		||||
	if (updateBotCommandShown()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1831,13 +1831,20 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
 | 
			
		|||
		editData.text.size(),
 | 
			
		||||
		QFIXED_MAX
 | 
			
		||||
	};
 | 
			
		||||
	const auto previewPage = [&]() -> WebPageData* {
 | 
			
		||||
		if (const auto media = item->media()) {
 | 
			
		||||
			return media->webpage();
 | 
			
		||||
		}
 | 
			
		||||
		return nullptr;
 | 
			
		||||
	}();
 | 
			
		||||
	const auto previewCancelled = !previewPage;
 | 
			
		||||
	_history->setDraft(
 | 
			
		||||
		draftKey(DraftType::Edit),
 | 
			
		||||
		std::make_unique<Data::Draft>(
 | 
			
		||||
			editData,
 | 
			
		||||
			item->id,
 | 
			
		||||
			cursor,
 | 
			
		||||
			false));
 | 
			
		||||
			previewCancelled));
 | 
			
		||||
	applyDraft();
 | 
			
		||||
 | 
			
		||||
	if (_autocomplete) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue