Skip to content

Commit a1429f6

Browse files
zzacharotmorrell
authored andcommitted
deposit: pass to the form config the published record if we edit one
* The published record is used to compare published DOI but it can be used also to compare with the published state of an editing draft.
1 parent ec2a0a0 commit a1429f6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

invenio_app_rdm/records_ui/views/deposits.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ def deposit_edit(pid_value, draft=None, draft_files=None, files_locked=True):
521521
ui_serializer = UIJSONSerializer()
522522
record = ui_serializer.dump_obj(draft.to_dict())
523523

524+
published_record = None
525+
# if editing draft of a published record
526+
if record.get("status") == "published":
527+
_record = service.read(g.identity, id_=record["id"]).to_dict()
528+
published_record = ui_serializer.dump_obj(_record)
529+
524530
community_ui = None
525531
community_theme = None
526532
community = record.get("expanded", {}).get("parent", {}).get("review", {}).get(
@@ -559,6 +565,7 @@ def deposit_edit(pid_value, draft=None, draft_files=None, files_locked=True):
559565
hide_community_selection=community_use_jinja_header,
560566
is_doi_required=is_doi_required,
561567
record=draft._record,
568+
published_record=published_record,
562569
)
563570

564571
if is_doi_required and not record.get("pids", {}).get("doi"):

0 commit comments

Comments
 (0)