Add new get_in_reply_to helper

master
Thomas Sileo 2019-04-16 22:40:45 +02:00
rodzic 3c6ba44ae6
commit 27279d3306
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -914,6 +914,16 @@ class Note(BaseActivity):
return False
def get_in_reply_to(self) -> Optional[str]:
if self.inReplyTo is None:
return None
elif isinstance(self.inReplyTo, str):
return self.inReplyTo
elif isinstance(self.inReplyTo, dict):
return self.inReplyTo["id"]
else:
raise ValueError(f"unexpected inReplyTo: {self.inReplyTo}")
class Question(Note):
ACTIVITY_TYPE = ActivityType.QUESTION