mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Use correct text update for summarize.
This commit is contained in:
@@ -1670,18 +1670,20 @@ void Element::validateText() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
const auto &summary
|
||||
= item->history()->session().api().transcribes().summary(item);
|
||||
if (!summary.result.empty() && summary.shown) {
|
||||
const auto summaryShownWas = (_flags & Flag::SummaryShown) != 0;
|
||||
const auto transcribes = &history()->session().api().transcribes();
|
||||
const auto &summary = transcribes->summary(item);
|
||||
const auto summaryShownNow = !summary.result.empty() && summary.shown;
|
||||
const auto summaryShownChanged = (summaryShownWas != summaryShownNow);
|
||||
if (summaryShownNow) {
|
||||
_flags |= Flag::SummaryShown;
|
||||
if (summaryShownChanged) {
|
||||
_textItem = item;
|
||||
setTextWithLinks(summary.result);
|
||||
return;
|
||||
}
|
||||
if (!summary.result.empty() && !summary.shown) {
|
||||
_textItem = item;
|
||||
setTextWithLinks(item->originalText());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
_flags &= ~Flag::SummaryShown;
|
||||
}
|
||||
|
||||
// Albums may show text of a different item than the parent one.
|
||||
@@ -1693,7 +1695,7 @@ void Element::validateText() {
|
||||
return;
|
||||
}
|
||||
const auto &text = _textItem->_text;
|
||||
if (_text.isEmpty() == text.empty()) {
|
||||
if (!summaryShownChanged && _text.isEmpty() == text.empty()) {
|
||||
} else if (_flags & Flag::ServiceMessage) {
|
||||
const auto contextDependentText = contextDependentServiceText();
|
||||
const auto &markedText = contextDependentText.text.empty()
|
||||
|
||||
@@ -397,6 +397,7 @@ public:
|
||||
TopicRootReply = 0x0400,
|
||||
MediaOverriden = 0x0800,
|
||||
HeavyCustomEmoji = 0x1000,
|
||||
SummaryShown = 0x2000,
|
||||
};
|
||||
using Flags = base::flags<Flag>;
|
||||
friend inline constexpr auto is_flag_type(Flag) { return true; }
|
||||
|
||||
Reference in New Issue
Block a user