mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-29 06:42:42 +00:00
Fixed possible incorrect order of links in Ui.
This commit is contained in:
parent
4913288061
commit
80aa596310
@ -131,17 +131,17 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
||||
phrase = tr::lng_forwarded_channel_via(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Link(phrase.text, QString()), // Link 1.
|
||||
Ui::Text::Link(phrase.text, 1), // Link 1.
|
||||
lt_inline_bot,
|
||||
Ui::Text::Link('@' + via->bot->username, {}), // Link 2.
|
||||
Ui::Text::Link('@' + via->bot->username, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
phrase = tr::lng_forwarded_via(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(phrase.text, QString()), // Link 1.
|
||||
Ui::Text::Link(phrase.text, 1), // Link 1.
|
||||
lt_inline_bot,
|
||||
Ui::Text::Link('@' + via->bot->username, {}), // Link 2.
|
||||
Ui::Text::Link('@' + via->bot->username, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else {
|
||||
|
@ -125,7 +125,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_user,
|
||||
Ui::Text::Link(u->name, {}), // Link 2.
|
||||
Ui::Text::Link(u->name, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else if (users.isEmpty()) {
|
||||
@ -253,7 +253,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_user,
|
||||
Ui::Text::Link(user->name, {}), // Link 2.
|
||||
Ui::Text::Link(user->name, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
return result;
|
||||
@ -364,7 +364,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||
result.text = tr::lng_action_secure_values_sent(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(history()->peer->name, {}), // Link 1.
|
||||
Ui::Text::Link(history()->peer->name, QString()), // Link 1.
|
||||
lt_documents,
|
||||
{ .text = documents.join(", ") },
|
||||
Ui::Text::WithEntities);
|
||||
@ -412,14 +412,14 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||
lt_distance,
|
||||
{ .text = distance },
|
||||
lt_user,
|
||||
Ui::Text::Link(toPeer->name, {}), // Link 1.
|
||||
Ui::Text::Link(toPeer->name, QString()), // Link 1.
|
||||
Ui::Text::WithEntities);
|
||||
} else if (toId == selfId) {
|
||||
result.links.push_back(fromPeer->createOpenLink());
|
||||
return tr::lng_action_proximity_reached_you(
|
||||
tr::now,
|
||||
lt_from,
|
||||
Ui::Text::Link(fromPeer->name, {}), // Link 1.
|
||||
Ui::Text::Link(fromPeer->name, QString()), // Link 1.
|
||||
lt_distance,
|
||||
{ .text = distance },
|
||||
Ui::Text::WithEntities);
|
||||
@ -429,11 +429,11 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||
return tr::lng_action_proximity_reached(
|
||||
tr::now,
|
||||
lt_from,
|
||||
Ui::Text::Link(fromPeer->name, {}), // Link 1.
|
||||
Ui::Text::Link(fromPeer->name, 1), // Link 1.
|
||||
lt_distance,
|
||||
{ .text = distance },
|
||||
lt_user,
|
||||
Ui::Text::Link(toPeer->name, {}), // Link 2.
|
||||
Ui::Text::Link(toPeer->name, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
}();
|
||||
@ -796,10 +796,11 @@ HistoryService::PreparedText HistoryService::prepareInvitedToCallText(
|
||||
Ui::Text::WithEntities);
|
||||
auto result = PreparedText{};
|
||||
result.links.push_back(fromLink());
|
||||
auto linkIndex = 1;
|
||||
if (linkCallId) {
|
||||
const auto peer = history()->peer;
|
||||
result.links.push_back(GroupCallClickHandler(peer, linkCallId));
|
||||
chatText = Ui::Text::Link(chatText.text, {});
|
||||
chatText = Ui::Text::Link(chatText.text, ++linkIndex);
|
||||
}
|
||||
if (users.size() == 1) {
|
||||
auto user = owner->user(users[0].v);
|
||||
@ -809,7 +810,7 @@ HistoryService::PreparedText HistoryService::prepareInvitedToCallText(
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_user,
|
||||
Ui::Text::Link(user->name, {}), // Link N.
|
||||
Ui::Text::Link(user->name, ++linkIndex), // Link N.
|
||||
lt_chat,
|
||||
chatText,
|
||||
Ui::Text::WithEntities);
|
||||
@ -828,7 +829,7 @@ HistoryService::PreparedText HistoryService::prepareInvitedToCallText(
|
||||
auto user = owner->user(users[i].v);
|
||||
result.links.push_back(user->createOpenLink());
|
||||
|
||||
auto linkText = Ui::Text::Link(user->name, {});
|
||||
auto linkText = Ui::Text::Link(user->name, ++linkIndex);
|
||||
if (i == 0) {
|
||||
result.text = linkText;
|
||||
} else if (i + 1 == l) {
|
||||
@ -903,7 +904,8 @@ HistoryService::PreparedText HistoryService::preparePinnedText() {
|
||||
}
|
||||
original = Ui::Text::Wrapped(
|
||||
std::move(original),
|
||||
EntityType::CustomUrl);
|
||||
EntityType::CustomUrl,
|
||||
Ui::Text::Link({}, 2).entities.front().data());
|
||||
result.text = tr::lng_action_pinned_message(
|
||||
tr::now,
|
||||
lt_from,
|
||||
@ -917,7 +919,7 @@ HistoryService::PreparedText HistoryService::preparePinnedText() {
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_media,
|
||||
Ui::Text::Link(mediaText, {}), // Link 2.
|
||||
Ui::Text::Link(mediaText, 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else if (pinned && pinned->msgId) {
|
||||
@ -928,7 +930,7 @@ HistoryService::PreparedText HistoryService::preparePinnedText() {
|
||||
lt_from,
|
||||
fromLinkText(), // Link 1.
|
||||
lt_media,
|
||||
Ui::Text::Link(tr::lng_contacts_loading(tr::now), {}), // Link 2.
|
||||
Ui::Text::Link(tr::lng_contacts_loading(tr::now), 2), // Link 2.
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.links.push_back(fromLink());
|
||||
@ -1207,7 +1209,7 @@ std::unique_ptr<HistoryView::Element> HistoryService::createView(
|
||||
}
|
||||
|
||||
TextWithEntities HistoryService::fromLinkText() const {
|
||||
return Ui::Text::Link(_from->name, {});
|
||||
return Ui::Text::Link(_from->name, 1);
|
||||
}
|
||||
|
||||
ClickHandlerPtr HistoryService::fromLink() const {
|
||||
|
@ -652,11 +652,11 @@ MainMenu::MainMenu(
|
||||
tr::now,
|
||||
lt_version,
|
||||
currentVersionText()),
|
||||
{}) // Link 1.
|
||||
1) // Link 1.
|
||||
.append(QChar(' '))
|
||||
.append(QChar(8211))
|
||||
.append(QChar(' '))
|
||||
.append(Ui::Text::Link(tr::lng_menu_about(tr::now), {}))); // Link 2.
|
||||
.append(Ui::Text::Link(tr::lng_menu_about(tr::now), 2))); // Link 2.
|
||||
_version->setLink(
|
||||
1,
|
||||
std::make_shared<UrlClickHandler>(Core::App().changelogLink()));
|
||||
|
Loading…
Reference in New Issue
Block a user