default first_item to None or it doesn't exist when there's no toots

This commit is contained in:
jesopo 2019-11-26 14:31:22 +00:00
parent 76ccbbbc46
commit 8bb20bcb17

View file

@ -117,13 +117,13 @@ class Module(ModuleManager.BaseModule):
except ap_utils.FindActorException as e: except ap_utils.FindActorException as e:
raise utils.EventError(str(e)) raise utils.EventError(str(e))
actor = ap_actor.Actor(actor_url) actor = ap_actor.Actor(actor_url)
if not actor.load(): if not actor.load():
raise utils.EventError("Failed to load user") raise utils.EventError("Failed to load user")
items = actor.outbox.load() items = actor.outbox.load()
nonreply = [actor.followers] nonreply = [actor.followers]
first_item = None
for item in items: for item in items:
if item["type"] == "Announce" or item["object"]["cc"] == nonreply: if item["type"] == "Announce" or item["object"]["cc"] == nonreply:
first_item = item first_item = item