Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the latest published dataset revision when returning results for the datastore query endpoint #4047

Merged
merged 8 commits into from
Nov 1, 2023

Conversation

jastraat
Copy link
Contributor

@jastraat jastraat commented Oct 27, 2023

Use the latest published dataset revision when returning results for the datastore query endpoint.
Also does some slight cleanup of the DatasetBTB test.

To recreate the error in a vanilla DKAN site:

  • Create a published dataset with a distribution.

  • Set the default moderation state to "draft".

  • Edit the dataset and replace the distribution file with data that is recognizably different than the published version. Save as a draft.

  • Run cron to do the imports

  • Visit the dataset page in the site and confirm that the published version of the dataset is still displayed.

  • Use the datastore query endpoint {domain}/api/1/datastore/query/{dataset}/{index} and observe that the data returned is from the unpublished draft, not the published version.

  • Test coverage exists

  • Documentation exists

QA Steps

  • Create a published dataset with a distribution.
  • Set the default moderation state to "draft".
  • Edit the dataset and replace the distribution file with data that is recognizably different than the published version. Save as a draft.
  • Run cron to do the imports
  • Verify that the draft revision exists by running ddev drush dkan:dataset-info {datasetID}
  • Visit the dataset page in the site and confirm that the published version of the dataset is still displayed.
  • Use the datastore query endpoint {domain}/api/1/datastore/query/{dataset}/{index} and observe that the data returned is still from the published version.

modules/common/src/DatasetInfo.php Show resolved Hide resolved
modules/common/src/DatasetInfo.php Outdated Show resolved Hide resolved
modules/common/src/DatasetInfo.php Outdated Show resolved Hide resolved
@jastraat jastraat requested a review from paul-m October 31, 2023 15:34
@dafeder dafeder merged commit 0f20b80 into 2.x Nov 1, 2023
12 checks passed
@dafeder dafeder deleted the query_published_not_latest branch November 1, 2023 04:22
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.

None yet

3 participants