Closed josegar74 closed 2 months ago
@ianwallen, @wangf1122 this issue is related to this change:
The ApprovePublishedRecord listener previously reindexed the metadata, but with that change doesn't do it anymore.
Either we need to update that line or trigger manually a reindex after https://github.com/geonetwork/core-geonetwork/blob/c9164d0e1f1106f5a9d26dca81962b954508a533/listeners/src/main/java/org/fao/geonet/listener/metadata/draft/ApprovePublishedRecord.java#L98
Do you remember why was removed the reindex in that line?
@josegar74 @ianwallen
I remember it was done in this pull request https://github.com/geonetwork/core-geonetwork/pull/7514
Its doing opposite here as the index was updated prematurely in the middle of the transaction. If there is something failing (which we customized some listener in our environment), the index updated as next status and confused the user.
I can ran some test and confirm it
Thanks @wangf1122, with the default listener if you try the test case, you should be able to reproduce the problem.
@wangf1122 Maybe an option can be to do a manual reindex at the end of https://github.com/geonetwork/core-geonetwork/blob/c9164d0e1f1106f5a9d26dca81962b954508a533/listeners/src/main/java/org/fao/geonet/listener/metadata/draft/ApprovePublishedRecord.java#L80C17-L80C30 if does not occur an exception.
@josegar74
I did the pull request, https://github.com/geonetwork/core-geonetwork/pull/8344
The proposed change will fix the issue. There are two issues here
1) The status updating happens in this https://github.com/geonetwork/core-geonetwork/blob/c9164d0e1f1106f5a9d26dca81962b954508a533/listeners/src/main/java/org/fao/geonet/listener/metadata/draft/ApprovePublishedRecord.java#L114-L124 which is another thread from the execution API https://github.com/geonetwork/core-geonetwork/blob/c9164d0e1f1106f5a9d26dca81962b954508a533/services/src/main/java/org/fao/geonet/api/records/MetadataSharingApi.java#L1218
Upon the status updating, the index should be updated accordingly
2) The ui is lack of refreshing mechanism to get the latest metadata status to the page. I also added such UI small fix.
You can take a look of the change and test it
Describe the bug
Publishing a draft metadata (without approving it previously) changes the metadata status to
Approved
, but does not update the status in the search index, so it appears in the metadata page asDraft
. Triggering the metadata reindex manually updates the status.To Reproduce
Steps to reproduce the behavior:
Manage record
>Publish
Draft
, even if refreshing the page.Manage record
>Index record
and refresh the page. The status is displayed asApproved
Expected behavior After the publication, the metadata status in the page is updated to
Approved
, without requiring a manual reindex of the metadata.