Test for the Accept activity on Follow objects. If true, return the Accept activity from to_base.

various-fixes
Alain St-Denis 2023-03-01 16:42:09 -05:00
rodzic 9f1cc9432f
commit c574f69adc
1 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -1104,10 +1104,13 @@ class Follow(Activity, base.Follow):
return super().to_as2()
def to_base(self):
# This is assuming Follow can only be the object of an Undo activity. Lazy.
if self.activity != self:
if isinstance(self.activity, Undo):
self.following = False
# Socialhome doesn't know what to do with Accept objects yet.
if isinstance(self.activity, Accept):
return self.activity
return self
def post_receive(self) -> None:
@ -1252,6 +1255,9 @@ class Like(Activity, base.Reaction):
# inbound Accept is a noop...
class Accept(Create, base.Accept):
def validate(self):
pass
class Meta:
rdf_type = as2.Accept
exclude = ('created_at',)