osf.io icon indicating copy to clipboard operation
osf.io copied to clipboard

[ENG-6242] Resolve issue with updating preprint fields and validation errors

Open uditijmehta opened this issue 1 year ago • 7 comments

Purpose

Fix form validation issues in the preprint model and serializer.

Changes

  • Updated preprint model to correctly handle validation.
  • Modified serializer logic to properly manage field validation.

Ticket

ENG-6242

uditijmehta avatar Sep 20 '24 17:09 uditijmehta

@uditijmehta Could you resolve the conflicts by merging master into this branch?

brianjgeiger avatar Oct 04 '24 12:10 brianjgeiger

Late to the CR party, one suggestion and one potential blocker?

  • I think we can remove handle_author_assertions() since we have removed the only usage of it.
  • One crucial part in handle_author_assertions() was not ported to the "expanded" if statements: admin permission check. This is not testable by QA due to the assertion page disabled by FE but I think WRITE contributor can use API to change it. Probably a blocker?

cslzchen avatar Oct 07 '24 19:10 cslzchen

@cslzchen So we need to make sure to require admin permissions to do author assertions before we move forward is the suggestion?

brianjgeiger avatar Oct 07 '24 19:10 brianjgeiger

Yes, I think so.

cslzchen avatar Oct 07 '24 19:10 cslzchen

@uditijmehta Could you make that change, and also add a test for that case?

brianjgeiger avatar Oct 07 '24 19:10 brianjgeiger

New changes seem good to me. @cslzchen?

brianjgeiger avatar Oct 09 '24 15:10 brianjgeiger

  • I see we have two parts of the same/similar check, one is R344-R410 with the admin check patch while the other is R491-R551 without the admin patch. Maybe duplicate / left-over code?

  • In addition, we should remove this method def handle_author_assertions(self, preprint, validated_data, auth): ...

cslzchen avatar Oct 10 '24 08:10 cslzchen

I cherry-picked 6 commits (and force pushed back) since the original branch has develop changes which should not be released to production.

Original branch has been backed up in https://github.com/cslzchen/osf.io/tree/hotfix/form-validation-issues-backup.

cslzchen avatar Oct 21 '24 15:10 cslzchen