Marnanel Thurman
3d3ce9b0f8
Add docstring to view_for_mimetype
2020-11-23 21:30:51 +00:00
Marnanel Thurman
29e6fffb1a
Apparatus for choosing a Django view based on the incoming MIME type.
...
Not currently connected up.
Partly based on https://gist.github.com/samuraisam/2714195 ,
which is public domain.
Tests updated.
2020-11-23 21:25:03 +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
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
4f5325fb5c
rm broken import
2020-11-14 01:19:25 +00:00
Marnanel Thurman
b3da6e0756
base.html: <html> gets the lang tag, defaulting to "en".
...
HTML output now passes validation.
2020-11-12 19:51:01 +00:00
Marnanel Thurman
228626cc6e
Turn relative links to absolute in base.html.
...
In the same file, "powered by kepi" becomes a link by itself
which fixes the bootstrap formatting there.
navbar.html and base.html links to "/index.html" replaced
by links to "/".
navbar.html gains link to "/login/".
.gitignore ignores kepi/static but not just any dir called static.
This allows us to check in kepi/tophat_ui/static.
Checking in the two existing files in that directory, plus
loads of new bootstrap static files.
Closes issue #50 .
2020-11-12 19:43:08 +00:00
Marnanel Thurman
2513abcf7e
Login page says "login"
2020-11-12 19:17:58 +00:00
Marnanel Thurman
12d2452aaf
login takes you to the root page
2020-11-12 19:16:16 +00:00
Marnanel Thurman
1d9c630f11
move login.html from trilby to tophat, and add our template includes
2020-11-12 17:46:51 +00:00
Marnanel Thurman
0403dbacc9
Rename RootPageView to RootPage. Add django.contrib.auth.views.LoginView to urls.conf.
2020-11-12 17:46:20 +00:00
Marnanel Thurman
6f97a4ee08
Relative paths to absolute
2020-11-12 17:45:29 +00:00
Marnanel Thurman
5e1dc37a99
basic framework for the front page. Still needs the login box etc.
...
Part of issue #50 .
2020-11-09 22:28:05 +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
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
46e55a740a
Added @skip back in to all the remaining NotImplementedError stub tests.
...
I'm doing this because otherwise this branch becomes impossible to
merge with main until it's completely ready.
2020-10-30 23:05:25 +00:00
Marnanel Thurman
8e3f23ac92
Not implementing /peers or /activity instance methods any time soon tbh
2020-10-30 22:53:46 +00:00
Marnanel Thurman
622fc69df9
test_account: added @skips back in again for block/muting because those aren't yet written; deleted some test stubs of obscure purpose.
2020-10-29 23:19:37 +00:00
Marnanel Thurman
4903af61fc
Drop sombrero's test_send. The idea is flawed and nothing in it works anyway.
2020-10-29 23:08:18 +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
731cb3e21e
trilby doesn't need to return mentions, at least not for now
2020-10-29 17:58:50 +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
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
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
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
f1822f668e
test_search: @skips removed; class renamed to Tests per policy
2020-10-29 03:18:32 +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
d044415053
add "gone" field to LocalPerson
2020-10-29 01:53:01 +00:00
Marnanel Thurman
63aba5e743
rm "deleted" signal
2020-10-29 01:52:28 +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
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
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
65593a41e1
fix a test in test_send
2020-10-27 19:07:45 +00:00
Marnanel Thurman
fda564d8d2
on_like() added to create.py; test_like() passes
2020-10-27 18:32:35 +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
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
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
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
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
fe12ccbf22
auto_follow=False on test user to simplify debugging
2020-10-24 23:10:18 +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
a1e2f92f17
version bump for dillian
2020-10-23 21:56:19 +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
b6d5039f6c
rename url to remote_url per policy
2020-10-19 16:52:43 +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
f480aa71d0
Trilby tests: rename url to remote_url, per policy.
...
Also add @httpretty.activate where needed.
2020-10-19 16:49:27 +01:00
Marnanel Thurman
5d6c209fde
Collection ends iteration gracefully if a page can't be found.
...
Also renamed __init__'s url param to remote_url, per policy.
2020-10-19 16:48:39 +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
4eabf2dd1a
sombrero gains "Failure" model to record HTTP failures
2020-10-19 16:22:14 +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
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
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
90e815f888
Version bump to 0.4.5 "archer"; various bits of package metadata changed
2020-10-10 02:54:36 +01:00
Marnanel Thurman
df35f1c389
Sombrero notifies remote users when a local status is posted.
...
Closes issue #42 .
2020-10-10 02:17:05 +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
e4556225da
Regression test for issue #42 . Currently fails because that bug is open.
2020-10-10 01:57:17 +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
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
13ff6ba639
SHARED_INBOX_LINK set to '/sharedInbox' because that's what urls.py is expecting
2020-09-30 16:26:21 +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
ceed10b278
DEBUG=False by default!
2020-09-30 16:14:48 +01:00
Marnanel Thurman
b5a7f7114d
Attempts to fetch(None) get None.
...
It sometimes happens in the wild that someone submits "inReplyTo: null" or similar.
2020-09-30 16:13:02 +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
Marnanel Thurman
83b69f2fcb
ActivityParser doesn't parse the JSON of incoming messages.
...
This is because when we validate the message, a little further
down the line, we need access to the exact content of the message.
Parsing it here would destroy the exact content, because Django
doesn't let you read request bodies twice.
2020-09-21 17:43:57 +01:00
Marnanel Thurman
f95163dc04
Drop incoming messages with no type
2020-09-21 17:43:32 +01:00
Marnanel Thurman
2043ca8eaf
When we create a Status from a Create message, catch exceptions and treat as failure.
2020-09-21 17:08:20 +01:00
Marnanel Thurman
482f3132e0
rm unused field "is_local_user" in IncomingMessage
2020-09-20 23:53:54 +01:00
Marnanel Thurman
c4c5555c8b
Modernised the "send to inbox" tests which were taken from bowler_heavy.
...
Previously they were all marked @skip. They are no longer skipped, but they don't pass.
Clearly there's work to be done there. More work will probably also be needed in modernising the tests.
2020-09-19 20:32:27 +01:00
Marnanel Thurman
82d8c55701
Added a django-rest-framework parser so we accept uploads of type
...
"application/activity+json".
2020-09-19 20:29:12 +01:00