Skip to content

Fix admin order save#2501

Open
alicecoordinator wants to merge 10 commits into
RoboSats:mainfrom
alicecoordinator:fix-admin-order-save
Open

Fix admin order save#2501
alicecoordinator wants to merge 10 commits into
RoboSats:mainfrom
alicecoordinator:fix-admin-order-save

Conversation

@alicecoordinator
Copy link
Copy Markdown
Contributor

@alicecoordinator alicecoordinator commented May 25, 2026

What does this PR do?

It is not possible currently to edit orders in the admin panel. Trying to do so leads to the message "Please correct the error below.", but no field is indicated as erroneous.

The reason is that the payment_hash field of LN payments is not being rendered in the form.

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

alicecoordinator and others added 10 commits January 24, 2026 11:35
In the previous implementation, every time the payout_amount method was
called, the swap failure reason was logged in the order. This method was
called in the order GET method of the API, which led to logging the
failure reason dozens of times for some orders.

This commit splits the payout_amount calculation from the context
generation. Now the logging happens only in the finalize_contract
method, and this can only happen once.
`slashed_robot_log` was not expanded so it resulted in a literal
`{slashed_robot.id}` ecc. and `_logs` in `api/admin.py` threw an
exception here:
```python
with_hyperlinks = objects_to_hyperlinks(obj.logs)
try:
    html_logs = format_html(
        f'<table style="width: 100%">{with_hyperlinks}</table>'
    )
except Exception as e:
    html_logs = f"An error occurred while formatting the parsed logs as HTML. Exception {e}"
```

Also removed a trailing parenthesis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants