From 41824d12067cf12a8a92b44e20b59ec414aee9b5 Mon Sep 17 00:00:00 2001 From: kzhovn <60860948+kzhovn@users.noreply.github.com> Date: Tue, 9 Apr 2024 06:14:31 -0700 Subject: [PATCH] Update biography DEFAULTSORT autofill to work with paranthetical disambiguation (#225) * When accepting biography, autofills name when there is a paranthetical disambiguation * Update comment to reflect removing disambig when autofilling * revert change to package.json because it will cause a merge conflict * fix 3 code review suggestions --------- Co-authored-by: kzhovn Co-authored-by: NovemLinguae --- src/modules/submissions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/submissions.js b/src/modules/submissions.js index 8b5f9f8a..caad73c0 100644 --- a/src/modules/submissions.js +++ b/src/modules/submissions.js @@ -1704,9 +1704,11 @@ function prefillBiographyDetails() { var titleParts; - // Prefill `LastName, FirstName` for Biography if the page title is two words and + // Prefill `LastName, FirstName` for Biography if the page title is two words + // after removing any trailing parentheticals (likely disambiguation), and // therefore probably safe to asssume in a `FirstName LastName` format. - titleParts = afchSubmission.shortTitle.split( ' ' ); + var title = afchSubmission.shortTitle.replace( / \([\s\S]*?\)$/g, '' ); + titleParts = title.split( ' ' ); if ( titleParts.length === 2 ) { $afch.find( '#subjectName' ).val( titleParts[ 1 ] + ', ' + titleParts[ 0 ] ); }