mirror of https://github.com/procxx/kepka.git
Enforce changelog message visibility.
This commit is contained in:
parent
ceec71d3e6
commit
40532e32ab
|
@ -2554,20 +2554,8 @@ bool History::clearUnreadOnClientSide() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool History::skipUnreadUpdateForClientSideUnread() const {
|
|
||||||
if (peer->id != PeerData::kServiceNotificationsId) {
|
|
||||||
return false;
|
|
||||||
} else if (!_unreadCount || !*_unreadCount) {
|
|
||||||
return false;
|
|
||||||
} else if (!_lastMessage || IsServerMsgId((*_lastMessage)->id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool History::skipUnreadUpdate() const {
|
bool History::skipUnreadUpdate() const {
|
||||||
return skipUnreadUpdateForClientSideUnread()
|
return clearUnreadOnClientSide();
|
||||||
|| clearUnreadOnClientSide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void History::applyDialogFields(
|
void History::applyDialogFields(
|
||||||
|
|
|
@ -452,7 +452,6 @@ private:
|
||||||
void clearSendAction(not_null<UserData*> from);
|
void clearSendAction(not_null<UserData*> from);
|
||||||
bool clearUnreadOnClientSide() const;
|
bool clearUnreadOnClientSide() const;
|
||||||
bool skipUnreadUpdate() const;
|
bool skipUnreadUpdate() const;
|
||||||
bool skipUnreadUpdateForClientSideUnread() const;
|
|
||||||
|
|
||||||
HistoryItem *lastAvailableMessage() const;
|
HistoryItem *lastAvailableMessage() const;
|
||||||
void getNextFirstUnreadMessage();
|
void getNextFirstUnreadMessage();
|
||||||
|
|
|
@ -127,6 +127,22 @@ void InsertEmojiToField(not_null<Ui::InputField*> field, EmojiPtr emoji) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShowHistoryEndInsteadOfUnread(
|
||||||
|
not_null<Data::Session*> session,
|
||||||
|
PeerId peerId) {
|
||||||
|
// Ignore unread messages in case of unread changelogs.
|
||||||
|
// We must show this history at end for the changelog to be visible.
|
||||||
|
if (peerId != PeerData::kServiceNotificationsId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto history = session->history(peerId);
|
||||||
|
if (!history->unreadCount()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto last = history->lastMessage();
|
||||||
|
return (last != nullptr) && !IsServerMsgId(last->id);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ReportSpamPanel::ReportSpamPanel(QWidget *parent) : TWidget(parent),
|
ReportSpamPanel::ReportSpamPanel(QWidget *parent) : TWidget(parent),
|
||||||
|
@ -1504,9 +1520,12 @@ void HistoryWidget::showHistory(
|
||||||
MsgId wasMsgId = _showAtMsgId;
|
MsgId wasMsgId = _showAtMsgId;
|
||||||
History *wasHistory = _history;
|
History *wasHistory = _history;
|
||||||
|
|
||||||
bool startBot = (showAtMsgId == ShowAndStartBotMsgId);
|
const auto startBot = (showAtMsgId == ShowAndStartBotMsgId);
|
||||||
if (startBot) {
|
if (startBot) {
|
||||||
showAtMsgId = ShowAtTheEndMsgId;
|
showAtMsgId = ShowAtTheEndMsgId;
|
||||||
|
} else if ((showAtMsgId == ShowAtUnreadMsgId)
|
||||||
|
&& ShowHistoryEndInsteadOfUnread(&session().data(), peerId)) {
|
||||||
|
showAtMsgId = ShowAtTheEndMsgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearHighlightMessages();
|
clearHighlightMessages();
|
||||||
|
|
Loading…
Reference in New Issue