Check if mod is published in CKAN triggers #257
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
CKAN is receiving mod indexing requests for unpublished mods, which are then updated at publish. KSP-CKAN/NetKAN#7896:
Unpublished mods aren't supposed to be revealed to the world in any way, and CKAN's validation checks won't work until publish.
Cause
In #231 a
notify_ckan
call increate_mod
was changed tosend_to_ckan
.notify_ckan
did not make sense because it only works for mods that are already indexed. However,send_to_ckan
still doesn't make sense because a mod at this point is not published, and all other usages of this function checkmod.published
.create_mod
as currently written cannot validly trigger any CKAN events. However, in principle it is possible that at some point in the futurecreate_mod
might also set a mod as published, if such a change was worked on.Changes
Now
notify_ckan
andsend_to_ckan
themselves check bothmod.ckan
andmod.published
internally and only send triggers if both are true, so it will be safe to call either one whenever we want. NetKAN pull requests will now be submitted at publish instead of creation. The code calling these functions no longer checks either of these properties.