fix: handle PID 0 submission rows

Merged
BO
2mo ago
+27-3

What does this PR aim to accomplish?:

Fixes the submission-history layout failure reported in #1012.

This is the same PID 0 edge case previously discussed in #16, which was closed without a defensive rendering fix.

Closes #1012

How does this PR accomplish the above?:

PID 0 submission rows do not contain the usual resubmit anchor. The ResetType layout code previously accessed that missing anchor's .href, throwing an exception and stopping the remaining row transformations.

This change:

  • always renders the source link;
  • renders “重交” only when the resubmit anchor exists;
  • preserves the existing output for ordinary submission rows.

Static verification performed:

  • the complete userscript parses successfully;
  • the previous unsafe children[1].href dereference is absent;
  • the branch is one commit ahead of and zero commits behind dev;
  • only XMOJ.user.js is changed (6 additions, 1 deletion).

Browser verification is still needed for both the new and classic XMOJ interfaces, so this PR is intentionally opened as a draft.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide and this template.
  2. The non-obvious PID 0 condition is documented in the code.
  3. Static checks have been completed; browser testing remains outstanding.
  4. I am willing to help maintain this change if issues arise.
  5. It is compatible with the GNU General Public License v3.0.
  6. The change contains one focused commit.
  7. I checked that no other open PR targets this issue.
  8. The fix prevents one malformed row from breaking the entire submission table.
  9. I accept that maintainers may decline the change.
  10. The submission is given freely without ownership claims.
  11. New/classic UI browser verification has not yet been completed.

  • I have read the above and my PR is ready for review. Left unchecked until browser verification is completed.

Summary by Sourcery

Handle PID 0 submission rows safely so one malformed row no longer interrupts submission-history rendering.

Bug Fixes:

  • Prevent submission-history rendering from failing when rows with PID 0 lack a resubmit link.
  • Preserve source-link rendering while showing the “重交” link only for submissions that support resubmission.

Build:

  • Bump the userscript and package versions to 3.6.2.

Chores:

  • Update release metadata in Update.json.

Summary by cubic

Fixes submission-history crashes for PID 0 rows by building links with the DOM and guarding a missing resubmit link. Previously we concatenated innerHTML and read children[1].href unconditionally; now we always render the source link and append “重交” only when a resubmit link exists, leaving normal rows unchanged.

  • Update XMOJ.user.js to use DOM-built anchors and a scoped null check for the resubmit link.
  • Bump version to 3.6.2 and refresh Update.json prerelease timestamp and notes; no config or migration required. Addresses #1012.
  • Verify in classic and new UIs: PID 0 rows show only the source link; other rows show source + “重交”.