Make whole same-background message clickable.

This commit is contained in:
John Preston 2023-04-05 17:39:01 +04:00
parent 9600cc0ed5
commit 7c11fd58cf
3 changed files with 4 additions and 10 deletions

View File

@ -1523,9 +1523,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_attach_menu_bot_allowed" = "You allowed this bot to message you when you added it in the attachment menu.";
"lng_action_set_wallpaper_me" = "You set a new background for this chat.";
"lng_action_set_wallpaper" = "{user} set a new background for this chat.";
"lng_action_set_same_wallpaper_me" = "You set {background} for this chat.";
"lng_action_set_same_wallpaper" = "{user} set {background} for this chat.";
"lng_action_set_same_background" = "the same background";
"lng_action_set_same_wallpaper_me" = "You set the same background for this chat.";
"lng_action_set_same_wallpaper" = "{user} set the same background for this chat.";
"lng_action_topic_created_inside" = "Topic created";
"lng_action_topic_closed_inside" = "Topic closed";
"lng_action_topic_reopened_inside" = "Topic reopened";

View File

@ -4193,21 +4193,14 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
if (!isSelf) {
result.links.push_back(peer->createOpenLink());
}
if (const auto dependent = GetServiceDependentData()) {
result.links.push_back(dependent->lnk);
}
result.text = isSelf
? tr::lng_action_set_same_wallpaper(
tr::now,
lt_user,
Ui::Text::Link(name, 1), // Link 1.
lt_background,
Ui::Text::Link(tr::lng_action_set_same_background(tr::now), 2),
Ui::Text::WithEntities)
: tr::lng_action_set_same_wallpaper_me(
tr::now,
lt_background,
Ui::Text::Link(tr::lng_action_set_same_background(tr::now), 1),
Ui::Text::WithEntities);
return result;
};

View File

@ -652,6 +652,8 @@ TextState Service::textState(QPoint point, StateRequest request) const {
if (TTLMenu::TTLValidator(nullptr, history()->peer).can()) {
result.link = ttl->link;
}
} else if (const auto same = item->Get<HistoryServiceSameBackground>()) {
result.link = same->lnk;
}
}
} else if (media) {