fix: handle PID 0 submission rows
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].hrefdereference is absent; - the branch is one commit ahead of and zero commits behind
dev; - only
XMOJ.user.jsis 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:
- I have read and understood the contributor's guide and this template.
- The non-obvious PID 0 condition is documented in the code.
- Static checks have been completed; browser testing remains outstanding.
- I am willing to help maintain this change if issues arise.
- It is compatible with the GNU General Public License v3.0.
- The change contains one focused commit.
- I checked that no other open PR targets this issue.
- The fix prevents one malformed row from breaking the entire submission table.
- I accept that maintainers may decline the change.
- The submission is given freely without ownership claims.
- 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.jsto use DOM-built anchors and a scoped null check for the resubmit link. - Bump version to 3.6.2 and refresh
Update.jsonprerelease 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 + “重交”.