mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added support of admin log event of extended subscriptions.
This commit is contained in:
parent
19d386f977
commit
e44aca06cb
4 changed files with 37 additions and 1 deletions
|
@ -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" = "Manage voice chats";
|
||||||
"lng_admin_log_admin_manage_calls_channel" = "Manage live streams";
|
"lng_admin_log_admin_manage_calls_channel" = "Manage live streams";
|
||||||
"lng_admin_log_admin_add_admins" = "Add new admins";
|
"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" = "Report False Positive";
|
||||||
"lng_admin_log_antispam_menu_report_toast" = "You can manage anti-spam settings in {link}.";
|
"lng_admin_log_antispam_menu_report_toast" = "You can manage anti-spam settings in {link}.";
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "api/api_chat_participants.h"
|
#include "api/api_chat_participants.h"
|
||||||
|
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
#include "base/unixtime.h"
|
||||||
#include "boxes/add_contact_box.h" // ShowAddParticipantsError
|
#include "boxes/add_contact_box.h" // ShowAddParticipantsError
|
||||||
#include "boxes/peers/add_participants_box.h" // ChatInviteForbidden
|
#include "boxes/peers/add_participants_box.h" // ChatInviteForbidden
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
|
@ -267,8 +268,16 @@ ChatParticipant::ChatParticipant(
|
||||||
}, [&](const MTPDchannelParticipantSelf &data) {
|
}, [&](const MTPDchannelParticipantSelf &data) {
|
||||||
_type = Type::Member;
|
_type = Type::Member;
|
||||||
_by = peerToUser(peerFromUser(data.vinviter_id()));
|
_by = peerToUser(peerFromUser(data.vinviter_id()));
|
||||||
|
if (data.vsubscription_until_date()) {
|
||||||
|
_subscriptionDate = base::unixtime::parse(
|
||||||
|
data.vsubscription_until_date()->v);
|
||||||
|
}
|
||||||
}, [&](const MTPDchannelParticipant &data) {
|
}, [&](const MTPDchannelParticipant &data) {
|
||||||
_type = Type::Member;
|
_type = Type::Member;
|
||||||
|
if (data.vsubscription_until_date()) {
|
||||||
|
_subscriptionDate = base::unixtime::parse(
|
||||||
|
data.vsubscription_until_date()->v);
|
||||||
|
}
|
||||||
}, [&](const MTPDchannelParticipantBanned &data) {
|
}, [&](const MTPDchannelParticipantBanned &data) {
|
||||||
_restrictions = ChatRestrictionsInfo(data.vbanned_rights());
|
_restrictions = ChatRestrictionsInfo(data.vbanned_rights());
|
||||||
_by = peerToUser(peerFromUser(data.vkicked_by()));
|
_by = peerToUser(peerFromUser(data.vkicked_by()));
|
||||||
|
@ -348,6 +357,10 @@ ChatAdminRightsInfo ChatParticipant::rights() const {
|
||||||
return _rights;
|
return _rights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDateTime ChatParticipant::subscriptionDate() const {
|
||||||
|
return _subscriptionDate;
|
||||||
|
}
|
||||||
|
|
||||||
ChatParticipant::Type ChatParticipant::type() const {
|
ChatParticipant::Type ChatParticipant::type() const {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
ChatRestrictionsInfo restrictions() const;
|
ChatRestrictionsInfo restrictions() const;
|
||||||
ChatAdminRightsInfo rights() const;
|
ChatAdminRightsInfo rights() const;
|
||||||
|
|
||||||
|
QDateTime subscriptionDate() const;
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
QString rank() const;
|
QString rank() const;
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ private:
|
||||||
bool _canBeEdited = false;
|
bool _canBeEdited = false;
|
||||||
|
|
||||||
QString _rank;
|
QString _rank;
|
||||||
|
QDateTime _subscriptionDate;
|
||||||
|
|
||||||
ChatRestrictionsInfo _restrictions;
|
ChatRestrictionsInfo _restrictions;
|
||||||
ChatAdminRightsInfo _rights;
|
ChatAdminRightsInfo _rights;
|
||||||
|
|
|
@ -2039,7 +2039,26 @@ void GenerateItems(
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto createParticipantSubExtend = [&](const LogParticipantSubExtend &action) {
|
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(
|
action.match(
|
||||||
|
|
Loading…
Add table
Reference in a new issue