Catch all the subtypes too
This commit is contained in:
parent
2fda9ad2b4
commit
933f6660d5
|
@ -69,9 +69,7 @@ class InboxMessageStates(StateGraph):
|
||||||
# It's a string object, but these will only be for Follows
|
# It's a string object, but these will only be for Follows
|
||||||
Follow.handle_accept_ap(instance.message)
|
Follow.handle_accept_ap(instance.message)
|
||||||
case unknown:
|
case unknown:
|
||||||
raise ValueError(
|
return cls.errored
|
||||||
f"Cannot handle activity of type accept.{unknown}"
|
|
||||||
)
|
|
||||||
case "reject":
|
case "reject":
|
||||||
match instance.message_object_type:
|
match instance.message_object_type:
|
||||||
case "follow":
|
case "follow":
|
||||||
|
@ -80,9 +78,7 @@ class InboxMessageStates(StateGraph):
|
||||||
# It's a string object, but these will only be for Follows
|
# It's a string object, but these will only be for Follows
|
||||||
Follow.handle_reject_ap(instance.message)
|
Follow.handle_reject_ap(instance.message)
|
||||||
case unknown:
|
case unknown:
|
||||||
raise ValueError(
|
return cls.errored
|
||||||
f"Cannot handle activity of type reject.{unknown}"
|
|
||||||
)
|
|
||||||
case "undo":
|
case "undo":
|
||||||
match instance.message_object_type:
|
match instance.message_object_type:
|
||||||
case "follow":
|
case "follow":
|
||||||
|
@ -97,9 +93,7 @@ class InboxMessageStates(StateGraph):
|
||||||
# We're ignoring emoji reactions for now
|
# We're ignoring emoji reactions for now
|
||||||
pass
|
pass
|
||||||
case unknown:
|
case unknown:
|
||||||
raise ValueError(
|
return cls.errored
|
||||||
f"Cannot handle activity of type undo.{unknown}"
|
|
||||||
)
|
|
||||||
case "delete":
|
case "delete":
|
||||||
# If there is no object type, we need to see if it's a profile or a post
|
# If there is no object type, we need to see if it's a profile or a post
|
||||||
if not isinstance(instance.message["object"], dict):
|
if not isinstance(instance.message["object"], dict):
|
||||||
|
@ -121,9 +115,7 @@ class InboxMessageStates(StateGraph):
|
||||||
case "note":
|
case "note":
|
||||||
Post.handle_delete_ap(instance.message)
|
Post.handle_delete_ap(instance.message)
|
||||||
case unknown:
|
case unknown:
|
||||||
raise ValueError(
|
return cls.errored
|
||||||
f"Cannot handle activity of type delete.{unknown}"
|
|
||||||
)
|
|
||||||
case "add":
|
case "add":
|
||||||
PostInteraction.handle_add_ap(instance.message)
|
PostInteraction.handle_add_ap(instance.message)
|
||||||
case "remove":
|
case "remove":
|
||||||
|
@ -150,9 +142,7 @@ class InboxMessageStates(StateGraph):
|
||||||
instance.message["object"]
|
instance.message["object"]
|
||||||
)
|
)
|
||||||
case unknown:
|
case unknown:
|
||||||
raise ValueError(
|
return cls.errored
|
||||||
f"Cannot handle activity of type __internal__.{unknown}"
|
|
||||||
)
|
|
||||||
case unknown:
|
case unknown:
|
||||||
return cls.errored
|
return cls.errored
|
||||||
return cls.processed
|
return cls.processed
|
||||||
|
|
Loading…
Reference in New Issue