Type and fanout fixes

This commit is contained in:
Andrew Godwin 2022-12-20 07:01:30 +00:00
parent 6eaaa6eac4
commit f4f575d22f
2 changed files with 9 additions and 2 deletions

View file

@ -23,6 +23,10 @@ class FanOutStates(StateGraph):
fan_out = await instance.afetch_full()
# Don't try to fan out to identities that are not fetched yet
if not (fan_out.identity.local or fan_out.identity.inbox_uri):
return
match (fan_out.type, fan_out.identity.local):
# Handle creating/updating local posts
case ((FanOut.Types.post | FanOut.Types.post_edited), True):

View file

@ -135,8 +135,11 @@ class InboxMessage(StatorModel):
return self.message["type"].lower()
@property
def message_object_type(self):
return self.message["object"]["type"].lower()
def message_object_type(self) -> str | None:
if isinstance(self.message["object"], dict):
return self.message["object"]["type"].lower()
else:
return None
@property
def message_type_full(self):