Fix setting prefixed standard fields on the repository form.

Review Request #11005 — Created April 28, 2020 and submitted

Information

Review Board
release-3.0.x

Reviewers

A recent change fixed performing HTTP PUT operations on the repository
resource without providing entire payloads for the form. It computed the
initial data based on a repository and populated the form, trying to
create a solid starting point.

This had a bug, though, that prevented actually submitting the
repository form via the administration page. It no longer considered
that some standard fields, like path, mirror_path, username, etc.,
might be submitted with an SCMTool prefix (e.g., git-mirror_path), and
this caused it to override these provided values with the initial data,
preventing these fields from being changed again.

This bug did not make it into a release, or into production on
RBCommons.

This change fixes the new logic on the repository form to check whether
the prefixed form of a key was posted on the form data before trying to
figure out a fallback value for it. If it's explicitly posted, we use
the existing value. Otherwise, we now normalize a prefixed form, if one
was provided, and then fall back on the initial value.

Unit tests passed.

I was able to successfully modify the formerly-broken fields for
several existing repositories.

Summary ID
Fix setting prefixed standard fields on the repository form.
A recent change fixed performing HTTP PUT operations on the repository resource without providing entire payloads for the form. It computed the initial data based on a repository and populated the form, trying to create a solid starting point. This had a bug, though, that prevented actually submitting the repository form via the administration page. It no longer considered that some standard fields, like `path`, `mirror_path`, `username`, etc., might be submitted with an SCMTool prefix (e.g., `git-mirror_path`), and this caused it to override these provided values with the initial data, preventing these fields from being changed again. This bug did *not* make it into a release, or into production on RBCommons. This change fixes the new logic on the repository form to check whether the prefixed form of a key was posted on the form data before trying to figure out a fallback value for it. If it's explicitly posted, we use the existing value. Otherwise, we now normalize a prefixed form, if one was provided, and *then* fall back on the initial value.
b763d3702de800a4810b6b518a1816a490953fe0
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (2a96033)