Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require valid reference order for submission/publication #2300

Merged
merged 4 commits into from
Sep 21, 2024

Commits on Sep 20, 2024

  1. Do not force checkbox and radio elements to be display:block.

    Checkbox and radio elements should (almost always) be displayed inline
    with the text according to the browser default style, and should not
    be subject to a general rule that all input elements are block
    elements.
    
    (On the other hand, the invisible checkbox used in navbar.html should
    be invisible, so its selector needs to be made more specific.)
    Benjamin Moody committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    e1917b0 View commit details
    Browse the repository at this point in the history
  2. ActiveProject: Require valid reference order for submission.

    Past bugs in the project editing forms have allowed project references
    to be created with 'order=None', or with two references having the
    same 'order'.  If this is the case, it should not be possible to
    submit or publish the project until the author or editor addresses the
    issue.
    Benjamin Moody committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    b281917 View commit details
    Browse the repository at this point in the history
  3. ReferenceFormSet: Allow fixing invalid reference order.

    If a project has an invalid order of references, we must provide a way
    for the author or editor to review and fix the order.
    
    The past behavior of the "project content" and "copyedit" pages was
    that ReferenceFormSet would set the 'order' field for every form in
    the formset.  The effect of that, however, was that 'order' would be
    set for:
      (a) newly added references
      (b) existing references whose 'description' was changed
    References that already existed, and whose 'description' field was
    unchanged, would not have been saved (because their form.changed_data
    was False.)
    
    Since many existing projects may have scrambled lists of references
    and can't be fixed automatically, we want broken projects to be
    "flagged", and we want that flag to persist until someone is able to
    review the project and check that it's fixed.  In particular, simply
    opening the "project content" page and submitting it, without making
    any changes, should not cause the flag to be cleared.
    
    Therefore: if the project has an invalid reference order, then display
    a warning message with a checkbox (at the bottom of the page, below
    the reference list and above the submit button.)
    
    By default, that checkbox isn't checked, and in that situation,
    ReferenceFormSet should not alter any existing reference 'order'.
    Newly-added references should have a correct 'order', but if existing
    references were "invalid", they should remain "invalid".
    
    If the checkbox is checked, then ReferenceFormSet should set all
    reference 'order' to match the current form order (which is what the
    old code was trying to do, and didn't work because it didn't set
    changed_data.)
    Benjamin Moody committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    e3c752d View commit details
    Browse the repository at this point in the history
  4. project.test_views: test handling of invalid reference order.

    Past bugs in the project editing forms have allowed project references to
    be created with 'order=None', or with two references having the same
    'order'.  Either situation should now prevent the project from being
    submitted; check that this is the case.
    
    ReferenceFormSet should allow these situations to be fixed manually:
    if the confirm_reference_order checkbox is checked, then the 'order'
    of all references should be updated; and if that box is not checked,
    the 'order' of existing references should be untouched.  Check that
    this works as expected.
    Benjamin Moody committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    896cceb View commit details
    Browse the repository at this point in the history