Repository navigation
fix(MailReturn): report failed returns and wait for mail delivery - #222
Merged
Merged
Conversation
The return endpoint ignored the SOAP reply and always reported success, so the page dropped the row even when the core refused the command. Only the core's "Mail #N returned to sender" reply now counts as success; anything else is returned to the page as an error. The core also refuses mails still in the MailDeliveryDelay window. The list now carries the remaining delivery time, the Return button stays disabled with a countdown until the mail is delivered, and the endpoint rejects early returns with an explanation.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The Return button on the Mail Return page always reported success.
returnMail()sent.mail returnover SOAP and ignored the reply, so when the core refused the command the page still removed the row, and the mail was back after a refresh.The most common way to hit this is returning a mail right after sending it. The core treats mails still in the
MailDeliveryDelaywindow as not found, but the list showed them with a working Return button.Now:
LANG_MAIL_RETURN_SUCCESS("Mail #N returned to sender ..."). Any other reply, or a SOAP connection error, is sent back as amail_return_failederror with the core's text, so the player sees "Mail #N not found." or "Mail has already been returned." and the row stays.deliver_in(seconds left, computed on the web server). Mails still being delivered show a "Delivers in Xm Ys" countdown with the button disabled until it hits zero.Decisions worth knowing
AcoreSoap::executeCommand()returns the fault text instead of throwing, so command errors and transport errors both arrive as strings. Matching the success text is the only reliable signal. Checking the DB afterwards doesn't work because the core commits the return asynchronously.Review guide
MailReturnController.phphas the logic,MailReturnApi.phpmaps the new exception to a 502 with the message, andmail-return.jsadds the countdown. The CSS and the script version bump are cosmetic.