2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

updating edited messages dependencies (replies, edit / reply / pinned bar), postponing notification about pinned message while the message itself is not yet available

This commit is contained in:
John Preston
2016-03-11 15:20:58 +03:00
parent c36fc92041
commit 5cab9569c3
13 changed files with 345 additions and 39 deletions

View File

@@ -6267,6 +6267,15 @@ void HistoryWidget::itemRemoved(HistoryItem *item) {
}
}
void HistoryWidget::itemEdited(HistoryItem *item) {
if (item == _replyEditMsg) {
updateReplyEditTexts(true);
}
if (_pinnedBar && item->id == _pinnedBar->msgId) {
updatePinnedBar(true);
}
}
void HistoryWidget::updateScrollColors() {
if (!App::historyScrollBarColor()) return;
_scroll.updateColors(App::historyScrollBarColor(), App::historyScrollBgColor(), App::historyScrollBarOverColor(), App::historyScrollBgOverColor());
@@ -6785,12 +6794,19 @@ HistoryWidget::PinnedBar::PinnedBar(MsgId msgId, HistoryWidget *parent)
}
void HistoryWidget::updatePinnedBar(bool force) {
if (!_pinnedBar || _pinnedBar->msg) {
if (!_pinnedBar) {
return;
}
if (!force) {
if (_pinnedBar->msg) {
return;
}
}
t_assert(_history != nullptr);
_pinnedBar->msg = App::histItemById(_history->channelId(), _pinnedBar->msgId);
if (!_pinnedBar->msg) {
_pinnedBar->msg = App::histItemById(_history->channelId(), _pinnedBar->msgId);
}
if (_pinnedBar->msg) {
_pinnedBar->text.setText(st::msgFont, _pinnedBar->msg->inDialogsText(), _textDlgOptions);
} else if (force) {
@@ -7595,10 +7611,14 @@ void HistoryWidget::messageDataReceived(ChannelData *channel, MsgId msgId) {
}
void HistoryWidget::updateReplyEditTexts(bool force) {
if (_replyEditMsg || (!_editMsgId && !_replyToId)) {
return;
if (!force) {
if (_replyEditMsg || (!_editMsgId && !_replyToId)) {
return;
}
}
if (!_replyEditMsg) {
_replyEditMsg = App::histItemById(_channel, _editMsgId ? _editMsgId : _replyToId);
}
_replyEditMsg = App::histItemById(_channel, _editMsgId ? _editMsgId : _replyToId);
if (_replyEditMsg) {
_replyEditMsgText.setText(st::msgFont, _replyEditMsg->inDialogsText(), _textDlgOptions);