Moved out fixing of ampersand from text in actions to single place.

This commit is contained in:
23rd 2024-11-26 15:23:26 +03:00
parent cd5a1980c9
commit cb2972b145
5 changed files with 21 additions and 15 deletions

View file

@ -1402,7 +1402,8 @@ void Suggestions::setupChats() {
.removeOneText = tr::lng_recent_remove(tr::now),
.removeOne = removeOne,
.removeAllText = tr::lng_recent_hide_top(
tr::now).replace('&', u"&&"_q),
tr::now,
Ui::Text::FixAmpersandInAction),
.removeAllConfirm = tr::lng_recent_hide_sure(tr::now),
.removeAll = removeAll,
});

View file

@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/message_sending_animation_controller.h"
#include "ui/effects/reaction_fly_animation.h"
#include "ui/text/text_isolated_emoji.h"
#include "ui/text/text_utilities.h"
#include "ui/boxes/edit_factcheck_box.h"
#include "ui/boxes/report_box_graphics.h"
#include "ui/controls/delete_message_context_action.h"
@ -2549,15 +2550,16 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
const auto canReply = canSendReply || item->allowsForward();
if (canReply) {
const auto selected = selectedQuote(item);
auto text = selected
? tr::lng_context_quote_and_reply(tr::now)
: tr::lng_context_reply_msg(tr::now);
auto text = (selected
? tr::lng_context_quote_and_reply
: tr::lng_context_reply_msg)(
tr::now,
Ui::Text::FixAmpersandInAction);
const auto replyToItem = selected.item ? selected.item : item;
const auto itemId = replyToItem->fullId();
const auto quote = selected.text;
const auto quoteOffset = selected.offset;
text.replace('&', u"&&"_q);
_menu->addAction(text, [=] {
_menu->addAction(std::move(text), [=] {
_widget->replyToMessage({
.messageId = itemId,
.quote = quote,

View file

@ -635,12 +635,12 @@ bool AddReplyToMessageAction(
}
const auto &quote = request.quote;
auto text = quote.text.empty()
? tr::lng_context_reply_msg(tr::now)
: tr::lng_context_quote_and_reply(tr::now);
text.replace('&', u"&&"_q);
const auto itemId = item->fullId();
menu->addAction(text, [=] {
auto text = (quote.text.empty()
? tr::lng_context_reply_msg
: tr::lng_context_quote_and_reply)(
tr::now,
Ui::Text::FixAmpersandInAction);
menu->addAction(std::move(text), [=, itemId = item->fullId()] {
list->replyToMessageRequestNotify({
.messageId = itemId,
.quote = quote.text,

View file

@ -18,8 +18,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/player/media_player_instance.h"
#include "media/audio/media_audio.h"
#include "storage/localstorage.h"
#include "window/window_session_controller.h"
#include "ui/text/text_utilities.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "platform/mac/touchbar/mac_touchbar_manager.h"
#include "platform/platform_specific.h"
#include "platform/platform_notifications_manager.h"
@ -519,7 +520,9 @@ void MainWindow::createGlobalMenu() {
edit->addSeparator();
edit->addAction(
tr::lng_mac_menu_emoji_and_symbols(tr::now).replace('&', "&&"),
tr::lng_mac_menu_emoji_and_symbols(
tr::now,
Ui::Text::FixAmpersandInAction),
this,
[] { [NSApp orderFrontCharacterPalette:nil]; },
QKeySequence(Qt::MetaModifier | Qt::ControlModifier | Qt::Key_Space)

@ -1 +1 @@
Subproject commit 64f99667a6f45e9a896624c2d1c71fa143804aab
Subproject commit 3254aebf55133066e0a8775cabdfcef568b79625