Skip to content

Commit

Permalink
Fixed ability to copy transactions id from credits history entries.
Browse files Browse the repository at this point in the history
Regression was introduced in 77e7796.
  • Loading branch information
23rd authored and john-preston committed Nov 21, 2024
1 parent d69905f commit 2ae4e15
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions Telegram/SourceFiles/boxes/gift_premium_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,24 +1255,12 @@ void AddCreditsHistoryEntryTable(
Ui::Text::WithEntities));
}
if (!entry.id.isEmpty()) {
constexpr auto kOneLineCount = 22;
const auto oneLine = entry.id.size() <= kOneLineCount;
auto multiLine = QString();
if (!oneLine) {
for (auto i = 0; i < entry.id.size(); ++i) {
multiLine.append(entry.id[i]);
if ((i + 1) % kOneLineCount == 0) {
multiLine.append('\n');
}
}
}
constexpr auto kOneLineCount = 24;
const auto oneLine = entry.id.length() <= kOneLineCount;
auto label = object_ptr<Ui::FlatLabel>(
table,
rpl::single(
Ui::Text::Wrapped(
{ oneLine ? entry.id : std::move(multiLine) },
EntityType::Code,
{})),
Ui::Text::Wrapped({ entry.id }, EntityType::Code, {})),
oneLine
? st::giveawayGiftCodeValue
: st::giveawayGiftCodeValueMultiline);
Expand Down

0 comments on commit 2ae4e15

Please sign in to comment.