Wykres commitów

801 Commity (remote_update_not_partial)

Autor SHA1 Wiadomość Data
Marnanel Thurman db96b6df4a Remote updates are not partial. In other words, fields which are
not mentioned in a remote update should get deleted.

This is rarely important in practice, but we should support it.

This commit fixes that problem, but breaks the tests. Thus it
lives in a side branch until someone gets around to implementing
it.

The specific breakage is that AcObject has no __delitem__() method.
It probably should have one for completeness, even apart from this
particular issue.

There should be tests specifically for this problem in test_update.
2019-12-01 20:56:05 +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
Marnanel Thurman ac064ac286 trilby_api.views has permission classes as classes and not strings! 2019-10-22 14:27:36 +01:00
Marnanel Thurman 7dfdd1f2cb trilby_api's user serialiser produces the correct results to pass the REST tests.
"instance" in UserSerializerWithSource renamed to "user" because it was confusing.

Removed trilby_api's old integration and unit tests.
2019-10-22 08:13:39 +01:00
Marnanel Thurman 9c4883db19 The nodeinfo view takes chapeau's version number from the right place. 2019-10-22 07:59:17 +01:00
Marnanel Thurman d57ceef2b2 Moved version number etc from chapeau/kepi/__init__.py to chapeau/__init__.py.
Added trove classifiers to setup.py.
2019-10-22 07:56:38 +01:00
Marnanel Thurman 06afce0cb4 trilby_api test for verify_credentials; doesn't yet pass 2019-10-21 00:21:23 +01:00
Marnanel Thurman af961207ca VerifyCredentials is specifically a JSONResponse 2019-10-21 00:21:07 +01:00
Marnanel Thurman 277e2d4986 c.t.tests.create_local_trilbyuser(), which creates an AcActor too 2019-10-21 00:20:11 +01:00