mirror of https://github.com/procxx/kepka.git
				
				
				
			Recount grouping after leader caption edit.
This commit is contained in:
		
							parent
							
								
									963e969d2a
								
							
						
					
					
						commit
						1f070da202
					
				| 
						 | 
					@ -2125,6 +2125,15 @@ not_null<HistoryItem*> History::findGroupLast(
 | 
				
			||||||
	return group->leader;
 | 
						return group->leader;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void History::recountGroupingAround(not_null<HistoryItem*> item) {
 | 
				
			||||||
 | 
						Expects(item->history() == this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!item->detached() && item->groupId()) {
 | 
				
			||||||
 | 
							const auto [groupFrom, groupTill] = recountGroupingFromTill(item);
 | 
				
			||||||
 | 
							recountGrouping(groupFrom, groupTill);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto History::recountGroupingFromTill(not_null<HistoryItem*> item)
 | 
					auto History::recountGroupingFromTill(not_null<HistoryItem*> item)
 | 
				
			||||||
-> std::pair<not_null<HistoryItem*>, not_null<HistoryItem*>> {
 | 
					-> std::pair<not_null<HistoryItem*>, not_null<HistoryItem*>> {
 | 
				
			||||||
	const auto recountFromItem = [&] {
 | 
						const auto recountFromItem = [&] {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -422,6 +422,7 @@ public:
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	HistoryItemsList validateForwardDraft();
 | 
						HistoryItemsList validateForwardDraft();
 | 
				
			||||||
	void setForwardDraft(MessageIdsList &&items);
 | 
						void setForwardDraft(MessageIdsList &&items);
 | 
				
			||||||
 | 
						void recountGroupingAround(not_null<HistoryItem*> item);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// some fields below are a property of a currently displayed instance of this
 | 
						// some fields below are a property of a currently displayed instance of this
 | 
				
			||||||
	// conversation history not a property of the conversation history itself
 | 
						// conversation history not a property of the conversation history itself
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -393,6 +393,10 @@ ImagePtr HistoryGroupedMedia::replyPreview() {
 | 
				
			||||||
	return main()->replyPreview();
 | 
						return main()->replyPreview();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TextWithEntities HistoryGroupedMedia::getCaption() const {
 | 
				
			||||||
 | 
						return main()->getCaption();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Storage::SharedMediaTypesMask HistoryGroupedMedia::sharedMediaTypes() const {
 | 
					Storage::SharedMediaTypesMask HistoryGroupedMedia::sharedMediaTypes() const {
 | 
				
			||||||
	return main()->sharedMediaTypes();
 | 
						return main()->sharedMediaTypes();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -91,8 +91,9 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool hasReplyPreview() const override;
 | 
						bool hasReplyPreview() const override;
 | 
				
			||||||
	ImagePtr replyPreview() override;
 | 
						ImagePtr replyPreview() override;
 | 
				
			||||||
 | 
						TextWithEntities getCaption() const override;
 | 
				
			||||||
	Storage::SharedMediaTypesMask sharedMediaTypes() const override;
 | 
						Storage::SharedMediaTypesMask sharedMediaTypes() const override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool canBeGrouped() const override {
 | 
						bool canBeGrouped() const override {
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1608,6 +1608,7 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) {
 | 
				
			||||||
		_textWidth = -1;
 | 
							_textWidth = -1;
 | 
				
			||||||
		_textHeight = 0;
 | 
							_textHeight = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						_history->recountGroupingAround(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
 | 
					void HistoryMessage::setText(const TextWithEntities &textWithEntities) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue