Page MenuHomePhorge

Do not throw Aphront400Response when editing a task
Needs ReviewPublic

Authored by aklapper on Jul 15 2024, 16:13.

Details

Reviewers
None
Group Reviewers
O1: Blessed Committers
Maniphest Tasks
T15866: Aphront400Response when editing a task
Summary

HTTP 400 is supposed to be a Bad Request: The server cannot or will not process the request due to an apparent client error.
That is not the case when creating a preview - that request is valid. Thus do not throw a HTTP 400 in the background while the rest of the user activity passes anyway.

Closes T15866

Test Plan

Check the web browser's network console when

  • editing a Maniphest task's project tags and priority via the "Add Action" field
  • adding a comment to a Maniphest task and signing it with 2FA
  • editing/adding in other applications relying on __preview__

Diff Detail

Repository
rP Phorge
Branch
T15886doNotHttp400
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1439
Build 1439: arc lint + arc unit

Event Timeline

I guess I just do not enjoy a good number of HTTP 400 errors in our error logs when literally nothing went wrong at all.

src/aphront/AphrontRequest.php
708

I don't understand potential consequences of removing isFormPost() so maybe we can keep it, and "just" add the missing isAjax()

return ($this->isFormPost() || $this->isAjax())
      && $this->getStr('__preview__');