Fix unread counter in General topic.
This commit is contained in:
parent
9c23de7f1a
commit
91ab82c9da
|
@ -282,9 +282,11 @@ Data::Draft *History::createCloudDraft(
|
||||||
} else {
|
} else {
|
||||||
auto existing = cloudDraft(topicRootId);
|
auto existing = cloudDraft(topicRootId);
|
||||||
if (!existing) {
|
if (!existing) {
|
||||||
|
auto reply = fromDraft->reply;
|
||||||
|
reply.topicRootId = topicRootId;
|
||||||
setCloudDraft(std::make_unique<Data::Draft>(
|
setCloudDraft(std::make_unique<Data::Draft>(
|
||||||
fromDraft->textWithTags,
|
fromDraft->textWithTags,
|
||||||
fromDraft->reply,
|
reply,
|
||||||
fromDraft->cursor,
|
fromDraft->cursor,
|
||||||
fromDraft->webpage));
|
fromDraft->webpage));
|
||||||
existing = cloudDraft(topicRootId);
|
existing = cloudDraft(topicRootId);
|
||||||
|
|
|
@ -1845,8 +1845,10 @@ void HistoryItem::destroyHistoryEntry() {
|
||||||
topic->unreadReactions().erase(id);
|
topic->unreadReactions().erase(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (const auto reply = Get<HistoryMessageReply>()) {
|
if (isRegular() && _history->peer->isMegagroup()) {
|
||||||
changeReplyToTopCounter(reply, -1);
|
if (const auto reply = Get<HistoryMessageReply>()) {
|
||||||
|
changeReplyToTopCounter(reply, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1905,21 +1907,19 @@ void HistoryItem::removeFromSharedMediaIndex() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryItem::incrementReplyToTopCounter() {
|
void HistoryItem::incrementReplyToTopCounter() {
|
||||||
if (const auto reply = Get<HistoryMessageReply>()) {
|
if (isRegular() && _history->peer->isMegagroup()) {
|
||||||
changeReplyToTopCounter(reply, 1);
|
_history->session().changes().messageUpdated(
|
||||||
|
this,
|
||||||
|
Data::MessageUpdate::Flag::ReplyToTopAdded);
|
||||||
|
if (const auto reply = Get<HistoryMessageReply>()) {
|
||||||
|
changeReplyToTopCounter(reply, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryItem::changeReplyToTopCounter(
|
void HistoryItem::changeReplyToTopCounter(
|
||||||
not_null<HistoryMessageReply*> reply,
|
not_null<HistoryMessageReply*> reply,
|
||||||
int delta) {
|
int delta) {
|
||||||
if (!isRegular() || !_history->peer->isMegagroup()) {
|
|
||||||
return;
|
|
||||||
} else if (delta > 0) {
|
|
||||||
_history->session().changes().messageUpdated(
|
|
||||||
this,
|
|
||||||
Data::MessageUpdate::Flag::ReplyToTopAdded);
|
|
||||||
}
|
|
||||||
const auto topId = reply->topMessageId();
|
const auto topId = reply->topMessageId();
|
||||||
if (!topId) {
|
if (!topId) {
|
||||||
return;
|
return;
|
||||||
|
@ -1975,7 +1975,7 @@ void HistoryItem::setRealId(MsgId newId) {
|
||||||
if (reply->link()) {
|
if (reply->link()) {
|
||||||
reply->setLinkFrom(this);
|
reply->setLinkFrom(this);
|
||||||
}
|
}
|
||||||
changeReplyToTopCounter(reply, 1);
|
incrementReplyToTopCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2688,7 +2688,7 @@ void HistoryItem::setReplyFields(
|
||||||
&& !IsServerMsgId(reply->topMessageId());
|
&& !IsServerMsgId(reply->topMessageId());
|
||||||
reply->updateFields(this, replyTo, replyToTop, isForumPost);
|
reply->updateFields(this, replyTo, replyToTop, isForumPost);
|
||||||
if (increment) {
|
if (increment) {
|
||||||
changeReplyToTopCounter(reply, 1);
|
incrementReplyToTopCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (const auto topic = this->topic()) {
|
if (const auto topic = this->topic()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user