Wykres commitów

155 Commity (a2c02abc2cd9fd98e4eeb42eab0f02e9a6ed28c1)

Autor SHA1 Wiadomość Data
Marnanel Thurman 4d63fd669d Remove "providing_args" from signals
This will probably break them, but we don't need them at present.
2023-09-22 16:36:22 +01:00
Thomas Thurman 07875e03ab config error, marnanel.org specific 2023-09-22 16:36:22 +01: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 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 2e794e2a8a bowler's tests gain BowlerClient, a subclass of django.test.Client
which will set the Accept param correctly on get requests.

Used throughout test_views instead of d.t.Client.
2020-11-25 20:20:55 +00:00
Marnanel Thurman e0517f6688 test_headers supplies correct Accept header.
Class name changed to Tests per coding standard.
2020-11-25 19:40:53 +00:00
Marnanel Thurman 0e15db00da User page is HTML or JSON depending on Accept header.
Closes issue #48.
2020-11-25 18:46:31 +00:00
Marnanel Thurman 6f033b7928 Status pages are HTML or JSON depending on Accept header. 2020-11-25 18:36:07 +00:00
Marnanel Thurman df7d4c5357 bowler's StatusView gains a _render_object method so get() works 2020-11-22 20:01:42 +00:00
Marnanel Thurman dffc8ff532 FollowingView and FollowersView rewritten as subclasses of CollectionView.
They actually work now. Tests updated. Closes issue 38.

The tests are in test_collections, which has just been renamed from
test_read_from_outbox.
2020-10-31 17:44:39 +00:00
Marnanel Thurman 287a3dc3f1 oops, left diff mark in code 2020-10-29 18:01:56 +00:00
Marnanel Thurman 949cd70f1b Merge branch 'mentions' into issue-47 2020-10-29 17:59:30 +00:00
Marnanel Thurman 96155bf840 StatusActivitySerializer serialises the status object with StatusObjectSerializer
instead of attempting to do it in-house.
2020-10-29 16:44:09 +00:00
Marnanel Thurman 3db8b2a43f Merge branch 'mentions' into issue-47 2020-10-29 04:23:06 +00:00
Marnanel Thurman c61afd585e create() can read the "tag" field of an Actor and create Mention objects as appropriate.
Tests updated and passing.
2020-10-29 04:20:58 +00:00
Marnanel Thurman 930deeb360 Merge branch 'tombstones' into issue-47 2020-10-29 01:54:20 +00:00
Marnanel Thurman 7902a4d1f8 test_tombstone passes 2020-10-29 01:53:12 +00:00
Marnanel Thurman 7248a14e65 rm some obsolete stuff from bowler_pub/__init__.py 2020-10-29 01:05:13 +00:00
Marnanel Thurman c4c175738f Merge branch 'status-serialisers' into issue-47 2020-10-29 01:00:57 +00:00
Marnanel Thurman 5290980643 CreateActivitySerializer renamed to StatusActivitySerializer.
This is because it handles boosts as well as creates.
2020-10-29 00:57:38 +00:00
Marnanel Thurman 088ed35040 CreateActivitySerializer mostly working; to and cc are constants, which they shouldn't be.
Test now passes.
2020-10-29 00:52:34 +00:00
Marnanel Thurman 07d6597611 test_read_announce working; that class renamed Tests per policy 2020-10-29 00:49:28 +00:00
Marnanel Thurman f5b1c4ef0a test_read_from_outbox.Tests.test_read_announce() now written. Not yet passing. 2020-10-28 20:42:41 +00:00
Marnanel Thurman e26e2781d6 test_update() passes 2020-10-28 20:35:55 +00:00
Marnanel Thurman 972377aafa Updated test_update(), though it doesn't pass 2020-10-27 20:40:28 +00:00
Marnanel Thurman fda564d8d2 on_like() added to create.py; test_like() passes 2020-10-27 18:32:35 +00:00
Marnanel Thurman baabe28692 Fixed up test_headers so it passes. Old config variable name updated, and a bunch of standard headers that no longer exist removed. 2020-10-27 15:57:49 +00:00
Marnanel Thurman e8037ce402 on_create() will propagate "actor" in the Create activity to "attributedTo" in the newborn object
if it doesn't already have an "attributedTo".
2020-10-26 22:44:15 +00:00
Marnanel Thurman fb263aa946 test_when_sender_is_followed_by_local_users() gives the new note an id; it now passes 2020-10-26 22:43:27 +00:00
Marnanel Thurman 7def1ea478 Added @skip back to test_when_sender_has_no_relevance_to_local_activity(), for now.
Solving this will require diving into Masto's code.
2020-10-26 22:33:55 +00:00
Marnanel Thurman 4fbad0a949 Removed loads of @skip decorators from tests, as part of issue 47.
Tests now fail quite a lot. :)
2020-10-26 22:29:55 +00:00
Marnanel Thurman e7c36ffb64 create() relies on the Follow object to send the "followed" signal, rather than doing it itself 2020-10-24 23:19:46 +01:00
Marnanel Thurman fe12ccbf22 auto_follow=False on test user to simplify debugging 2020-10-24 23:10:18 +01:00
Marnanel Thurman ba27b594a2 Deserialisation methods were split between sombrero_sendpub.fetch() and bowler_pub.create(). They're now all in create().
Tests updated.

test_announce filled in and made to pass. Closes issue #45.
2020-10-19 16:54:22 +01:00
Marnanel Thurman ee8c5fa285 If your test uses create_remote_person with auto_fetch=True, it gets ValueError if the fetch fails.
This is because the fetch shouldn't fail-- we *just* mocked something at that address. So if it fails, you set up your test case wrongly.
2020-10-19 16:46:36 +01:00
Marnanel Thurman 71f5186d7f corrected "log.warning" to "logger.warning" 2020-10-19 16:20:22 +01:00
Marnanel Thurman bb67a18112 Where an identifier of a remote object is called "url", rename it to "remote_url".
We were calling it "url" in some places and "remote_url" in others.
2020-10-19 16:17:58 +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 265f863746 test to demonstrate that featured collections are broken (see issue #41).
Test object in test_views renamed "Tests" per my own style guide.
2020-10-11 15:07:17 +01:00
Marnanel Thurman c21047f2a9 test fixed to expect the shared inbox to be called /sharedInbox and not /inbox.
It was broken by commit 13ff6ba6.
2020-10-09 03:13:59 +01:00
Marnanel Thurman c9ad177220 Added top-level exception handler to InboxView, since it seems to be experiencing difficulties.
Really this needs to be a more general solution.
2020-09-30 16:20:22 +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 9d8f4613d4 When trilby_api hears about a follow request, and the person being
followed has "auto_follow" turned on, the request is automatically
granted. If the follower is remote, they automatically get sent an
Accept activity. This fixes a regression.

As part of this, bowler_pub.create() now sends the ID of the Follow
activity through the signal.

Also, trilby_api.receivers now uses sensible renames for the
"sender" parameters-- they're really the activities which caused
the signal.
2020-09-28 17:08:15 +01:00
Marnanel Thurman 3a1a5f6db2 Remote users following local users causes the "followed" signal 2020-09-28 16:30:58 +01:00
Marnanel Thurman dbc5e47b4b Messages posted to user inboxes, and to the shared inbox, will be acted upon.
Closes issue #37.
2020-09-21 18:10:34 +01:00
Marnanel Thurman 4982c4daed Two tests in test_create were attempting to resolve "somewhere.example.com"
(and failing, obviously). This should have been mocked but wasn't.
This need some deeper investigation so I've @skip()ped them for now.
(One of the tests was previously @expected_failure.)
2020-09-21 18:09:10 +01:00
Marnanel Thurman 0eb479129f extra debug logging 2020-09-21 18:08:48 +01:00
Marnanel Thurman 9afc7dd220 If you pass a bytestring to validate(), and it doesn't decode cleanly, log this and exit gracefully.
There's still a remaining issue: we always decode the bytestring as UTF-8, but it might not be. Marked with XXX.

Hence also: log.info() the incoming message before attempting to decode the bytestring.

Also: don't bother logging when we've launched the validation task, since that always succeeds.
2020-09-21 17:55:46 +01:00
Marnanel Thurman 0679cb12ae log_one_message allows the "body" parameter to be a bytestring as well as a dict.
This is because incoming messages are no longer parsed straight away (see commit 83b69f2f).
2020-09-21 17:50:19 +01:00
Marnanel Thurman 293191a1f6 The bowler_pub functions which create test messages require extra fields to be supplied as a "fields" parameter.
Previously we allowed callers to specify them as arguments, if the argument name was preceded by "f_".
This caused ambiguities and was too much faff to be useful.

Tests updated accordingly.

Also, one test message copied from the ActivityPub spec was slightly in breach of actual usage conventions. Fixed.
2020-09-21 17:48:51 +01:00