mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-26 19:14:02 +02:00
Remove comments info if no info in server data.
This commit is contained in:
parent
d642c3f3b5
commit
3a700650be
4 changed files with 20 additions and 0 deletions
|
@ -1764,6 +1764,8 @@ bool Session::checkEntitiesAndViewsUpdate(const MTPDmessage &data) {
|
||||||
existing->setViewsCount(data.vviews().value_or(-1));
|
existing->setViewsCount(data.vviews().value_or(-1));
|
||||||
if (const auto replies = data.vreplies()) {
|
if (const auto replies = data.vreplies()) {
|
||||||
existing->setReplies(*replies);
|
existing->setReplies(*replies);
|
||||||
|
} else {
|
||||||
|
existing->clearReplies();
|
||||||
}
|
}
|
||||||
existing->setForwardsCount(data.vforwards().value_or(-1));
|
existing->setForwardsCount(data.vforwards().value_or(-1));
|
||||||
if (const auto reply = data.vreply_to()) {
|
if (const auto reply = data.vreply_to()) {
|
||||||
|
|
|
@ -287,6 +287,8 @@ public:
|
||||||
}
|
}
|
||||||
virtual void setReplies(const MTPMessageReplies &data) {
|
virtual void setReplies(const MTPMessageReplies &data) {
|
||||||
}
|
}
|
||||||
|
virtual void clearReplies() {
|
||||||
|
}
|
||||||
virtual void changeRepliesCount(int delta, PeerId replier) {
|
virtual void changeRepliesCount(int delta, PeerId replier) {
|
||||||
}
|
}
|
||||||
virtual void setReplyToTop(MsgId replyToTop) {
|
virtual void setReplyToTop(MsgId replyToTop) {
|
||||||
|
|
|
@ -1631,6 +1631,21 @@ void HistoryMessage::setReplies(const MTPMessageReplies &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryMessage::clearReplies() {
|
||||||
|
auto views = Get<HistoryMessageViews>();
|
||||||
|
if (!views) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto viewsPart = views->views;
|
||||||
|
if (viewsPart.count < 0) {
|
||||||
|
RemoveComponents(HistoryMessageViews::Bit());
|
||||||
|
} else {
|
||||||
|
*views = HistoryMessageViews();
|
||||||
|
views->views = viewsPart;
|
||||||
|
}
|
||||||
|
history()->owner().requestItemResize(this);
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryMessage::refreshRepliesText(
|
void HistoryMessage::refreshRepliesText(
|
||||||
not_null<HistoryMessageViews*> views,
|
not_null<HistoryMessageViews*> views,
|
||||||
bool forceResize) {
|
bool forceResize) {
|
||||||
|
|
|
@ -126,6 +126,7 @@ public:
|
||||||
void setViewsCount(int count) override;
|
void setViewsCount(int count) override;
|
||||||
void setForwardsCount(int count) override;
|
void setForwardsCount(int count) override;
|
||||||
void setReplies(const MTPMessageReplies &data) override;
|
void setReplies(const MTPMessageReplies &data) override;
|
||||||
|
void clearReplies() override;
|
||||||
void changeRepliesCount(int delta, PeerId replier) override;
|
void changeRepliesCount(int delta, PeerId replier) override;
|
||||||
void setReplyToTop(MsgId replyToTop) override;
|
void setReplyToTop(MsgId replyToTop) override;
|
||||||
void setRealId(MsgId newId) override;
|
void setRealId(MsgId newId) override;
|
||||||
|
|
Loading…
Add table
Reference in a new issue