diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 0ef84b322a..18b2c471c4 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1740,6 +1740,11 @@ void ApiWrap::joinChannel(not_null channel) { )).done([=](const MTPUpdates &result) { _channelAmInRequests.remove(channel); applyUpdates(result); + + session().data().addRecentJoinChat({ + .fromPeerId = channel->id, + .joinedPeerId = channel->id, + }); }).fail([=](const MTP::Error &error) { const auto &type = error.type(); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 8981abf000..9e6b8e2ed7 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -5299,6 +5299,14 @@ rpl::producer Session::recentSelfForwards() const { return _recentSelfForwards.events(); } +void Session::addRecentJoinChat(const RecentJoinChat &data) { + _recentJoinChat.fire_copy(data); +} + +rpl::producer Session::recentJoinChat() const { + return _recentJoinChat.events(); +} + void Session::clearLocalStorage() { _cache->close(); _cache->clear(); diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 5c5b5fae81..37a55feb98 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -126,6 +126,11 @@ struct RecentSelfForwards { MessageIdsList ids; }; +struct RecentJoinChat { + PeerId fromPeerId = 0; + PeerId joinedPeerId = 0; +}; + class Session final { public: using ViewElement = HistoryView::Element; @@ -895,6 +900,9 @@ public: void addRecentSelfForwards(const RecentSelfForwards &data); [[nodiscard]] rpl::producer recentSelfForwards() const; + void addRecentJoinChat(const RecentJoinChat &data); + [[nodiscard]] rpl::producer recentJoinChat() const; + void clearLocalStorage(); private: @@ -1264,6 +1272,7 @@ private: NextToUpgradeGift> _nextForUpgradeGifts; rpl::event_stream _recentSelfForwards; + rpl::event_stream _recentJoinChat; rpl::lifetime _lifetime;