Wykres commitów

87 Commity (main)

Autor SHA1 Wiadomość Data
Marnanel Thurman 31dede8c2c Better logging for inbox calculation 2021-02-18 18:36:37 +00:00
Marnanel Thurman 37d53b2e4e Status.content and Status.spoiler_text are now Status.content_source and Status.spoiler_source.
HTML renderings of each one are cached. You can access them at Status.content_as_html
and Status.spoiler_as_html.
2021-02-16 22:58:42 +00:00
Marnanel Thurman dbdad70376 LocalPerson.inbox uses Q objects rather than union(), because
union precludes filtering later.

See:
https://stackoverflow.com/questions/49260393/django-filter-a-queryset-made-of-unions-not-working
2021-02-15 18:21:57 +00:00
Marnanel Thurman a9d03dd280 Shorten Status.__str__ because it gets overwhelming in the logs 2021-02-14 21:59:47 +00:00
Marnanel Thurman 6ae898af03 Inbox lookup for LocalPerson used the "follow" relationship backwards; now fixed. 2021-02-14 21:57:32 +00:00
Marnanel Thurman 757132aa36 Status contents and user bios are returned as HTML.
I've implemented this with *_as_html accessors on the objects,
rather than doing it in the serialisers, so that we can easily
make them read/write if we need to.

Tests updated.

Closes issue #36, and I think we're done with %shine.
2020-11-25 20:23:11 +00:00
Marnanel Thurman 2e82f842e3 RemotePerson.followers and RemotePerson.following both implemented in terms of the same helper function.
LocalPerson.followers moved to Person.followers, where it should always have been.
RemotePerson.followers overrides this, just as RemotePerson.following overrides Person.following.

Closes issue #64.
2020-11-16 02:19:03 +00:00
Marnanel Thurman dae5017e3d LocalPerson gains get_followers_collection() and get_following_collection(),
which are aliases for the followers and following properties.

This isn't elegant, but it makes the views easier. When we fix
issue 64, we should return to the question of these accessors
for Persons in general.
2020-10-31 17:42:51 +00:00
Marnanel Thurman 949cd70f1b Merge branch 'mentions' into issue-47 2020-10-29 17:59:30 +00:00
Marnanel Thurman 38eac12111 Status gains to and cc properties, both currently stubs 2020-10-29 16:43:54 +00:00
Marnanel Thurman b193096666 Status.tags() returns a list, not a QuerySet 2020-10-29 16:31:15 +00:00
Marnanel Thurman 3db8b2a43f Merge branch 'mentions' into issue-47 2020-10-29 04:23:06 +00:00
Marnanel Thurman 297d3cbf56 Status returns mentions correctly 2020-10-29 04:17:35 +00:00
Marnanel Thurman 53e157dc6a added Mention class 2020-10-29 04:17:22 +00:00
Marnanel Thurman c797fdaf74 fix header comment error 2020-10-29 03:24:15 +00:00
Marnanel Thurman 930deeb360 Merge branch 'tombstones' into issue-47 2020-10-29 01:54:20 +00:00
Marnanel Thurman d044415053 add "gone" field to LocalPerson 2020-10-29 01:53:01 +00:00
Marnanel Thurman c4c175738f Merge branch 'status-serialisers' into issue-47 2020-10-29 01:00:57 +00:00
Marnanel Thurman 88bef76a14 add "activity_url" property to Status, and corresponding STATUS_ACTIVITY_URL template to settings 2020-10-29 00:27:46 +00:00
Marnanel Thurman bbb0fc278a added missing "self" in Like.__str__() 2020-10-27 18:32:14 +00:00
Marnanel Thurman 0d5b665434 LocalPerson gains has_liked(). Tests updated. 2020-10-27 18:19:29 +00:00
Marnanel Thurman fec67697d8 Status sends "reblogged" signal on object creation if the object is a reblog, and "posted" otherwise 2020-10-24 23:27:02 +01:00
Marnanel Thurman 32e2e145af "liked" signal sent by Like rather than the view.
New "unliked" signal, but we don't use it yet.
2020-10-24 23:24:54 +01:00
Marnanel Thurman 9e52df11ff Status gains "send_signal" in the same way as in commit 9008d1df 2020-10-24 23:17:13 +01:00
Marnanel Thurman 9008d1df3c Follow's save() and delete() methods gain a "send_signal" param, defaulting to False 2020-10-24 23:10:39 +01:00
Marnanel Thurman e9cb4ff574 the problem was that one of the tests created Follows in the actual test,
which previously didn't send signals but now did, and the LocalPersons
it had created had auto_follow=True. So we accidentally fixed a test breakage
we didn't know about.

Still some issues to resolve here.
2020-10-23 22:27:30 +01:00
Marnanel Thurman 3486194d90 right, this should work 2020-10-23 22:17:04 +01:00
Marnanel Thurman 0259daf3ed "url" param of trilby's Person renamed to "remote_url" per policy; "status" field or attribute removed in both Person subclasses.
It was getting too confusing to store people who don't exist in Person. See sombrero's Failure for where they went.
2020-10-19 16:51:11 +01:00
Marnanel Thurman d2fda1e974 Only local accounts can receive Notifications. Closes issue #43.
As part of this, remove the previously undiscovered ability to send Accepts for remote users!
2020-10-11 15:46:06 +01:00
Marnanel Thurman d3c0663a96 LocalPerson gains "featured" attribute. Bowler gains FeaturedView.
Tests updated. Closes issue #41.
2020-10-11 15:36:58 +01:00
Marnanel Thurman 9d679815a6 trilby_api.models.Status gains "is_local" for symmetry with Person.
Tests updated.
2020-10-10 02:16:31 +01:00
Marnanel Thurman 1d4b0f957a Creating a Status causes trilby_api.signals.posted to be sent.
The signal isn't currently received by anything.
2020-10-09 15:04:51 +01:00
Marnanel Thurman e2565849d8 Creating a new TrilbyUser (e.g. using Django's "createsuperuser") automatically creates a new LocalPerson for that user.
Closes issue #18.
2020-10-09 03:26:15 +01:00
Marnanel Thurman 3d38c6618a Replaced the "requested" flag in Follow with an "offer" field which holds the ID of the follow request. 2020-09-30 15:44:16 +01:00
Marnanel Thurman 48fbb745de removed trailing whitespace throughout (pylint C0303) 2020-09-19 15:58:35 +01:00
Marnanel Thurman f4889f4def LocalPerson: inbox -> inbox_url, and inbox_collection -> inbox.
This fixes a regression.
2020-09-19 15:07:57 +01:00
Marnanel Thurman c586eecfcb The *_url methods of LocalPerson should always have been properties
(as they are for RemotePerson).
2020-09-16 20:32:26 +01:00
Marnanel Thurman 66373041e7 Trilby keeps track of all the URLs given for a RemotePerson. 2020-09-15 17:59:47 +01:00
Marnanel Thurman e3520eee53 Partial checkin. The "followers" property on RemotePersons and LocalPersons is now handled separately.
On a LocalPerson, our own models are the authoritative source for their followers.
On a RemotePerson, we have to grab the list from the remote server.

I've made some tests for the LocalPerson part, but the RemotePerson part
still needs testing. This has involved creating a test_person module
in trilby, because test_account is for integration tests.
2020-09-14 01:06:38 +01:00
Marnanel Thurman e09abfa356 The "inbox" collection property of LocalPerson is renamed to "inbox_collection".
This is for consistency with "inbox" for RemotePerson, which is merely the URL.

At some point it will need to be "get_inbox_collection", but that will
make it visible via ActivityPub and we need to make sure permissions are checked.
2020-09-10 23:23:05 +01:00
Marnanel Thurman faf663be6f get_outbox_collection returns all the user's posts (for now). 2020-08-28 22:12:22 +01:00
Marnanel Thurman a6e80e1de6 Person.lookup() removed because it duplicates the functionality of fetch().
There is one difference, which I think isn't important in the circumstances.
If lookup() is asked about a remote person that we don't already know about,
it either creates a blank record for them and returns it, or raises an error.
In these circumstances, fetch() will perform a lookup and populate the record
accordingly.
2020-08-23 18:10:50 +01:00
Marnanel Thurman e1cb0208db A user's home timeline contains *all* posts of theirs, not just public and private ones
All trilby tests now pass
2020-08-23 17:13:01 +01:00
Marnanel Thurman 8d0eea8e75 some extra logging in views and models of trilby 2020-08-23 17:09:42 +01:00
Marnanel Thurman b42887616e Fix some of the headers in trilby.
Standard comment block at the start, and getting the logger in the same way.
2020-08-23 16:54:43 +01:00
Marnanel Thurman 33555806e8 The great types in trilby_api, Person and Status, now have
local_form() and remote_form() class methods. This is to
allow fetch() to check whether something is already cached
before fetching it.

LocalPerson also gains a status() method for symmetry with
RemotePerson; it always returns 200.

Tests updated.
2020-08-22 22:26:22 +01:00
Marnanel Thurman ccdc414ad8 Undoing the AcObject changes introduced in e9d780d2.
The changes would require multiple inheritance, which
PolymorphicModel doesn't support.
2020-08-20 16:36:40 +01:00
Marnanel Thurman e9d780d2a3 trilby's Status and Person classes now descend from a common ancestor,
AcObject. This allows bowler to return objects it finds without having
to require a particular type.
2020-08-15 18:51:59 +01:00
Marnanel Thurman 83f30d26db Logging is now via getLogger(name="kepi"), and this is done
before any other imports. This change is only partially finished;
it affects nothing except the logging but it should happen in all
the source files. There's just a lot of them.
2020-08-04 17:19:37 +01:00
Marnanel Thurman 06b9774418 Implemented the reblog fields of Status. Added "original" field.
Added tests for these.
2020-07-24 00:51:41 +01:00