Bind confirmed bank and ticket actions to real careers (by Codex)

This commit is contained in:
Codex committed 2026-10-28 11:04:11 +01:00
1 parent f75e0f8e49
commit dcf42f2da7
23 files changed
+535 -56

No files matched your search

+10 -4
View File
@@ -60,7 +60,13 @@ bool inside(Rml::Element *node, Rml::Element *root) {
TicketPopover::TicketPopover(Rml::Context &context,
Rml::ElementDocument &document, DataSource &source,
std::function<void()> on_commit)
: context_(context), document_(document), source_(source),
: TicketPopover(context, document, [&source] { return source.snapshot(); },
[&source](const Action &a) { return source.apply(a); }, std::move(on_commit)) {}
TicketPopover::TicketPopover(Rml::Context &context, Rml::ElementDocument &document,
std::function<Snapshot()> read,
std::function<ActionResult(const Action &)> submit,
std::function<void()> on_commit)
: context_(context), document_(document), read_(std::move(read)), submit_(std::move(submit)),
on_commit_(std::move(on_commit)) {
auto layer = document_.CreateElement("div");
layer->SetId("native-ticket-layer");
@@ -83,7 +89,7 @@ TicketPopover::~TicketPopover() {
bool TicketPopover::open(Rml::Element *anchor, float device_pixel_ratio,
int min, int max, int step) {
close(false);
const auto snapshot = source_.snapshot();
const auto snapshot = read_();
const auto current = price(snapshot);
const auto interval = int64_t(max) - min;
if (!anchor || anchor->GetOwnerDocument() != &document_ ||
@@ -125,7 +131,7 @@ void TicketPopover::close(bool restore_focus) {
focus_opener();
}
bool TicketPopover::fresh() const {
const auto snapshot = source_.snapshot();
const auto snapshot = read_();
return snapshot.revision == revision_ && snapshot.world == world_ &&
price(snapshot) == original_;
}
@@ -267,7 +273,7 @@ void TicketPopover::confirm() {
close(false);
return;
}
const auto result = source_.apply({revision_, "ticket", value_});
const auto result = submit_({revision_, "ticket", value_});
if (!result.ok) {
if (!fresh()) {
close(false);