Fix clearing cloud draft on message send.
Regression was introduced in 20ba417ddd.
			
			
This commit is contained in:
		
							parent
							
								
									98bd5757b0
								
							
						
					
					
						commit
						d4d2eef291
					
				
					 1 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -3582,11 +3582,12 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
 | 
			
		|||
	sendAction(action);
 | 
			
		||||
 | 
			
		||||
	const auto clearCloudDraft = action.clearDraft;
 | 
			
		||||
	const auto draftTopicRootId = action.replyTo.topicRootId;
 | 
			
		||||
	const auto replyTo = action.replyTo.messageId
 | 
			
		||||
		? peer->owner().message(action.replyTo.messageId)
 | 
			
		||||
		: nullptr;
 | 
			
		||||
	const auto topicRootId = action.replyTo.topicRootId
 | 
			
		||||
		? action.replyTo.topicRootId
 | 
			
		||||
	const auto topicRootId = draftTopicRootId
 | 
			
		||||
		? draftTopicRootId
 | 
			
		||||
		: replyTo
 | 
			
		||||
		? replyTo->topicRootId()
 | 
			
		||||
		: Data::ForumTopic::kGeneralId;
 | 
			
		||||
| 
						 | 
				
			
			@ -3626,7 +3627,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
 | 
			
		|||
		TextUtilities::Trim(sending);
 | 
			
		||||
 | 
			
		||||
		_session->data().registerMessageRandomId(randomId, newId);
 | 
			
		||||
		_session->data().registerMessageSentData(randomId, peer->id, sending.text);
 | 
			
		||||
		_session->data().registerMessageSentData(
 | 
			
		||||
			randomId,
 | 
			
		||||
			peer->id,
 | 
			
		||||
			sending.text);
 | 
			
		||||
 | 
			
		||||
		MTPstring msgText(MTP_string(sending.text));
 | 
			
		||||
		auto flags = NewMessageFlags(peer);
 | 
			
		||||
| 
						 | 
				
			
			@ -3688,8 +3692,8 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
 | 
			
		|||
		if (clearCloudDraft) {
 | 
			
		||||
			sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
 | 
			
		||||
			mediaFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
 | 
			
		||||
			history->clearCloudDraft(topicRootId);
 | 
			
		||||
			history->startSavingCloudDraft(topicRootId);
 | 
			
		||||
			history->clearCloudDraft(draftTopicRootId);
 | 
			
		||||
			history->startSavingCloudDraft(draftTopicRootId);
 | 
			
		||||
		}
 | 
			
		||||
		const auto sendAs = action.options.sendAs;
 | 
			
		||||
		const auto messageFromId = sendAs
 | 
			
		||||
| 
						 | 
				
			
			@ -3726,7 +3730,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
 | 
			
		|||
				const MTP::Response &response) {
 | 
			
		||||
			if (clearCloudDraft) {
 | 
			
		||||
				history->finishSavingCloudDraft(
 | 
			
		||||
					topicRootId,
 | 
			
		||||
					draftTopicRootId,
 | 
			
		||||
					UnixtimeFromMsgId(response.outerMsgId));
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
| 
						 | 
				
			
			@ -3740,7 +3744,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
 | 
			
		|||
			}
 | 
			
		||||
			if (clearCloudDraft) {
 | 
			
		||||
				history->finishSavingCloudDraft(
 | 
			
		||||
					topicRootId,
 | 
			
		||||
					draftTopicRootId,
 | 
			
		||||
					UnixtimeFromMsgId(response.outerMsgId));
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue