| 691 | } |
| 692 | |
| 693 | void AddTable( |
| 694 | not_null<Ui::VerticalLayout*> container, |
| 695 | std::shared_ptr<ChatHelpers::Show> show, |
| 696 | Settings::CreditsEntryBoxStyleOverrides st, |
| 697 | const Api::GiftCode ¤t, |
| 698 | bool skipReason) { |
| 699 | auto table = container->add( |
| 700 | object_ptr<Ui::TableLayout>( |
| 701 | container, |
| 702 | st.table ? *st.table : st::giveawayGiftCodeTable), |
| 703 | st::giveawayGiftCodeTableMargin); |
| 704 | if (current.from) { |
| 705 | AddTableRow( |
| 706 | table, |
| 707 | tr::lng_gift_link_label_from(), |
| 708 | show, |
| 709 | current.from); |
| 710 | } |
| 711 | if (current.from && current.to) { |
| 712 | AddTableRow( |
| 713 | table, |
| 714 | tr::lng_gift_link_label_to(), |
| 715 | show, |
| 716 | current.to); |
| 717 | } else if (current.from) { |
| 718 | AddTableRow( |
| 719 | table, |
| 720 | tr::lng_gift_link_label_to(), |
| 721 | tr::lng_gift_link_label_to_unclaimed(tr::marked)); |
| 722 | } |
| 723 | AddTableRow( |
| 724 | table, |
| 725 | tr::lng_gift_link_label_gift(), |
| 726 | tr::lng_gift_link_gift_premium( |
| 727 | lt_duration, |
| 728 | GiftDurationValue(current.days) | rpl::map(tr::marked), |
| 729 | tr::marked)); |
| 730 | if (!skipReason && current.from) { |
| 731 | const auto reason = AddTableRow( |
| 732 | table, |
| 733 | tr::lng_gift_link_label_reason(), |
| 734 | (current.giveawayId |
| 735 | ? ((current.to |
| 736 | ? tr::lng_gift_link_reason_giveaway |
| 737 | : tr::lng_gift_link_reason_unclaimed)(tr::link)) |
| 738 | : current.giveaway |
| 739 | ? ((current.to |
| 740 | ? tr::lng_gift_link_reason_giveaway |
| 741 | : tr::lng_gift_link_reason_unclaimed)( |
| 742 | tr::marked |
| 743 | ) | rpl::type_erased) |
| 744 | : tr::lng_gift_link_reason_chosen(tr::marked))); |
| 745 | reason->setClickHandlerFilter([=](const auto &...) { |
| 746 | if (const auto window = show->resolveWindow()) { |
| 747 | window->showPeerHistory( |
| 748 | current.from, |
| 749 | Window::SectionShow::Way::Forward, |
| 750 | current.giveawayId); |
no test coverage detected