mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-26 17:08:09 +00:00
Save last edited by user
This commit is contained in:
parent
85b1c920cd
commit
ae5e744731
3 changed files with 9 additions and 4 deletions
|
@ -11,6 +11,7 @@ class Book(ActivityObject):
|
||||||
""" serializes an edition or work, abstract """
|
""" serializes an edition or work, abstract """
|
||||||
|
|
||||||
title: str
|
title: str
|
||||||
|
lastEditedBy: str = None
|
||||||
sortTitle: str = ""
|
sortTitle: str = ""
|
||||||
subtitle: str = ""
|
subtitle: str = ""
|
||||||
description: str = ""
|
description: str = ""
|
||||||
|
|
|
@ -148,14 +148,14 @@ class ActivitypubMixin:
|
||||||
mentions = self.recipients if hasattr(self, "recipients") else []
|
mentions = self.recipients if hasattr(self, "recipients") else []
|
||||||
|
|
||||||
# we always send activities to explicitly mentioned users' inboxes
|
# we always send activities to explicitly mentioned users' inboxes
|
||||||
recipients = [u.inbox for u in mentions or []]
|
recipients = [u.inbox for u in mentions or [] if not u.local]
|
||||||
|
|
||||||
# unless it's a dm, all the followers should receive the activity
|
# unless it's a dm, all the followers should receive the activity
|
||||||
if privacy != "direct":
|
if privacy != "direct":
|
||||||
# we will send this out to a subset of all remote users
|
# we will send this out to a subset of all remote users
|
||||||
queryset = user_model.viewer_aware_objects(user).filter(
|
queryset = user_model.viewer_aware_objects(user).filter(
|
||||||
local=False,
|
local=False,
|
||||||
)
|
).distinct()
|
||||||
# filter users first by whether they're using the desired software
|
# filter users first by whether they're using the desired software
|
||||||
# this lets us send book updates only to other bw servers
|
# this lets us send book updates only to other bw servers
|
||||||
if software:
|
if software:
|
||||||
|
@ -175,7 +175,7 @@ class ActivitypubMixin:
|
||||||
"inbox", flat=True
|
"inbox", flat=True
|
||||||
)
|
)
|
||||||
recipients += list(shared_inboxes) + list(inboxes)
|
recipients += list(shared_inboxes) + list(inboxes)
|
||||||
return recipients
|
return list(set(recipients))
|
||||||
|
|
||||||
def to_activity_dataclass(self):
|
def to_activity_dataclass(self):
|
||||||
""" convert from a model to an activity """
|
""" convert from a model to an activity """
|
||||||
|
|
|
@ -26,7 +26,11 @@ class BookDataModel(ObjectMixin, BookWyrmModel):
|
||||||
max_length=255, blank=True, null=True, deduplication_field=True
|
max_length=255, blank=True, null=True, deduplication_field=True
|
||||||
)
|
)
|
||||||
|
|
||||||
last_edited_by = models.ForeignKey("User", on_delete=models.PROTECT, null=True)
|
last_edited_by = fields.ForeignKey(
|
||||||
|
"User",
|
||||||
|
on_delete=models.PROTECT,
|
||||||
|
null=True,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
""" can't initialize this model, that wouldn't make sense """
|
""" can't initialize this model, that wouldn't make sense """
|
||||||
|
|
Loading…
Reference in a new issue