Fix bugs in the API tokens config page.

Review Request #12616 — Created Sept. 21, 2022 and submitted — Latest diff uploaded


Review Board


While testing the new token expiration controls on the API tokens page, it was
discovered that the displayed expiration date would revert to an old value
whenever the policy type changed. To fix this, we update the displayed
expiration date whenever its value changes and whenever the token's information
is rendered.

This change also fixes two bugs related to the custom policy editor. The first
being that you couldn't set custom policies due to an out of scope variable.
Secondly, canceling out of the custom policy editor would sometimes revert to
the wrong value. This would happen for tokens that currently have a custom
policy set.

  • Manually tested a bunch of combinations of changing expiration dates,
    policies and notes on the tokens config page.
  • Ran JS unit tests.