Switched type of subscription date from Qt to TimeId.
This commit is contained in:
parent
93ff0bdcff
commit
6b0c606d25
3 changed files with 9 additions and 10 deletions
|
@ -8,7 +8,6 @@ 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"
|
||||||
|
@ -269,14 +268,12 @@ ChatParticipant::ChatParticipant(
|
||||||
_type = Type::Member;
|
_type = Type::Member;
|
||||||
_by = peerToUser(peerFromUser(data.vinviter_id()));
|
_by = peerToUser(peerFromUser(data.vinviter_id()));
|
||||||
if (data.vsubscription_until_date()) {
|
if (data.vsubscription_until_date()) {
|
||||||
_subscriptionDate = base::unixtime::parse(
|
_subscriptionDate = data.vsubscription_until_date()->v;
|
||||||
data.vsubscription_until_date()->v);
|
|
||||||
}
|
}
|
||||||
}, [&](const MTPDchannelParticipant &data) {
|
}, [&](const MTPDchannelParticipant &data) {
|
||||||
_type = Type::Member;
|
_type = Type::Member;
|
||||||
if (data.vsubscription_until_date()) {
|
if (data.vsubscription_until_date()) {
|
||||||
_subscriptionDate = base::unixtime::parse(
|
_subscriptionDate = data.vsubscription_until_date()->v;
|
||||||
data.vsubscription_until_date()->v);
|
|
||||||
}
|
}
|
||||||
}, [&](const MTPDchannelParticipantBanned &data) {
|
}, [&](const MTPDchannelParticipantBanned &data) {
|
||||||
_restrictions = ChatRestrictionsInfo(data.vbanned_rights());
|
_restrictions = ChatRestrictionsInfo(data.vbanned_rights());
|
||||||
|
@ -357,7 +354,7 @@ ChatAdminRightsInfo ChatParticipant::rights() const {
|
||||||
return _rights;
|
return _rights;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime ChatParticipant::subscriptionDate() const {
|
TimeId ChatParticipant::subscriptionDate() const {
|
||||||
return _subscriptionDate;
|
return _subscriptionDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
ChatRestrictionsInfo restrictions() const;
|
ChatRestrictionsInfo restrictions() const;
|
||||||
ChatAdminRightsInfo rights() const;
|
ChatAdminRightsInfo rights() const;
|
||||||
|
|
||||||
QDateTime subscriptionDate() const;
|
TimeId subscriptionDate() const;
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
QString rank() const;
|
QString rank() const;
|
||||||
|
@ -75,7 +75,7 @@ private:
|
||||||
bool _canBeEdited = false;
|
bool _canBeEdited = false;
|
||||||
|
|
||||||
QString _rank;
|
QString _rank;
|
||||||
QDateTime _subscriptionDate;
|
TimeId _subscriptionDate = 0;
|
||||||
|
|
||||||
ChatRestrictionsInfo _restrictions;
|
ChatRestrictionsInfo _restrictions;
|
||||||
ChatAdminRightsInfo _rights;
|
ChatAdminRightsInfo _rights;
|
||||||
|
|
|
@ -2042,7 +2042,7 @@ void GenerateItems(
|
||||||
const auto participant = Api::ChatParticipant(
|
const auto participant = Api::ChatParticipant(
|
||||||
action.vnew_participant(),
|
action.vnew_participant(),
|
||||||
channel);
|
channel);
|
||||||
if (participant.subscriptionDate().isNull()) {
|
if (!participant.subscriptionDate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto participantPeer = channel->owner().peer(participant.id());
|
const auto participantPeer = channel->owner().peer(participant.id());
|
||||||
|
@ -2050,13 +2050,15 @@ void GenerateItems(
|
||||||
const auto participantPeerLinkText = Ui::Text::Link(
|
const auto participantPeerLinkText = Ui::Text::Link(
|
||||||
participantPeer->name(),
|
participantPeer->name(),
|
||||||
QString());
|
QString());
|
||||||
|
const auto parsed = base::unixtime::parse(
|
||||||
|
participant.subscriptionDate());
|
||||||
addServiceMessageWithLink(
|
addServiceMessageWithLink(
|
||||||
tr::lng_admin_log_subscription_extend(
|
tr::lng_admin_log_subscription_extend(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_name,
|
lt_name,
|
||||||
participantPeerLinkText,
|
participantPeerLinkText,
|
||||||
lt_date,
|
lt_date,
|
||||||
{ langDateTimeFull(participant.subscriptionDate()) },
|
{ langDateTimeFull(parsed) },
|
||||||
Ui::Text::WithEntities),
|
Ui::Text::WithEntities),
|
||||||
participantPeerLink);
|
participantPeerLink);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue