diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index dede730328..f8ac55a2d2 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -292,11 +292,11 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt channel->flagsUpdated(); } ChatData *cfrom = App::chat(peerFromChat(f.vmigrated_from_chat_id)); - bool updated = (cfrom->migrateToPtr != channel); - if (updated) { + bool updatedTo = (cfrom->migrateToPtr != channel), updatedFrom = (channel->mgInfo->migrateFromPtr != cfrom); + if (updatedTo) { cfrom->migrateToPtr = channel; } - if (channel->mgInfo->migrateFromPtr != cfrom) { + if (updatedFrom) { channel->mgInfo->migrateFromPtr = cfrom; if (History *h = App::historyLoaded(cfrom->id)) { if (History *hto = App::historyLoaded(channel->id)) { @@ -308,8 +308,10 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt } } } + Notify::migrateUpdated(channel); } - if (updated) { + if (updatedTo) { + Notify::migrateUpdated(cfrom); App::main()->peerUpdated(cfrom); } } @@ -344,9 +346,6 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt h->inboxReadBefore = f.vread_inbox_max_id.v + 1; h->asChannelHistory()->unreadCountAll = f.vunread_count.v; } - if (channel->migrateFrom()) { - h->asChannelHistory()->removeJoinedMessage(); - } } channel->fullUpdated(); @@ -449,7 +448,7 @@ void ApiWrap::requestLastParticipants(ChannelData *peer, bool fromStart) { return; } } - mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(1)), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer)); + mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer)); _participantsRequests.insert(peer, fromStart ? req : -req); } diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 1db2443764..143f00a712 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -510,10 +510,11 @@ namespace App { channel->inputChannel = d.vmigrated_to; channel->access = d.vmigrated_to.c_inputChannel().vaccess_hash.v; } - if (cdata->migrateToPtr != channel) { + bool updatedTo = (cdata->migrateToPtr != channel), updatedFrom = (channel->mgInfo->migrateFromPtr != cdata); + if (updatedTo) { cdata->migrateToPtr = channel; } - if (channel->mgInfo->migrateFromPtr != cdata) { + if (updatedFrom) { channel->mgInfo->migrateFromPtr = cdata; if (History *h = App::historyLoaded(cdata->id)) { if (History *hto = App::historyLoaded(channel->id)) { @@ -525,6 +526,10 @@ namespace App { } } } + Notify::migrateUpdated(channel); + } + if (updatedTo) { + Notify::migrateUpdated(cdata); } } @@ -1044,8 +1049,13 @@ namespace App { } (*j)->destroy(); if (!h->lastMsg) historiesToCheck.insert(h, true); - } else if (channelHistory) { - channelHistory->messageWithIdDeleted(i->v); + } else { + if (channelHistory) { + channelHistory->messageWithIdDeleted(i->v); + if (channelHistory->unreadCount > 0 && i->v >= channelHistory->inboxReadBefore) { + channelHistory->setUnreadCount(channelHistory->unreadCount - 1); + } + } } } if (resized) { @@ -2862,4 +2872,10 @@ namespace Notify { } } + void migrateUpdated(PeerData *peer) { + if (MainWidget *m = App::main()) { + m->notifyMigrateUpdated(peer); + } + } + } diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index e1aaae4f15..dd6c07c7f7 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -317,6 +317,9 @@ namespace App { }; namespace Notify { + void userIsBotChanged(UserData *user); void botCommandsChanged(UserData *user); + void migrateUpdated(PeerData *peer); + }; diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 0bd1e2cd75..e8aa366243 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -309,8 +309,8 @@ enum { DialogsFirstLoad = 20, // first dialogs part size requested DialogsPerPage = 500, // next dialogs part size - MessagesFirstLoad = 3, // first history part size requested - MessagesPerPage = 3, // next history part size + MessagesFirstLoad = 30, // first history part size requested + MessagesPerPage = 50, // next history part size FileLoaderQueueStopTimeout = 5000, diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 18520147a0..c61ae5eecc 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -1756,6 +1756,7 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs, mtpReque App::feedChats(data.vchats); m = &data.vmessages.c_vector().v; v = &data.vdialogs.c_vector().v; + _dialogsFull = true; } break; case mtpc_messages_dialogsSlice: { const MTPDmessages_dialogsSlice &data(dialogs.c_messages_dialogsSlice()); @@ -1954,8 +1955,7 @@ void DialogsWidget::loadDialogs() { return; } - int32 loadCount = (!cTestMode() || _dialogsOffsetDate) ? DialogsPerPage : DialogsFirstLoad; - if (!cTestMode() && _dialogsOffsetDate) return; + int32 loadCount = _dialogsOffsetDate ? DialogsPerPage : DialogsFirstLoad; _dialogsRequest = MTP::send(MTPmessages_GetDialogs(MTP_int(_dialogsOffsetDate), MTP_int(_dialogsOffsetId), _dialogsOffsetPeer ? _dialogsOffsetPeer->input : MTP_inputPeerEmpty(), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); } diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 606b731079..8744a6c281 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -703,7 +703,7 @@ void ChannelHistory::addNewGroup(const MTPMessageGroup &group) { } HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { - if (_joinedMessage || !peer->asChannel()->amIn() || peer->asChannel()->migrateFrom()) { + if (_joinedMessage || !peer->asChannel()->amIn() || (peer->isMegagroup() && peer->asChannel()->mgInfo->joinedMessageFound)) { return _joinedMessage; } @@ -731,6 +731,11 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { HistoryItemType type = item->type(); if (type == HistoryItemMsg || type == HistoryItemGroup) { if (item->date <= inviteDate) { + if (peer->isMegagroup() && peer->migrateFrom() && item->isGroupMigrate()) { + peer->asChannel()->mgInfo->joinedMessageFound = true; + return 0; + } + ++itemIndex; if (item->date.date() != inviteDate.date()) { HistoryDateMsg *joinedDateItem = new HistoryDateMsg(this, block, inviteDate.date()); @@ -830,13 +835,15 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { } void ChannelHistory::checkJoinedMessage(bool createUnread) { - if (_joinedMessage || peer->asChannel()->inviter <= 0 || peer->asChannel()->migrateFrom()) { + if (_joinedMessage || peer->asChannel()->inviter <= 0) { return; } if (isEmpty()) { if (loadedAtTop() && loadedAtBottom()) { if (insertJoinedMessage(createUnread)) { - setLastMessage(_joinedMessage); + if (!_joinedMessage->detached()) { + setLastMessage(_joinedMessage); + } } return; } @@ -875,18 +882,13 @@ void ChannelHistory::checkJoinedMessage(bool createUnread) { if (!firstDate.isNull() && !lastDate.isNull() && (firstDate <= inviteDate || loadedAtTop()) && (lastDate > inviteDate || loadedAtBottom())) { bool willBeLastMsg = (inviteDate >= lastDate); if (insertJoinedMessage(createUnread && willBeLastMsg) && willBeLastMsg) { - setLastMessage(_joinedMessage); + if (!_joinedMessage->detached()) { + setLastMessage(_joinedMessage); + } } } } -void ChannelHistory::removeJoinedMessage() { - if (_joinedMessage) { - _joinedMessage->destroy(); - _joinedMessage = 0; - } -} - void ChannelHistory::checkMaxReadMessageDate() { if (_maxReadMessageDate.isValid()) return; @@ -896,11 +898,14 @@ void ChannelHistory::checkMaxReadMessageDate() { HistoryItem *item = block->items.at(--itemIndex); if ((item->isImportant() || isMegagroup()) && !item->unread()) { _maxReadMessageDate = item->date; + if (item->isGroupMigrate() && isMegagroup() && peer->migrateFrom()) { + _maxReadMessageDate = date(MTP_int(peer->asChannel()->date + 1)); // no report spam panel + } return; } } } - if (loadedAtTop()) { + if (loadedAtTop() && (!isMegagroup() || !isEmpty())) { _maxReadMessageDate = date(MTP_int(peer->asChannel()->date)); } } @@ -943,8 +948,6 @@ HistoryItem *ChannelHistory::addNewToBlocks(const MTPMessage &msg, NewMessageTyp if (!isImportantFlags && !onlyImportant() && !isEmpty() && type == NewMessageLast) { clear(true); - } else if (isMegagroup() && !isEmpty() && type == NewMessageLast && idFromMessage(msg) > maxMsgId()) { // temp - clear(true); } HistoryBlock *to = 0; @@ -7653,10 +7656,13 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { second = TextLinkPtr(new PeerLink(u)); text = lng_action_add_users(lt_from, from, lt_user, textcmdLink(2, u->name), lt_count, v.size() - 1); } - if (unread() && foundSelf) { - if (history()->peer->isChat() && !history()->peer->asChat()->inviterForSpamReport && _from->isUser()) { + if (foundSelf) { + if (unread() && history()->peer->isChat() && !history()->peer->asChat()->inviterForSpamReport && _from->isUser()) { history()->peer->asChat()->inviterForSpamReport = peerToUser(_from->id); } + if (history()->peer->isMegagroup()) { + history()->peer->asChannel()->mgInfo->joinedMessageFound = true; + } } } break; @@ -7669,6 +7675,9 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { //second = TextLinkPtr(new PeerLink(u)); //text = lng_action_user_joined_by_link_from(lt_from, from, lt_inviter, textcmdLink(2, u->name)); } + if (_from->isSelf() && history()->peer->isMegagroup()) { + history()->peer->asChannel()->mgInfo->joinedMessageFound = true; + } } break; case mtpc_messageActionChatCreate: { diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 6730b63e6d..6e108a3fa0 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -432,7 +432,6 @@ public: HistoryJoined *insertJoinedMessage(bool unread); void checkJoinedMessage(bool createUnread = false); - void removeJoinedMessage(); const QDateTime &maxReadMessageDate(); private: diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 6a12248bb1..0fed0a2deb 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1734,6 +1734,10 @@ void HistoryInner::notifyIsBotChanged() { } } +void HistoryInner::notifyMigrateUpdated() { + _migrated = _peer->migrateFrom() ? App::history(_peer->migrateFrom()->id) : 0; +} + void HistoryInner::applyDragSelection() { applyDragSelection(&_selected); } @@ -2616,6 +2620,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) setAcceptDrops(true); + connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(updateField())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onListScroll())); connect(&_reportSpamPanel, SIGNAL(reportClicked()), this, SLOT(onReportSpamClicked())); connect(&_reportSpamPanel, SIGNAL(hideClicked()), this, SLOT(onReportSpamHide())); @@ -2959,6 +2964,27 @@ void HistoryWidget::notifyUserIsBotChanged(UserData *user) { } } +void HistoryWidget::notifyMigrateUpdated(PeerData *peer) { + if (_peer) { + if (_peer == peer) { + if (peer->migrateTo()) { + showHistory(peer->migrateTo()->id, (_showAtMsgId > 0) ? (-_showAtMsgId) : _showAtMsgId, true); + } else if ((_migrated ? _migrated->peer : 0) != peer->migrateFrom()) { + History *migrated = peer->migrateFrom() ? App::history(peer->migrateFrom()->id) : 0; + if (_migrated || (migrated && migrated->unreadCount > 0)) { + showHistory(peer->id, peer->migrateFrom() ? _showAtMsgId : ((_showAtMsgId < 0 && -_showAtMsgId < ServerMaxMsgId) ? ShowAtUnreadMsgId : _showAtMsgId), true); + } else { + _migrated = migrated; + _list->notifyMigrateUpdated(); + updateListSize(); + } + } + } else if (_migrated && _migrated->peer == peer && peer->migrateTo() != _peer) { + showHistory(_peer->id, _showAtMsgId, true); + } + } +} + void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { cSetLastStickersUpdate(getms(true)); _stickersUpdateRequest = 0; @@ -3163,12 +3189,12 @@ void HistoryWidget::applyDraft(bool parseLinks) { } } -void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId) { +void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool reload) { MsgId wasMsgId = _showAtMsgId; History *wasHistory = _history; if (_history) { - if (_peer->id == peerId) { + if (_peer->id == peerId && !reload) { _history->lastWidth = 0; bool wasOnlyImportant = _history->isChannel() ? _history->asChannelHistory()->onlyImportant() : true; @@ -3423,9 +3449,20 @@ void HistoryWidget::updateReportSpamStatus() { _reportSpamStatus = i.value(); _reportSpamPanel.setReported(_reportSpamStatus == dbiprsReportSent, _peer); return; + } else if (_peer->migrateFrom()) { // migrate report status + i = cReportSpamStatuses().constFind(_peer->migrateFrom()->id); + if (i != cReportSpamStatuses().cend()) { + _reportSpamStatus = i.value(); + _reportSpamPanel.setReported(_reportSpamStatus == dbiprsReportSent, _peer); + cRefReportSpamStatuses().insert(_peer->id, _reportSpamStatus); + Local::writeReportSpamStatuses(); + return; + } } } - if ((!_history->loadedAtTop() && (_history->blocks.size() < 2 || (_history->blocks.size() == 2 && _history->blocks.at(1)->items.size() < 2))) || !cContactsReceived() || _firstLoadRequest) { + if (!cContactsReceived() || _firstLoadRequest) { + _reportSpamStatus = dbiprsUnknown; + } else if (!_history->loadedAtTop() && (_history->blocks.size() < 2 || (_history->blocks.size() == 2 && _history->blocks.at(1)->items.size() < 2))) { _reportSpamStatus = dbiprsUnknown; } else if (_peer->isUser()) { if (_peer->asUser()->contact > 0) { @@ -3463,7 +3500,18 @@ void HistoryWidget::updateReportSpamStatus() { _reportSpamStatus = dbiprsNoButton; } } else if (_peer->isChannel()) { - if (!_peer->asChannel()->inviter || _history->asChannelHistory()->maxReadMessageDate().isNull()) { + if (_peer->migrateFrom() && _peer->migrateFrom()->isChat()) { + if (_peer->migrateFrom()->asChat()->inviterForSpamReport > 0) { + UserData *user = App::userLoaded(_peer->migrateFrom()->asChat()->inviterForSpamReport); + if (user && user->contact > 0) { + _reportSpamStatus = dbiprsNoButton; + } else { + _reportSpamStatus = dbiprsShowButton; + } + } else { + _reportSpamStatus = dbiprsNoButton; + } + } else if (!_peer->asChannel()->inviter || _history->asChannelHistory()->maxReadMessageDate().isNull()) { _reportSpamStatus = dbiprsUnknown; } else if (_peer->asChannel()->inviter > 0) { UserData *user = App::userLoaded(_peer->asChannel()->inviter); @@ -5518,6 +5566,9 @@ void HistoryWidget::onReportSpamClear() { MTP::send(MTPmessages_DeleteChatUser(_clearPeer->asChat()->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _clearPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _clearPeer)); } else if (_clearPeer->isChannel()) { App::main()->showDialogs(); + if (_clearPeer->migrateFrom()) { + App::main()->deleteConversation(_clearPeer->migrateFrom()); + } MTP::send(MTPchannels_LeaveChannel(_clearPeer->asChannel()->inputChannel), App::main()->rpcDone(&MainWidget::sentUpdatesReceived)); } } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 960eb78d69..1891e7e8d0 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -96,6 +96,7 @@ public: int32 itemTop(const HistoryItem *item) const; // -1 if should not be visible, -2 if bad history() void notifyIsBotChanged(); + void notifyMigrateUpdated(); ~HistoryInner(); @@ -528,7 +529,7 @@ public: void fastShowAtEnd(History *h); void applyDraft(bool parseLinks = true); - void showHistory(const PeerId &peer, MsgId showAtMsgId); + void showHistory(const PeerId &peer, MsgId showAtMsgId, bool reload = false); void clearDelayedShowAt(); void clearAllLoadRequests(); @@ -559,6 +560,7 @@ public: void notifyBotCommandsChanged(UserData *user); void notifyUserIsBotChanged(UserData *user); + void notifyMigrateUpdated(PeerData *peer); ~HistoryWidget(); @@ -654,6 +656,7 @@ public slots: void onDraftSave(bool delayed = false); void updateStickers(); + void updateField(); void onRecordError(); void onRecordDone(QByteArray result, qint32 samples); @@ -671,7 +674,6 @@ private: void drawField(Painter &p); void drawRecordButton(Painter &p); void drawRecording(Painter &p); - void updateField(); DBIPeerReportSpamStatus _reportSpamStatus; void updateReportSpamStatus(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 71fe3e66b2..a5d1cf246c 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -682,12 +682,16 @@ void MainWidget::updateStickers() { history.updateStickers(); } +void MainWidget::notifyBotCommandsChanged(UserData *bot) { + history.notifyBotCommandsChanged(bot); +} + void MainWidget::notifyUserIsBotChanged(UserData *bot) { history.notifyUserIsBotChanged(bot); } -void MainWidget::notifyBotCommandsChanged(UserData *bot) { - history.notifyBotCommandsChanged(bot); +void MainWidget::notifyMigrateUpdated(PeerData *peer) { + history.notifyMigrateUpdated(peer); } void MainWidget::onUpdateMuted() { @@ -919,6 +923,15 @@ void MainWidget::deleteConversation(PeerData *peer, bool deleteHistory) { } if (History *h = App::historyLoaded(peer->id)) { removeDialog(h); + if (peer->isMegagroup() && peer->asChannel()->mgInfo->migrateFromPtr) { + if (History *migrated = App::historyLoaded(peer->asChannel()->mgInfo->migrateFromPtr->id)) { + if (migrated->lastMsg) { // return initial dialog + migrated->setLastMessage(migrated->lastMsg); + } else { + checkPeerHistory(migrated->peer); + } + } + } h->clear(); h->newLoaded = true; h->oldLoaded = deleteHistory; diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 165239ef48..bc9b6b31bc 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -386,6 +386,7 @@ public: void updateStickers(); void notifyBotCommandsChanged(UserData *bot); void notifyUserIsBotChanged(UserData *bot); + void notifyMigrateUpdated(PeerData *peer); void choosePeer(PeerId peerId, MsgId showAtMsgId); // does offerPeer or showPeerHistory void clearBotStartToken(PeerData *peer); diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index f9bcfe4321..eee5c72ef9 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -2007,6 +2007,11 @@ void OverviewInner::switchType(MediaOverviewType type) { } else { _search.hide(); } + if (!_search.getLastText().isEmpty()) { + _search.setText(QString()); + _search.updatePlaceholder(); + onSearchUpdate(); + } _cancelSearch.hide(); } mediaOverviewUpdated(); @@ -2146,7 +2151,7 @@ void OverviewInner::onNeedSearchMessages() { } void OverviewInner::onSearchUpdate() { - QString filterText = _search.text().trimmed(); + QString filterText = (_type == OverviewLinks) ? _search.text().trimmed() : QString(); bool inSearch = !filterText.isEmpty(), changed = (inSearch != _inSearch); _inSearch = inSearch; diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index a562649809..6605afbd1d 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -535,7 +535,7 @@ void ProfileInner::onFullPeerUpdated(PeerData *peer) { } } else if (_peerChat) { updateInvitationLink(); - _showMigrate = (_peerChat && _amCreator && !_peerChat->isMigrated() && _peerChat->count >= 3); + _showMigrate = (_peerChat && _amCreator && !_peerChat->isMigrated() && _peerChat->count >= cMaxGroupCount()); showAll(); resizeEvent(0); _admins.setText(lng_channel_admins_link(lt_count, _peerChat->adminsEnabled() ? (_peerChat->admins.size() + 1) : 0)); @@ -595,7 +595,7 @@ void ProfileInner::peerUpdated(PeerData *data) { } else if (_peerChat) { if (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) photo = App::photo(_peerChat->photoId); _admins.setText(lng_channel_admins_link(lt_count, _peerChat->adminsEnabled() ? (_peerChat->admins.size() + 1) : 0)); - _showMigrate = (_peerChat && _amCreator && !_peerChat->isMigrated() && _peerChat->count >= 3); + _showMigrate = (_peerChat && _amCreator && !_peerChat->isMigrated() && _peerChat->count >= cMaxGroupCount()); if (App::main()) App::main()->topBar()->showAll(); } else if (_peerChannel) { if (_peerChannel->photoId && _peerChannel->photoId != UnknownPeerPhotoId) photo = App::photo(_peerChannel->photoId); diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 0a95e2c931..99cff07a6e 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -526,7 +526,7 @@ private: }; struct MegagroupInfo { - MegagroupInfo() : botStatus(0), migrateFromPtr(0), lastParticipantsStatus(LastParticipantsUpToDate), lastParticipantsCount(0) { + MegagroupInfo() : botStatus(0), joinedMessageFound(false), migrateFromPtr(0), lastParticipantsStatus(LastParticipantsUpToDate), lastParticipantsCount(0) { } typedef QList LastParticipants; LastParticipants lastParticipants; @@ -538,6 +538,8 @@ struct MegagroupInfo { Bots bots; int32 botStatus; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other + bool joinedMessageFound; + enum LastParticipantsStatus { LastParticipantsUpToDate = 0x00, LastParticipantsAdminsOutdated = 0x01, diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 3ed6d4d227..6313101e85 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -980,7 +980,7 @@ QRect Window::iconRect() const { bool Window::eventFilter(QObject *obj, QEvent *evt) { QEvent::Type t = evt->type(); - if (t == QEvent::MouseButtonPress || t == QEvent::KeyPress || t == QEvent::TouchBegin) { + if (t == QEvent::MouseButtonPress || t == QEvent::KeyPress || t == QEvent::TouchBegin || t == QEvent::Wheel) { psUserActionDone(); } else if (t == QEvent::MouseMove) { if (main && main->isIdle()) {