Use a separate string for voice chat ending in groups.

This commit is contained in:
John Preston 2021-05-03 13:23:28 +04:00
parent 98180d3a9e
commit 4fae827f1e
2 changed files with 17 additions and 2 deletions

View File

@ -1112,6 +1112,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_group_call_scheduled_group" = "{from} scheduled a voice chat for {date}";
"lng_action_group_call_scheduled_channel" = "Voice chat scheduled for {date}";
"lng_action_group_call_finished" = "Voice chat finished ({duration})";
"lng_action_group_call_finished_group" = "{from} ended the voice chat ({duration})";
"lng_action_add_user" = "{from} added {user}";
"lng_action_add_users_many" = "{from} added {users}";
"lng_action_add_users_and_one" = "{accumulated}, {user}";

View File

@ -338,6 +338,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
};
auto prepareGroupCall = [this](const MTPDmessageActionGroupCall &action) {
auto result = PreparedText{};
if (const auto duration = action.vduration()) {
const auto seconds = duration->v;
const auto days = seconds / 86400;
@ -350,9 +351,22 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
: (minutes > 1)
? tr::lng_group_call_duration_minutes(tr::now, lt_count, minutes)
: tr::lng_group_call_duration_seconds(tr::now, lt_count, seconds);
return PreparedText{ tr::lng_action_group_call_finished(tr::now, lt_duration, text) };
if (history()->peer->isBroadcast()) {
result.text = tr::lng_action_group_call_finished(
tr::now,
lt_duration,
text);
} else {
result.links.push_back(fromLink());
result.text = tr::lng_action_group_call_finished_group(
tr::now,
lt_from,
fromLinkText(),
lt_duration,
text);
}
return result;
}
auto result = PreparedText{};
if (history()->peer->isBroadcast()) {
result.text = tr::lng_action_group_call_started_channel(tr::now);
} else {