Removed unused refund api support for credits.

This commit is contained in:
23rd 2024-06-04 18:09:25 +03:00 committed by John Preston
parent 9e3e7265d2
commit 5db2821f8c
3 changed files with 0 additions and 53 deletions

View file

@ -199,24 +199,4 @@ rpl::producer<not_null<PeerData*>> PremiumPeerBot(
};
}
void CreditsRefund(
not_null<PeerData*> peer,
const QString &entryId,
Fn<void()> done,
Fn<void(QString)> fail) {
const auto user = peer->asUser();
if (!user) {
return;
}
peer->session().api().request(MTPpayments_RefundStarsCharge(
user->inputUser,
MTP_string(entryId)
)).done([=](const MTPUpdates &result) {
peer->session().api().updates().applyUpdates(result);
done();
}).fail([=](const MTP::Error &error) {
fail(error.type());
}).send();
}
} // namespace Api

View file

@ -68,12 +68,6 @@ private:
};
void CreditsRefund(
not_null<PeerData*> peer,
const QString &entryId,
Fn<void()> done,
Fn<void(QString)> fail);
[[nodiscard]] rpl::producer<not_null<PeerData*>> PremiumPeerBot(
not_null<Main::Session*> session);

View file

@ -861,10 +861,6 @@ public:
void rowClicked(not_null<PeerListRow*> row) override;
void loadMoreRows() override;
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
QWidget *parent,
not_null<PeerListRow*> row) override;
[[nodiscard]] bool skipRequest() const;
void requestNext();
@ -957,29 +953,6 @@ void CreditsController::rowClicked(not_null<PeerListRow*> row) {
}
}
base::unique_qptr<Ui::PopupMenu> CreditsController::rowContextMenu(
QWidget *parent,
not_null<PeerListRow*> row) {
const auto entry = static_cast<const CreditsRow*>(row.get())->entry();
if (!entry.bareId) {
return nullptr;
}
auto menu = base::make_unique_q<Ui::PopupMenu>(
parent,
st::defaultPopupMenu);
const auto peer = row->peer();
const auto callback = crl::guard(parent, [=, id = entry.id] {
const auto show = delegate()->peerListUiShow();
Api::CreditsRefund(
peer,
id,
[=] { show->showToast(tr::lng_report_spam_done(tr::now)); },
[=](const QString &error) { show->showToast(error); });
});
menu->addAction(tr::lng_channel_earn_history_return(tr::now), callback);
return menu;
}
rpl::producer<bool> CreditsController::allLoadedValue() const {
return _allLoaded.value();
}