Fix bugs in the API tokens config page.

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

maubin
Review Board
release-5.0.x
reviewboard

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.
Summary
Fix bugs on API tokens config page.
Description From Last Updated

Typo in description: woudl -> would

daviddavid

In this case, we'll alert but then continue on below and try to save with an undefined policy. Seems like …

daviddavid

Let's move the definition of note into the if body here. No reason to fetch the value if we're not …

daviddavid

Can you add a trailing comma here?

daviddavid
maubin
david
  1. 
      
  2. Typo in description: woudl -> would

  3. In this case, we'll alert but then continue on below and try to save with an undefined policy. Seems like we should probably just return here.

  4. Let's move the definition of note into the if body here. No reason to fetch the value if we're not going to do anything with it.

  5. Can you add a trailing comma here?

  6. 
      
maubin
david
  1. Ship It!
  2. 
      
chipx86
  1. Ship It!
  2. 
      
maubin
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (4695d74)
Loading...