mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-11 11:47:09 +02:00
fix: ttl messages hint
This commit is contained in:
parent
277a2edb57
commit
7c940a0480
1 changed files with 34 additions and 2 deletions
|
@ -3095,7 +3095,12 @@ void HistoryItem::setDeleted() {
|
|||
_deleted = true;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
setAyuHint(settings->deletedMark);
|
||||
if (settings->replaceBottomInfoWithIcons) {
|
||||
history()->owner().requestItemViewRefresh(this);
|
||||
history()->owner().requestItemResize(this);
|
||||
} else {
|
||||
setAyuHint(settings->deletedMark);
|
||||
}
|
||||
}
|
||||
|
||||
bool HistoryItem::isDeleted() const {
|
||||
|
@ -3104,7 +3109,32 @@ bool HistoryItem::isDeleted() const {
|
|||
|
||||
void HistoryItem::setAyuHint(const QString &hint) {
|
||||
try {
|
||||
if (isService() && !_text.empty()) {
|
||||
auto msgsigned = Get<HistoryMessageSigned>();
|
||||
if (hint.isEmpty()) {
|
||||
if (!msgsigned) {
|
||||
return;
|
||||
}
|
||||
RemoveComponents(HistoryMessageSigned::Bit());
|
||||
history()->owner().requestItemViewRefresh(this);
|
||||
history()->owner().requestItemResize(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isService()) {
|
||||
if (!(_flags & MessageFlag::HasPostAuthor)) {
|
||||
_flags |= MessageFlag::HasPostAuthor;
|
||||
}
|
||||
|
||||
if (!msgsigned) {
|
||||
AddComponents(HistoryMessageSigned::Bit());
|
||||
msgsigned = Get<HistoryMessageSigned>();
|
||||
} else if (msgsigned->author == hint) {
|
||||
return;
|
||||
}
|
||||
msgsigned->author = hint;
|
||||
msgsigned->isAnonymousRank = !isDiscussionPost()
|
||||
&& this->author()->isMegagroup();
|
||||
} else if (/* isService() && */!_text.empty()) {
|
||||
const auto data = Get<HistoryServiceData>();
|
||||
const auto postfix = QString(" (%1)").arg(hint);
|
||||
if (!_text.text.endsWith(postfix)) { // fix stacking for TTL messages
|
||||
|
@ -3114,6 +3144,8 @@ void HistoryItem::setAyuHint(const QString &hint) {
|
|||
};
|
||||
setServiceText(std::move(prepared));
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// update bottom info
|
||||
|
|
Loading…
Add table
Reference in a new issue