PB-1635 Hide expired items in search #572
Open
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.
This hides expired items in the
/search
endpoints. That this wasn't done already only became apparent when a bug prevented the cron jobcron-delete-expired
to clean up expired items properly, see PB-1575.There are two search endpoints affected by this change:
We hide an item if has property "expires" set to a time in the past, so in principle the same as in these endpoints:
To discuss:
There is a small difference to the Item endpoints. I first check if the field is defined and then compare timestamps, not vice versa:
Q(properties_expires__gte=timezone.now()) | Q(properties_expires=None)
Q(properties_expires=None) | Q(properties_expires__gte=timezone.now())
I don't see why you would check for
None
only after... Is this a bug?To check whether an expiry date is in the past, the reference time is the time at which the query is processed on our server. As storage and filtering is done on the same server, I don't see problems with time zones.