diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp index 1ce4281c3..d0daff533 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp @@ -136,13 +136,10 @@ void AddMessageDetailsAction(not_null menu, HistoryItem *item) { const auto messageDate = base::unixtime::parse(item->date()); const auto messageEditDate = base::unixtime::parse(view ? view->displayedEditDate() : TimeId(0)); -#pragma clang diagnostic push -#pragma ide diagnostic ignored "NullDereference" const auto messageForwardedDate = - isForwarded + isForwarded && forwarded ? base::unixtime::parse(forwarded->originalDate) : QDateTime(); -#pragma clang diagnostic pop const auto messageViews = item->hasViews() && item->viewsCount() > 0 ? QString::number(item->viewsCount()) : QString(); diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 30f6bc31f..ef003e936 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -146,8 +146,17 @@ base::options::toggle ShowPeerIdBelowAbout({ + addToLink; } if (!link.isEmpty()) { - if (const auto strong = weak.get()) { - FastShareLink(strong, link); + if (addToLink.isEmpty()) { + link = '@' + link.replace("https://t.me/", ""); + } + + QGuiApplication::clipboard()->setText(link); + + const auto isLink = link.startsWith(u"https://t.me/"_q); + if (const auto window = weak.get()) { + window->showToast(isLink + ? tr::lng_username_copied(tr::now) // "Link copied to clipboard." + : tr::lng_text_copied(tr::now)); // "Text copied to clipboard." } } }; diff --git a/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp b/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp index 4498becad..aebafde05 100644 --- a/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/collectible_info_box.cpp @@ -188,11 +188,13 @@ void CollectibleInfoBox( Ui::Text::Link(formatted), Ui::Text::WithEntities); const auto copyCallback = [box, type, formatted, text = info.copyText] { - QGuiApplication::clipboard()->setText( - text.isEmpty() ? formatted : text); - box->uiShow()->showToast((type == CollectibleType::Phone) - ? tr::lng_text_copied(tr::now) - : tr::lng_username_copied(tr::now)); + auto toCopy = text.isEmpty() ? formatted : text; + if (type == CollectibleType::Username) { + toCopy = "@" + toCopy.replace("https://t.me/", ""); + } + + QGuiApplication::clipboard()->setText(toCopy); + box->uiShow()->showToast(tr::lng_text_copied(tr::now)); }; box->addRow( object_ptr(