Wykres commitów

1158 Commity (e8037ce4024292dfe9f8c74f7589e5b982712ee4)

Autor SHA1 Wiadomość Data
Marnanel Thurman 12db4732cb AcActor handles display_name correctly for local users (regression fixed) 2019-12-19 18:49:51 +00:00
Marnanel Thurman 37054416d9 trilby's Notification gains attribute about_account_actor 2019-12-19 18:44:34 +00:00
Marnanel Thurman 985a23ce5c AcObject gains attributes: acct, hostname, preferredUsername, and display_name 2019-12-19 18:43:41 +00:00
Marnanel Thurman 5694851bcd In trilby_api.models
====================

Notification uses constants within the class
to represent notification types, as the docs recommend, rather than
using enum.Enum.

Notification.about_account is added. The existing "account" field
is renamed for_account for clarity.

Notification also gains a __str__() method.

on_follow modified to work properly with these changes.

Several migrations added. Note that trilby's 0006 migration is
deleted but there's a new 0006; you might have to wind back to
0005 to allow this migration to work. There are dependency
reasons for doing it like this.

In trilby_api.serializers
=========================

NotificationSerializer modified to return about_account.
It also gets immediately monkey-patched to return
notification_type as "type". Rather messy hack,
but StackExchange says this is the way to do it.

In trilby_api.views
===================

Notifications requires authentication(!) and returns
only the authenticated user's notifications.

In tests
========

test_notifications's test_follow fixed. It didn't work
before, despite the claim in commit 37095e; that was wrong
because the results weren't actually being checked.
2019-12-18 18:06:51 +00:00
Marnanel Thurman 0f2192edad bowler_pub.tests.create_remote_person() has a default publicKey field 2019-12-18 17:58:28 +00:00
Marnanel Thurman 37095e6f1d trilby integration with signals so on_follow notifications work.
Test for this passes; moving it to new test_notifications.py.
2019-12-18 16:30:56 +00:00
Marnanel Thurman 3f53925712 trilby_api.models.Notification added.
Serializer and test stub included.

Nothing actually creates Notifications yet, though.
2019-12-07 02:03:38 +00:00
Marnanel Thurman bf5a8bde07 "deleted" signal is sent when a Delete activity is successful.
Tests included.

Also, "alice" in test_signals has been renamed "arthur",
since all the test messages were from HHGTTG anyway.
2019-12-07 01:30:48 +00:00
Marnanel Thurman 81fb007eb0 Added test for the new "updated" signal.
Added test for the "Update" side_effect.
2019-12-01 20:53:44 +00:00
Marnanel Thurman aa7d5c9a68 create() can pass the send_signal flag through to the side_effect routines.
Because of this, the side_effect routines take **kwargs,
as does run_side_effects() in AcObject.

The side_effect routine for Update can update cached data for remote objects.
It doesn't attempt to modify the "id" or "type" fields on any object.

AcObject gains an items() method, by analogy with dicts etc.
It's just syntactic sugar around activity_form.
2019-12-01 20:52:01 +00:00
Marnanel Thurman 9bf422d834 bowler_pub can send "created" signal on creation.
"deleted" and "updated" signals defined but not yet used.

Tests added.
2019-11-28 19:00:09 +00:00
Marnanel Thurman 07647a39eb Version bump to 0.4.1 2019-11-20 19:11:21 +00:00
Marnanel Thurman 781750bdf0 Renamed entire project from "chapeau" to "kepi".
This is because of a name clash in PyPI.
2019-11-20 19:10:10 +00:00
Marnanel Thurman 00fa10b41c "kepi" module, which implements ActivityPub, renamed to "bowler_pub".
This is to prepare for the rename of the entire project to "kepi".
2019-11-20 19:05:40 +00:00
Marnanel Thurman 999ccf787e Version bump to 0.4.0 2019-11-20 18:42:17 +00:00
Marnanel Thurman 8c7e80afd6 AcActor.activity_form() no longer blanks the summary (bio) field.
Test included.

Also, rm an obsolete comment.
2019-11-17 18:10:29 +00:00
Marnanel Thurman ded1a1c45d AcActor.activity_form() includes "publicKey".
This was introduced in commit 047aec. AcActor's activity_form() expects to get
a field named "publicKey" from its parent method, and to rearrange that.
But renaming f_publicKey to publicKey meant that the parent method
assumed it wasn't public, and didn't put it into its result.

Test included.

Closes issue #35.
2019-11-17 18:00:18 +00:00
Marnanel Thurman d1d5a87719 If we receive a duplicate follow request, warn but don't raise an exception. 2019-11-16 18:13:30 +00:00
Marnanel Thurman d3e5e02e1b When a user has auto_follow, and we receive a Follow request,
we generate an Accept. This Accept was create()d with side_effects=False,
which prevented the Following from being created. Now fixed.
2019-11-16 18:09:00 +00:00
Marnanel Thurman 047aecf8f1 AcActor's f_publicKey renamed to publicKey.
"f_publicKey" would mean it can be set automatically. Because it's
typically a JSON object, it can't be represented with a simple type,
so it can't be set automatically; it must be represented in ThingField.

This didn't make a practical difference before, but since commit 6ce087
create() has honoured the "f_*" convention.
2019-11-16 17:39:54 +00:00
Marnanel Thurman c82a6def70 AcItem gains a "serial" field for the serial number (at the end of
the URL path, after the username). It gets set automatically.
2019-11-16 17:37:35 +00:00
Marnanel Thurman 6ce087579f create() fills in as many fields as it can when it creates an AcObject,
then sets the others by subscripting.

"As many fields as it can" means
  - the id field
  - any field whose name begins with "f_".

Previously, create() filled in as few fields as it could
(typically only the id, if supplied), then set the others by subscripting.

This change increases efficiency, but also allows the save() method
of AcObject and its subclasses to take account of the intial values of
the f_* fields.
2019-11-16 17:33:38 +00:00
Marnanel Thurman 622f147969 Many lookup properties moved out of TrilbyUser to AcActor.
Corresponding AcActor getitems removed.

Trilby's UserSerializer (and its descendants) serialize AcActor,
not TrilbyUser. Suddenly everything becomes simpler.

Tests updated.
2019-11-15 00:16:30 +00:00
Marnanel Thurman adaef590e3 AcItem gains an "actor" property, which returns the AcActor for f_attributedTo 2019-11-14 23:43:33 +00:00
Marnanel Thurman 6b14baafa2 trilby_api's HomeTimeline view now works. Tests added.
test_integration's main test renamed to TestIntegration.
2019-11-10 00:57:33 +00:00
Marnanel Thurman b1162df8bb Collection.members returns the actual objects in the collection, not the CollectionMember objects referring to them 2019-11-10 00:56:52 +00:00
Marnanel Thurman 2a43cfce48 The restriction on actors not being told about their own activities
is now only applied to incoming activities, as the spec requires.

For local activities, the actor is *always* told about their own activities.

Tests updated.
2019-11-10 00:56:39 +00:00
Marnanel Thurman 331a265fe4 Mastodon's emoji url is "custom_emojis", not "emojis" 2019-11-08 14:46:43 +00:00
Marnanel Thurman 44a6457639 remove use of CurrentUserDefault() which doesn't work the way I thought 2019-11-08 14:39:13 +00:00
Marnanel Thurman 7c73d926d3 Pass context containing request into StatusSerializer creation 2019-11-08 14:38:46 +00:00
Marnanel Thurman 822eed7459 rm lots of ActivityPub stuff from trilby_api which was moved to kepi ages ago 2019-11-04 20:18:43 +00:00
Marnanel Thurman c03eaad7a1 Test for e3ec25 which should have been committed along with it 2019-11-04 20:16:29 +00:00
Marnanel Thurman e3ec25a823 nodeinfo identifies as chapeau rather than kepi 2019-11-04 20:05:36 +00:00
Marnanel Thurman 1348efe8b0 If trilby is asked to create a status, it goes through kepi.create.create().
Also, we can return the list of custom emojis (though it's always empty).
2019-11-02 21:32:48 +00:00
Marnanel Thurman 039b6d3da2 The first parameter of create() is now "value",
on the principle of least astonishment.
2019-11-02 21:15:20 +00:00
Marnanel Thurman 9d470408ec default avatar is one of the ten standard ones 2019-11-02 18:42:18 +00:00
Marnanel Thurman 6a585c39aa URL path for statuses 2019-11-02 18:41:57 +00:00
Marnanel Thurman 282cefba97 Use generic APIViews, not mixins, for status view 2019-11-02 18:41:25 +00:00
Marnanel Thurman 420035875f Spoiler text can be blank 2019-11-02 18:40:45 +00:00
Marnanel Thurman 2516fd8ed4 trilby: /api/v1/accounts/<name> 2019-10-28 14:34:35 +00:00
Marnanel Thurman 19b7d69748 trilby's avatar and header fields are passed through to kepi. 2019-10-28 14:21:16 +00:00
Marnanel Thurman f65870e8e3 Trilby can create statuses. 2019-10-27 18:09:33 +00:00
Marnanel Thurman b3ef1ed7f9 Status contexts for trilby. With tests. 2019-10-27 16:05:22 +00:00
Marnanel Thurman f2fe4b321c StatusSerializer has the correct fields as required by the Mastodon spec.
views.Statuses works with this, for a single status. (Retrieving multiple statuses still needs adding.)

trilby's url.py gains /api/v1/statuses/<id>.

And tests for the above.
2019-10-25 20:15:44 +01:00
Marnanel Thurman 95ac07da74 chapeau.trilby_api.test gains create_local_status() in the manner of kepi's test utils 2019-10-25 20:14:59 +01:00
Marnanel Thurman 0793bd1562 AcItem gains several new properties for Mastodon compatibility, most notably "html".
The mentions property returns a list, rather than a set, so we don't have to cast it for the JSON encoder.
2019-10-25 20:12:28 +01:00
Marnanel Thurman f05bc890d4 Audience.get_audience_for gains an "audience_type" param.
AcObject uses this to return audience information rather than trying to look it up itself
(which was breaking).
2019-10-25 20:11:24 +01:00
Marnanel Thurman f2efc2c99c Changes to settings.py to match previous checkin. 2019-10-24 01:52:39 +01:00
Marnanel Thurman 09ceec74e2 New function chapeau.kepi.utils.configured_url(), to return a URL based
on a template defined in settings. Also, code which needs it refactored to use it.

Similarly, a function chapeau.kepi.utils.configured_path().

is_short_id() and short_id_to_url() moved into chapeau.kepi.utils
from chapeau.kepi.find.

Fieldnames changed to USER_LINK instead of USER_URL_FORMAT etc.

Relevant modifications to tests.
2019-10-24 01:47:42 +01:00
Marnanel Thurman 6ad4f7be6b avatar and header are produced in the Verify_Credentials view.
Tests added for this.
2019-10-22 15:49:47 +01:00