Added phrases for usernames in admin log.

This commit is contained in:
23rd 2022-11-04 19:27:01 +03:00
parent fe987e3f22
commit 421e7a960b
3 changed files with 38 additions and 10 deletions

View file

@ -3009,6 +3009,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_admin_log_changed_link_channel" = "{from} changed channel link:"; "lng_admin_log_changed_link_channel" = "{from} changed channel link:";
"lng_admin_log_removed_link_channel" = "{from} removed channel link"; "lng_admin_log_removed_link_channel" = "{from} removed channel link";
"lng_admin_log_previous_link" = "Previous link"; "lng_admin_log_previous_link" = "Previous link";
"lng_admin_log_reordered_link_group" = "{from} reordered group links:";
"lng_admin_log_reordered_link_channel" = "{from} reordered channel links:";
"lng_admin_log_previous_links_order" = "Previous order";
"lng_admin_log_activated_link" = "{from} activated @{link} username";
"lng_admin_log_deactivated_link" = "{from} deactivated @{link} username";
"lng_admin_log_changed_photo_group" = "{from} changed group photo"; "lng_admin_log_changed_photo_group" = "{from} changed group photo";
"lng_admin_log_changed_photo_channel" = "{from} changed channel photo"; "lng_admin_log_changed_photo_channel" = "{from} changed channel photo";
"lng_admin_log_removed_photo_group" = "{from} removed group photo"; "lng_admin_log_removed_photo_group" = "{from} removed group photo";

View file

@ -1582,27 +1582,50 @@ void GenerateItems(
return true; return true;
}(); }();
if (wasReordered) { if (wasReordered) {
auto resultText = fromLinkText; addSimpleServiceMessage((channel->isMegagroup()
addSimpleServiceMessage(resultText.append({ ? tr::lng_admin_log_reordered_link_group
.text = channel->isMegagroup() : tr::lng_admin_log_reordered_link_channel)(
? QString(" reordered group links:") tr::now,
: QString(" reordered channel links:"), lt_from,
})); fromLinkText,
Ui::Text::WithEntities));
const auto body = makeSimpleTextMessage(list(newValue)); const auto body = makeSimpleTextMessage(list(newValue));
body->addLogEntryOriginal( body->addLogEntryOriginal(
id, id,
"Previous order", tr::lng_admin_log_previous_links_order(tr::now),
list(oldValue)); list(oldValue));
addPart(body); addPart(body);
return; return;
} }
} }
} else if (std::abs(newValue.size() - oldValue.size()) == 1) {
const auto activated = newValue.size() > oldValue.size();
const auto changed = [&] {
const auto value = activated ? oldValue : newValue;
for (const auto &link : (activated ? newValue : oldValue)) {
if (!ranges::contains(value, link)) {
return qs(link);
}
}
return QString();
}();
addSimpleServiceMessage((activated
? tr::lng_admin_log_activated_link
: tr::lng_admin_log_deactivated_link)(
tr::now,
lt_from,
fromLinkText,
lt_link,
{ changed },
Ui::Text::WithEntities));
return;
} }
// Probably will never happen.
auto resultText = fromLinkText; auto resultText = fromLinkText;
addSimpleServiceMessage(resultText.append({ addSimpleServiceMessage(resultText.append({
.text = channel->isMegagroup() .text = channel->isMegagroup()
? QString(" changed list of group links:") ? u" changed list of group links:"_q
: QString(" changed list of channel links:"), : u" changed list of channel links:"_q,
})); }));
const auto body = makeSimpleTextMessage(list(newValue)); const auto body = makeSimpleTextMessage(list(newValue));
body->addLogEntryOriginal( body->addLogEntryOriginal(

@ -1 +1 @@
Subproject commit 2dc6281594037047cd7ea376fff28629035d93e0 Subproject commit 61cf9a34b27ad697d88396b6543e019d696f2932