Don't spawn a task when an activity has no attachments

This commit is contained in:
Thomas Sileo
2019-08-11 12:17:02 +02:00
parent 6a459d0f87
commit 075d3c3742
2 changed files with 6 additions and 1 deletions

View File

@@ -284,7 +284,9 @@ def task_cache_actor() -> _Response:
# )
app.logger.info(f"actor cached for {iri}")
if activity.has_type([ap.ActivityType.CREATE, ap.ActivityType.ANNOUNCE]):
if activity.has_type(
[ap.ActivityType.CREATE, ap.ActivityType.ANNOUNCE]
) and activity.get_object()._data.get("attachment", []):
Tasks.cache_attachments(iri)
except (ActivityGoneError, ActivityNotFoundError):