diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 795d18847..a7c3d297c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4588,6 +4588,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_admin_manage_calls" = "Manage voice chats"; "lng_admin_log_admin_manage_calls_channel" = "Manage live streams"; "lng_admin_log_admin_add_admins" = "Add new admins"; +"lng_admin_log_subscription_extend" = "{name} renewed subscription until {date}"; "lng_admin_log_antispam_menu_report" = "Report False Positive"; "lng_admin_log_antispam_menu_report_toast" = "You can manage anti-spam settings in {link}."; diff --git a/Telegram/SourceFiles/api/api_chat_participants.cpp b/Telegram/SourceFiles/api/api_chat_participants.cpp index a4cd0c367..3206d1869 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.cpp +++ b/Telegram/SourceFiles/api/api_chat_participants.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_chat_participants.h" #include "apiwrap.h" +#include "base/unixtime.h" #include "boxes/add_contact_box.h" // ShowAddParticipantsError #include "boxes/peers/add_participants_box.h" // ChatInviteForbidden #include "data/data_changes.h" @@ -267,8 +268,16 @@ ChatParticipant::ChatParticipant( }, [&](const MTPDchannelParticipantSelf &data) { _type = Type::Member; _by = peerToUser(peerFromUser(data.vinviter_id())); + if (data.vsubscription_until_date()) { + _subscriptionDate = base::unixtime::parse( + data.vsubscription_until_date()->v); + } }, [&](const MTPDchannelParticipant &data) { _type = Type::Member; + if (data.vsubscription_until_date()) { + _subscriptionDate = base::unixtime::parse( + data.vsubscription_until_date()->v); + } }, [&](const MTPDchannelParticipantBanned &data) { _restrictions = ChatRestrictionsInfo(data.vbanned_rights()); _by = peerToUser(peerFromUser(data.vkicked_by())); @@ -348,6 +357,10 @@ ChatAdminRightsInfo ChatParticipant::rights() const { return _rights; } +QDateTime ChatParticipant::subscriptionDate() const { + return _subscriptionDate; +} + ChatParticipant::Type ChatParticipant::type() const { return _type; } diff --git a/Telegram/SourceFiles/api/api_chat_participants.h b/Telegram/SourceFiles/api/api_chat_participants.h index ad5aa930f..a5396ab75 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.h +++ b/Telegram/SourceFiles/api/api_chat_participants.h @@ -60,6 +60,8 @@ public: ChatRestrictionsInfo restrictions() const; ChatAdminRightsInfo rights() const; + QDateTime subscriptionDate() const; + Type type() const; QString rank() const; @@ -73,6 +75,7 @@ private: bool _canBeEdited = false; QString _rank; + QDateTime _subscriptionDate; ChatRestrictionsInfo _restrictions; ChatAdminRightsInfo _rights; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index a69bc763c..75c62ca8c 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -2039,7 +2039,26 @@ void GenerateItems( }; const auto createParticipantSubExtend = [&](const LogParticipantSubExtend &action) { - AssertIsDebug(); + const auto participant = Api::ChatParticipant( + action.vnew_participant(), + channel); + if (participant.subscriptionDate().isNull()) { + return; + } + const auto participantPeer = channel->owner().peer(participant.id()); + const auto participantPeerLink = participantPeer->createOpenLink(); + const auto participantPeerLinkText = Ui::Text::Link( + participantPeer->name(), + QString()); + addServiceMessageWithLink( + tr::lng_admin_log_subscription_extend( + tr::now, + lt_name, + participantPeerLinkText, + lt_date, + { langDateTimeFull(participant.subscriptionDate()) }, + Ui::Text::WithEntities), + participantPeerLink); }; action.match(