Skip to content

Preprint authors use the journal FrozenAuthor system; updates are moderated drafts - #5612

Merged
mauromsl merged 8 commits into
r-v1.9.xfrom
b-preprint-frozen-authors-1.9
Oct 8, 2026
Merged

mauromsl merged 8 commits into
r-v1.9.xfrom
b-preprint-frozen-authors-1.9

Conversation

@ajrbyers

@ajrbyers ajrbyers commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Moves preprint authors from PreprintAuthor (one row per linked account) to the journal FrozenAuthor model, and makes author-submitted updates moderated drafts.

What changed

Authors

  • Preprint authors are FrozenAuthor rows on the preprint, with ROR affiliations (ControlledAffiliation) and CRediT roles, as for articles. Authors no longer need an account.
  • Submitting authors and moderators edit authors with the journal author pages (add, link by email, reorder, remove, affiliations).
  • Each superseded version keeps its own author list and custom field answers.
  • Crossref deposits and OAI records output the FrozenAuthors and their organisations.
  • Account merges carry over preprint, update and version author lists.

Moderated updates

  • A new version, correction or metadata correction starts as a draft holding a full copy of the preprint's metadata: title, abstract, DOI, authors and custom fields. The author edits and submits it.
  • On approval, only the sections the author changed replace the live ones, so moderator edits made in the meantime are kept. There is one open update per preprint.
  • The version queue loads each update's details in a pop-up (htmx) showing the changes, with a warning naming any sections that changed since the draft started.
  • Draft, author and approval edits are locked (select_for_update) so concurrent changes can't be lost.

API

  • Preprint authors read and write FrozenAuthors. Field names are unchanged; pk is the linked account's ID, if any.
  • version_queue accepts authors and additional_field_answers and reports the changed sections.
  • ?search= on the manager preprint API works again and stays within the current repository.

Upgrading

  • Migrations: repository 0060–0062, submission 0093–0094, core 0116.
  • repository 0061 copies every PreprintAuthor onto its preprint as a FrozenAuthor, with affiliations, CRediT records and order. repository 0062 then deletes PreprintAuthor.
  • Back up before migrating. The migrations can be reversed, but the reverse only restores authors who have an account, and drops the author lists of superseded versions. Rolling back after authors have been edited loses data.

Follow-ups

@ajrbyers
ajrbyers force-pushed the b-preprint-frozen-authors-1.9 branch 2 times, most recently from 5b7866d to c134e67 Compare October 7, 2026 11:20
@ajrbyers
ajrbyers force-pushed the b-preprint-frozen-authors-1.9 branch from c134e67 to 84eb6d5 Compare October 7, 2026 11:49
@ajrbyers
ajrbyers changed the base branch from r-v1.9.x to master October 7, 2026 11:50
@ajrbyers
ajrbyers added this pull request to stack #5624 October 7, 2026 11:50
@ajrbyers
ajrbyers removed this pull request from stack #5624 October 7, 2026 11:51
@ajrbyers
ajrbyers changed the base branch from master to r-v1.9.x October 7, 2026 11:51
@ajrbyers
ajrbyers added this pull request to stack #5625 October 7, 2026 11:51
@ajrbyers
ajrbyers requested a review from mauromsl October 7, 2026 12:09

@mauromsl mauromsl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I've noticed inline. I've also already merged #5618 so might be worth rebasing

Comment thread src/submission/models.py Outdated
Comment on lines +2878 to +2879
copy = FrozenAuthor.objects.get(pk=self.pk)
copy.pk = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This copying pattern in django can be a bit dangerous, as it is mutating an object in memory (even tho it does the trick). It would be safer to use django.forms.models.model_to_dict. e.g, if we add a new m2m relationship to this model, tests will fail when using model_to_dict whilst the mutation done here would silently drop those relations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, switched to model_to_dict in d7b9674. There is a new core.model_utils.copy_instance(instance, **fields) that builds the copy from model_to_dict, so a many-to-many field added later raises a TypeError instead of being dropped. FrozenAuthor.copy() and RepositoryFieldAnswer.copy() both use it, with a test for each case.

Comment thread src/submission/models.py Outdated
Comment on lines +2884 to +2893
for affiliation in affiliations:
affiliation.pk = None
affiliation.frozen_author = copy
# bulk_create skips save(), which would make the first copy primary.
core_models.ControlledAffiliation.objects.bulk_create(affiliations)
for credit in credits:
credit.pk = None
credit.frozen_author = copy
credit.save()
return copy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these might be easier to do with the model_to_dict too, since they become a list of pks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in the same commit: affiliations and CRediT records are built with copy_instance too. Affiliations still go through bulk_create, as ControlledAffiliation.save() would make the first copy primary. Also rebased on r-v1.9.x with #5618 in; the repository migrations are now 0060–0062.

@mauromsl mauromsl assigned ajrbyers and unassigned mauromsl Oct 7, 2026
@ajrbyers
ajrbyers force-pushed the b-preprint-frozen-authors-1.9 branch from 84eb6d5 to d7b9674 Compare October 8, 2026 12:13
@ajrbyers
ajrbyers requested a review from mauromsl October 8, 2026 12:19
@ajrbyers ajrbyers assigned mauromsl and unassigned ajrbyers Oct 8, 2026
@mauromsl
mauromsl merged commit 05ce8ae into r-v1.9.x Oct 8, 2026
4 checks passed
@mauromsl
mauromsl deleted the b-preprint-frozen-authors-1.9 branch October 8, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants