2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show correct phrase in local join messages.

This commit is contained in:
John Preston
2021-10-14 15:42:51 +04:00
parent 721aac57a5
commit 2ade6be146
6 changed files with 40 additions and 19 deletions

View File

@@ -1618,9 +1618,13 @@ void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
return;
}
const auto finalize = [=](UserId inviter, TimeId inviteDate) {
const auto finalize = [=](
UserId inviter = -1,
TimeId inviteDate = 0,
bool inviteViaRequest = false) {
channel->inviter = inviter;
channel->inviteDate = inviteDate;
channel->inviteViaRequest = inviteViaRequest;
if (const auto history = _session->data().historyLoaded(channel)) {
if (history->lastMessageKnown()) {
history->checkLocalMessages();
@@ -1641,7 +1645,10 @@ void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
const auto &participant = data.vparticipant();
participant.match([&](const MTPDchannelParticipantSelf &data) {
finalize(data.vinviter_id().v, data.vdate().v);
finalize(
data.vinviter_id().v,
data.vdate().v,
data.is_via_invite());
}, [&](const MTPDchannelParticipantCreator &) {
if (channel->mgInfo) {
channel->mgInfo->creator = _session->user();
@@ -1654,13 +1661,13 @@ void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
finalize(inviter, data.vdate().v);
}, [&](const MTPDchannelParticipantBanned &data) {
LOG(("API Error: Got self banned participant."));
finalize(-1, 0);
finalize();
}, [&](const MTPDchannelParticipant &data) {
LOG(("API Error: Got self regular participant."));
finalize(-1, 0);
finalize();
}, [&](const MTPDchannelParticipantLeft &data) {
LOG(("API Error: Got self left participant."));
finalize(-1, 0);
finalize();
});
});
}).fail([=](const MTP::Error &error) {
@@ -1668,7 +1675,7 @@ void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
if (error.type() == qstr("CHANNEL_PRIVATE")) {
channel->privateErrorReceived();
}
finalize(-1, 0);
finalize();
}).afterDelay(kSmallDelayMs).send();
}