Commit graph

1556 commits

Author SHA1 Message Date
Mouse Reeve b3a519c082 Converts report "comments" into broader "actions" table
This table will now track all actions taken on a report, like resolving
it, re-opening it, suspending the reported user, et cetera, in addition
to comments. When there are multiple admins, this change will make it
easier to understand what actions have been taken by whom on a report.
2023-05-16 11:00:33 -07:00
Mouse Reeve 912e92bacd Show all (not just open) reports when linked from user admin 2023-05-07 09:50:24 -07:00
Hugh Rundle 5c9b962639 retain additional authors on form failure when editing book 2023-04-29 09:42:57 +10:00
Mouse Reeve 7bd9623b68
Revert "Increase Celery ping timeout for monitoring page" 2023-04-25 18:24:23 -07:00
Zach Flanders a3013c6224 updating list view 2023-04-25 00:20:54 -05:00
Zach Flanders 21d9cb5fe5 updating shelf view 2023-04-25 00:15:58 -05:00
Jascha Urbach 0cae89b2b6
Update wellknown.py
./bw-dev black
2023-04-16 17:30:27 +02:00
Jascha Urbach f3b1b1d8e4
Fix language constant to show correct lang in API
api/v1/instance had "en" hardcoded as language. This fix takes LANGUAGE_CODE from settings.py/.env and takes the first two letters as response.
2023-04-16 17:28:05 +02:00
Hugh Rundle 5f5886edea Actually fix ensure_transient_values_persist call
oops
2023-04-16 19:58:53 +10:00
Hugh Rundle 6f025af99f fix ensure_transient_values_persist call 2023-04-16 19:06:04 +10:00
Hugh Rundle 74f08323d1
Merge branch 'main' into 2571 2023-04-16 18:11:39 +10:00
Hugh Rundle fb3cb229e9 Fixes #2571
Persist book.subjects and add_author when form validation fails.

This does not resolve the problem of cover image uploads being dropped because this is a broader problem and is covered separately in #2760
(we should investigate the plugin ` django-file-resubmit`)
2023-04-16 17:58:03 +10:00
Mouse Reeve 290b740392
Merge pull request #2805 from WesleyAC/stop-ignoring-task-results
Stop ignoring task results
2023-04-15 09:03:43 -07:00
Hugh Rundle a0b7112c9c
Merge branch 'main' into gts 2023-04-14 18:24:02 +10:00
Hugh Rundle 56a062d01f pylint fixes 2023-04-13 20:21:35 +10:00
Hugh Rundle a6676718cb formatting 2023-04-13 13:27:51 +10:00
Wesley Aptekar-Cassels 8e25ae34d6
Merge pull request #2782 from ranok/list_fix
Small quality of life improvements to list handling
2023-04-11 12:31:58 -04:00
Hugh Rundle 03f21b0f35 Use correct keyId with legacy fallback
Bookwyrm keyIds are at `userpath/#main-key`, however when signing AP objects we have claimed in the headers that the keyId is at `userpath#main-key`.
This is incorrect, and makes GoToSocial's strict checking break.
Simply updating the signatures to use the correct KeyId breaks legacy Bookwyrm's signature checks, becuase it assumes that the keyId path is the same as the user path plus a fragment.
This commit allows for either option, by sending the request a second time with the incorrect keyId if sending with the correct one causes an error.
2023-04-11 15:45:06 +10:00
Hugh Rundle 49758f2383 formatting fixes 2023-04-10 17:50:25 +10:00
Hugh Rundle 632e3844b9 Don't assume user id is key id minus fragment
Fixes #2801
Related to #2794

It is legitimate to use any url for the user's key id. We have been assuming this id is the user id plus a fragment (#key-id) but this is not always the case, notably in the case of GoToSocial it is at /key-id. This commit instead checks the remote user's information to see if the key id listed matches the key id of the message allegedly received from them.

Whilst troubleshooting this it also became apparent that there is a mismatch between Bookwyrm users' keyId and the KeyId we claim to be using in signed requests (there is a forward slash missing). Since everything after the slash is a fragment, this usually slips through but we should be consistent so I updated that.
2023-04-10 17:32:49 +10:00
Wesley Aptekar-Cassels 1048638e30 Stop ignoring task results
This is essentially a revert of 9cbff312a. The commit was at the advice
of the Celery docs for optimization, but I've since decided that the
downsides in terms of making things harder to debug (it makes Flower
nearly useless, for instance) are bigger than the upsides in performance
gain (which seem extremely small in practice, given how long our tasks
take, and the number of tasks we have).
2023-04-07 21:51:44 -04:00
Mouse Reeve d033848d3f
Merge pull request #2780 from jsoref/spelling
Spelling
2023-04-07 06:30:16 -07:00
Mouse Reeve 5895524a25
Merge pull request #2787 from WesleyAC/celery-clear-queues-form
Add form to remove tasks from Celery
2023-04-07 06:17:50 -07:00
Wesley Aptekar-Cassels 3709f5c7a9 Increase Celery ping timeout for monitoring page
This should prevent some transient alerts.
2023-04-07 03:18:43 -04:00
Wesley Aptekar-Cassels 6986fc9025 Add form to remove tasks from Celery 2023-04-07 03:16:14 -04:00
Jacob Torrey 011844b7ac Small quality of life improvements to list handling
Signed-off-by: Jacob Torrey <jacob@jacobtorrey.com>
2023-04-05 16:17:28 +00:00
Josh Soref ba7f0fce71 spelling: whenever
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 2d4a42ceba spelling: suggestions
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref 2fb771f0de spelling: sanitize
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref b949259c57 spelling: embedded
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref cfe388896b spelling: dashboard
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref be31a4b576 spelling: creating
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Josh Soref fb74c1977e spelling: because
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-04 20:02:54 -04:00
Jascha Ezra Urbach d35b1d91ba
Merge pull request #2766 from bookwyrm-social/redirect-in-admin
Uses referer redirect for some admin views
2023-04-01 11:06:42 +02:00
Mouse Reeve b76da26c98 Fixes iteration over mentions dict 2023-03-29 10:13:44 -07:00
Mouse Reeve fe856bcf2c Updates regex on mentions and hashtags 2023-03-29 09:20:58 -07:00
Mouse Reeve 8a0e88db83 Adds test for links with # symbols 2023-03-29 08:39:41 -07:00
Mouse Reeve 42dd199084 Unit test that identifies clashes between links and mentions 2023-03-29 08:28:45 -07:00
Mouse Reeve 30a3096b25
Merge pull request #2749 from bookwyrm-social/redirects
Add helper to refer views back to http referers safely
2023-03-27 06:20:26 -07:00
Mouse Reeve 05e154f93e Uses referer redirect for some admin views 2023-03-20 13:58:20 -07:00
Mouse Reeve 219f78755f Fixes args in list view redirect 2023-03-20 11:15:27 -07:00
Mouse Reeve 4e9fad2091 Updates views that currently use the validator to use the redirect
helper
2023-03-20 10:27:52 -07:00
Mouse Reeve 2de115fc1e Add helper to refer views back to http referers safely
In most cases, we want to return back to where we came from after
performing an action. It's not safe to return to an arbitrary referer,
so this streamlines using the util validator to verify the redirect and
fall back on regular redirect params if the referer is outside our
domain.
2023-03-20 10:25:38 -07:00
Wesley Aptekar-Cassels 60fee54da9 Optimize CSV export query
Splitting this into five separate queries avoids the large join that
prevents us from using indexes, and requires materializing to disk.

Fixes: #2157 (hopefully)
2023-03-13 15:45:21 -04:00
Wesley Aptekar-Cassels 0b9e4d617e Use context processor for 500 page
By default, Django doesn't run any context processors for server errors,
to make the error path as simple as possible. However, this has the
downside that our template does not load correctly. To fix this, I added
a custom 500 error handler, which will run the context processor.

Fixes: #2736
2023-03-13 03:47:23 -04:00
Mouse Reeve 12af5992a3
Merge pull request #2524 from chdorner/feature/tag-support
Initial hashtag support
2023-03-12 16:37:39 -07:00
Mouse Reeve 6345beb90d
Merge pull request #2714 from WesleyAC/celery-ignore-results
Ignore Celery task results
2023-03-12 16:26:20 -07:00
Mouse Reeve 84b8a5c433
Merge pull request #2713 from WesleyAC/buffer-csv-export
Change CSV export to buffer instead of streaming
2023-03-12 16:17:53 -07:00
Wesley Aptekar-Cassels 50a81bdfdd Change CSV export to buffer instead of streaming
The idea behind a streaming CSV export was to reduce the amount of
memory used, by avoiding building the entire CSV file in memory before
sending it to the client. However, it didn't work out this way in
practice: the query objects that were created to represent each line
caused Postgres to generate a very large (~200MB on bookwyrm.social)
temp file, not to mention the memory being used by the Query object
likely being similar to, if not larger than that used by the finalized
CSV row.

While we should in the long term run our CSV exports as a Celery task,
this change should allow CSV exports to work on large servers without
causing disk-space problems.

Fixes: #2157
2023-03-08 21:37:56 -05:00
Wesley Aptekar-Cassels 4af4f30cde Broaden except section for HTTP request in dashboard
get_data can return exceptions other than ConnectorException, and when
it does, we want to simply not show the update section, rather than
crashing.

Related: #2717
2023-03-08 21:32:41 -05:00
Wesley Aptekar-Cassels 9cbff312a5 Ignore Celery task results
Since we don't use the results of our Celery tasks (all of them return
None implicitly), it's prudent to set the ignore_result flag, for a
potential performance improvement. See the Celery docs for details [1].

We could do this with the global CELERY_IGNORE_RESULT setting, but it
offers more flexibility if we want to use task results in the future to
set it on a per-task basis.

[1]: https://docs.celeryq.dev/en/stable/userguide/tasks.html#ignore-results-you-don-t-want
2023-03-08 02:12:13 -05:00
Christof Dorner 9ca9883e0b Enable finding existing hashtags case-insensitive
We should store hashtags case-sensitive, but ensures that an existing
hashtag with different case are found and re-used. for example,
an existing #BookWyrm hashtag will be found and used even if the
status content is using #bookwyrm.
2023-03-07 13:16:45 +01:00
Christof Dorner f3334b1550 Render hashtag links with data-mention="hashtag" attribute 2023-03-07 13:16:45 +01:00
Christof Dorner 499aace9fb Add basic view listing activities from a given hashtag 2023-03-07 12:59:32 +01:00
Christof Dorner ba0fcccfc5 Link hashtags in status content 2023-03-07 12:55:36 +01:00
Christof Dorner c68304a99b Parse hashtags and store them in CreateStatus view 2023-03-07 12:55:36 +01:00
Mouse Reeve c402433587
Merge pull request #2683 from bookwyrm-social/resolve-local-tasks-synchronously
Attempt to complete inbox requests synchronously
2023-03-06 19:20:16 -08:00
Mouse Reeve b167364c5c Use a separate queue for broadcasts
I think this will go a long way to solve the federation delay problems
we're seeing on b.s. I'm not sure at what point adding more queues will
create more problems than it solves, but I do think in this case the
queues are out of balance and moving broadcasts (which are the most
common type of `medium_priority` task at the moment) to their own queue
will be an improvement.
2023-02-20 12:58:41 -08:00
Mouse Reeve 779d2b0694 Attempt to complete inbox requests synchronously
When an inbox activity comes in from another fediverse instance, the
behavior prior to this commit was always to immediately give a 200
response to the external server and then create a celery activity
(usually in the MEDIUM_PRIORITY queue) to complete it.

Instead, this would receive a request and try to complete it without
making any http requests (which would make the request take too long to
process). If an external request is required to complete the activity, a
task is created and added to the queue.

Ideally, this will cause some tasks to happen very promptly, and reduce
the load on celery, which would help queued tasks happen more quickly as
well.

One downside is that this will make completing http requests from
external servers slowing (since it's doing a bunch of thinking before
responding).
2023-02-20 11:05:18 -08:00
Mouse Reeve 2c2daf5fdf
Merge pull request #2644 from rrgeorge/rrgeorge/csp
Add Content-Security-Policy headers and secure cookies
2023-02-10 16:37:39 -08:00
Dustin Steiner d1f85e4317 fix: books can have non-decimal series numbers 2023-02-07 12:05:20 +00:00
Dustin b20b52af7f
Merge branch 'main' into book-series-v1 2023-02-07 11:57:39 +00:00
Robert George b82231202c lint 2023-02-03 12:03:52 -08:00
Robert George afe651cd6d Added img-src * csp exception to search 2023-02-03 11:53:41 -08:00
Christof Dorner f9a916db09
Merge pull request #2639 from bookwyrm-social/celery-ping
Celery ping
2023-02-03 09:40:25 +01:00
Mouse Reeve fd59fea94e
Update bookwyrm/views/admin/celery_status.py
Co-authored-by: Christof Dorner <christof@chdorner.com>
2023-02-02 16:46:36 -08:00
Robert George 6b97702cc4 Fix long line 2023-02-01 13:19:57 -08:00
Robert George 36605efd20 Added support for secure cookies and django-csp 2023-02-01 12:59:10 -08:00
Dustin Steiner 90f996ac90
chore: multi line comment for linter 2023-01-31 10:16:44 +00:00
Dustin Steiner c2a81d88bb
Merge branch 'main' into book-series-v1 2023-01-31 10:06:07 +00:00
Mouse Reeve 006ff697b9
Merge pull request #2636 from 0x29a/redundant-db-queries
Remove redundant DB queries
2023-01-30 09:03:18 -08:00
Mouse Reeve c1090703e2 Adds a ping-able celery url
This will let admins set up a check to notify you if celery is not
running.
2023-01-30 08:27:40 -08:00
Dustin Steiner e0505722e1
chore: formatting 2023-01-30 14:45:30 +00:00
0x29a 3c52426a1c Optimize get_suggested_books 2023-01-30 06:45:44 +01:00
Dustin Steiner 0628ccad41
chore: sort editions with series number before edition rank 2023-01-29 11:43:56 +00:00
Dustin c0e541c7ed
Merge branch 'main' into admin-manually-activate-user 2023-01-29 11:21:31 +00:00
Dustin 23e04c2e62
Merge branch 'main' into book-series-v1 2023-01-29 09:36:52 +00:00
Dustin Steiner 4b64b70753
fix: sort series by float 2023-01-29 09:35:02 +00:00
Dustin Steiner f2902e8de5
fix: sort series number as int 2023-01-28 08:38:57 +00:00
Dustin Steiner 952dd0dcdf
style: fix unused parameter linter error 2023-01-28 08:31:41 +00:00
0x29a cbd75dc766 Minor performance improvements 2023-01-27 20:24:53 +01:00
Dustin Steiner 54aea0654a
style: run linter 2023-01-27 15:47:22 +00:00
Dustin Steiner 07f4300176
feat: button in admin view to manually activate pending user 2023-01-27 15:43:34 +00:00
Dustin Steiner ba2ff7e7a5
Merge branch 'main' into book-series-v1 2023-01-26 16:40:32 +00:00
Dustin Steiner 5cc158e3be
Merge branch 'main' into book-series-v1 2023-01-26 16:36:19 +00:00
Mouse Reeve ef48149844 Show import queue in Celery admin 2023-01-26 07:52:37 -08:00
Mouse Reeve e55e4429b1
Merge pull request #2604 from rrgeorge/redis-sockets
Add support to connecting to redis via unix socket
2023-01-26 06:39:15 -08:00
Mouse Reeve 4b6678903f
Merge pull request #2617 from bookwyrm-social/follow-priority
Make follow activities a high priority
2023-01-26 06:03:57 -08:00
Dustin 1d909ee8e1
Merge branch 'main' into book-series-v1 2023-01-26 06:50:22 +00:00
Dustin Steiner eb4672ff18
style: format 2023-01-26 06:49:55 +00:00
Mouse Reeve b89cab1ee5 Fixes args passed to inbox activity task 2023-01-25 07:39:43 -08:00
Mouse Reeve 858bf70d62 Make follow activities a high priority
This should go a long way towards fixing the problems with follows not
going through to remote servers. All it does is move relationship
related activities from the medium priority queue, which gets
backlogged easily, to the high priority queue, which is less backlogged.

The risk here is that the high priority queue could end up getting
backlogged, so this isn't the last word on fixing this, but I think the
volume of activities that this will add to it will be manageable.
2023-01-24 08:46:29 -08:00
Dustin aad934fa59
Merge branch 'main' into book-series-v1 2023-01-24 13:14:28 +00:00
Dustin Steiner cd13e6f523
style: run linter 2023-01-24 13:14:06 +00:00
Dustin Steiner 35d30a41f3
feat: first version of a book series list by author 2023-01-24 13:00:18 +00:00
Giebisch 3d99908d27 Fixed Object Selection for RSS Feeds 2023-01-23 15:17:20 +01:00
Giebisch 5d61003ce7 Merge branch 'main' into rss-feed 2023-01-20 23:29:33 +01:00
Mouse Reeve 0594152f47
Merge pull request #2511 from Giebisch/import-limit
Added Import Limit
2023-01-19 11:16:58 -08:00
Giebisch 18c786f63f Added RSS API 2023-01-17 21:59:05 +01:00
Alexander Ward 1f50a2dbfc
Email Config Has a Typo
There's an errant capital "E" preventing the SMTP user from appearing on the settings page.
2023-01-16 15:47:24 -08:00
Giebisch d0adb370cd Merge branch 'main' into import-limit 2023-01-16 02:05:18 +01:00
Mouse Reeve 10322cdff3
Merge pull request #2572 from chdorner/fix/create-edit-book-cover-url
Ensure transient `cover_url` field value gets persisted across form renders
2023-01-14 18:08:22 -08:00
Robert George 207abed654 Add support for specifying redis url to support unix sockets 2023-01-14 14:52:54 -08:00
Mouse Reeve 5c8145b79d
Merge pull request #2586 from asmaloney/fix-duplicate-suggestions
{list} Fix duplicate suggestions in Add Books section
2023-01-11 08:40:32 -08:00
Giebisch b22d060d93 Merge branch 'main' into import-limit 2023-01-11 16:22:08 +01:00
Andy Maloney e5539a6faf Fix spelling in various comments 2023-01-10 17:24:02 -05:00
Andy Maloney dd23bc4d0f {list} Fix duplicate suggestions in Add Books section
Fixes #2584

(Also fix a spelling mistake in a comment in book_search.py)
2023-01-10 11:08:11 -05:00
Giebisch 5200ea585a Import Limit Bugfix and lint 2023-01-05 23:37:43 +01:00
Christof Dorner 1c6548a0ad Ensure transient cover_url field value gets persisted across form renders
Given this field doesn't map to an `Edition` model field it lost its values when re-rendering the form.
It worked only when the form was valid and rendered as part of the confirmation screen, which is due to
the context data value being set in `add_authors` which was only getting called after the form validation.

I've opted to pull it out into a separate new function that gets called before form validation.
2023-01-04 18:02:04 +01:00
Joachim bc19d7c658 Black 2023-01-01 19:45:12 +01:00
Joachim f266c71da9 Replace hidden field with HTTP Referrer value 2023-01-01 19:42:03 +01:00
Joachim 78c214a6d4 Add validation before using url 2022-12-30 17:56:25 +01:00
Joachim f5a79dfa82 Redirect to "next" value in view 2022-12-23 21:35:28 +01:00
Mouse Reeve d4351cfcb4
Merge branch 'main' into import-limit 2022-12-16 12:44:57 -08:00
Giebisch df54df8309 Added Import Limit 2022-12-15 23:43:25 +01:00
Mouse Reeve 89478ac87e
Merge pull request #2491 from chdorner/register-tz-support
Detect preferred timezone via JavaScript on register
2022-12-11 14:49:29 -08:00
Christof Dorner 13b262bb7b Detect preferred timezone via JavaScript on register 2022-12-11 23:32:07 +01:00
Mouse Reeve 3a9a344089
Merge pull request #2478 from bookwyrm-social/admin-roles
Adds "owner" role
2022-12-11 13:05:39 -08:00
Mouse Reeve 3e62cbe8b6 Fixes incorrect import from merge 2022-12-11 12:39:33 -08:00
Mouse Reeve a9846e7805
Merge pull request #2498 from bookwyrm-social/use-reactivate
Use user.reactivate when a user confirms their email address
2022-12-11 12:10:21 -08:00
Mouse Reeve 58e8c0b5ec Merge branch 'main' into admin-roles 2022-12-11 11:58:54 -08:00
Mouse Reeve 734fb5ad34
Merge pull request #2489 from chdorner/user-reviews-comments-tab
Add new user tab listing only reviews and comments
2022-12-11 11:53:31 -08:00
Mouse Reeve 50a42dc0a2 Use user.reactivate when a user confirms their email address
This is cleaner and easier to maintain.
2022-12-11 11:44:04 -08:00
Mouse Reeve c314c9b5e3
Adds email config admin view (#2494)
This view lets you see your email configuration and send a test email.
2022-12-11 11:37:09 -08:00
Jascha Urbach ac8b060d58
Isfdb ID for books and authors (#2482)
* New ID: Audible ASIN

Audible belongs to Amazon BUT they do not share the same IDs. The Audible ASIN of an audiobook is never the same as the Amazon ASIN.

Yeah, I know, Amazon is great. The fact that the ASIN is a good distinction for different works and editions bothers me more than I will ever be willing to admint.

* New ID "ISFDB"

Internet Speculative Ficiton Database ID for books and authors.
Links to the entry if set.

* Added aasin to test

Added aasin to test

* the answer expects more emptxy fields...
2022-12-11 11:33:33 -08:00
Christof Dorner fbd8e22b97 Add new user tab listing only reviews and comments 2022-12-11 20:24:00 +01:00
Mouse Reeve 845bd2cc0d Only show themes to sys admin 2022-12-05 17:11:15 -08:00
Mouse Reeve 933cb6440f Creates admin views for owner and admin registration settings 2022-12-05 16:58:11 -08:00
Mouse Reeve 5172f67c35
Merge pull request #2450 from bookwyrm-social/impressum
Adds database fields for legal page/impressum
2022-12-04 12:12:26 -08:00
Mouse Reeve df42712b8e
Merge pull request #2449 from bookwyrm-social/empty-csv
Don't start imports with empty CSVs
2022-11-25 12:31:13 -08:00
Mouse Reeve 70d639440e Show impressum 2022-11-25 12:06:32 -08:00
Mouse Reeve 015af2c1e7 Don't start imports with empty csvs
Fixes #2353
2022-11-25 10:35:16 -08:00
Mouse Reeve 81ab08aaa3 Fixes editing links 2022-11-25 08:28:45 -08:00
Joel Bradshaw 55bab0b70d Slice queryset before we resolve it
This was accidentally querying ALL books in the database to generate
suggestions if we didn't have enough, which broke some stuff
2022-11-23 19:26:09 +00:00
Mouse Reeve 1e5a6ec744
Merge branch 'main' into show-2fa-code 2022-11-19 10:09:27 -08:00
Mouse Reeve 9c5fe7610b Fixes reference to site model 2022-11-17 15:41:30 -08:00
Mouse Reeve 28567e2d8e Disable imports in the UI and view 2022-11-17 15:19:42 -08:00
Mouse Reeve 7c7c0e1a93 Admin UI to enable and disable importing 2022-11-17 14:23:39 -08:00
Mouse Reeve 2dad14bdcf
Merge pull request #2395 from bookwyrm-social/settings-view-perms
Fixes permissions on settings invite request page
2022-11-16 18:33:20 -08:00
Mouse Reeve a546ab578b Fixes decorator on view method 2022-11-16 18:23:26 -08:00
Mouse Reeve 5a7afe45a2 Fixes permissions on settings invite request page 2022-11-16 18:03:52 -08:00
Jascha Urbach c29256708a
show otp_secret when setting up 2fa
solves #2389
2022-11-16 20:30:06 +01:00
Mouse Reeve f95729a0c3 Adds unit test for failing view 2022-11-15 21:45:06 -08:00
Mouse Reeve 317cf5fcf5 Generate fewer add_status_tasks
Previously, every time a status was saved, a task would start to add it
to people's timelines. This meant there were a ton of duplicate tasks
that were potentially heavy to run. Now, the Status model has a "ready"
field which indicates that it's worth updating the timelines. It
defaults to True, which prevents statuses from accidentally not being
added due to ready state.

The ready state is explicitly set to false in the view, which is the
source of most of the noise for that task.
2022-11-15 14:14:32 -08:00
André Jaenisch 530d7de309
Use variable instead of string
Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2022-11-13 16:59:05 +01:00
Mouse Reeve 49d0590599 Another tweak to how import wait times are calculated 2022-11-10 13:59:27 -08:00
Mouse Reeve eae1866992
Allow users to temporarily deactivate their accounts (#2324) 2022-11-10 13:40:54 -08:00
Mouse Reeve 48d4149151 Fixes null state 2022-11-10 12:39:07 -08:00
Mouse Reeve f80e2465ed Adds tests for recent import average time 2022-11-10 12:29:36 -08:00
Mouse Reeve f0d3ceefa0 Cache import time
Also uses a type hint
2022-11-10 12:27:38 -08:00
Mouse Reeve 784dab3d41 Fixes to how import times are estimated
The wrong attr was being used to grab the number of seconds, and imports
that were stopped were being counted
2022-11-10 11:42:38 -08:00
Mouse Reeve 9e0867af91 Make the import admin table sortable 2022-11-07 11:32:45 -08:00
Mouse Reeve 817047bdeb Use stop functionality in import admin view 2022-11-05 15:44:00 -07:00
Mouse Reeve 6792b3d7b8 adds button to stop job 2022-11-05 14:44:09 -07:00
Mouse Reeve 7a36de5ebe Start and stop jobs from the model 2022-11-05 14:35:27 -07:00
Mouse Reeve 3c2f2c10bf Show recent imports in a table 2022-11-05 13:12:23 -07:00
Mouse Reeve 4806a6273e Show average run times for imports
This should give users a sense of when to start wondering if their
import isn't running after all.
2022-11-05 12:50:51 -07:00
Mouse Reeve 40e9428b49 Adds more fields to import admin table and ticks version 2022-11-03 11:30:43 -07:00
Mouse Reeve a8424f61f2 Mark imports as complete
This will let the user debug the import, and should only be used when
the import is in a bad state (marked as incomplete but with no pending
tasks)
2022-11-01 19:26:23 -07:00
Mouse Reeve 6eab1fdd6d Adds import admin view 2022-11-01 19:05:51 -07:00
Mouse Reeve 61c2d2a36a Use elided page range on user admin view 2022-11-01 18:45:21 -07:00
Hugh Rundle 3d95916b55 handle 2fa user exception properly 2022-10-15 07:47:20 +11:00
Hugh Rundle 32e4f7718e pylint is being pedantic 2022-10-15 07:47:20 +11:00
Hugh Rundle cf1fae6af8 return Bad Request if 2fa user does not exist 2022-10-15 07:47:20 +11:00
Hugh Rundle a1c3f15d80 remove unused import 2022-10-15 07:47:20 +11:00
Hugh Rundle f3768c3d92 code formatting fix 2022-10-15 07:47:20 +11:00
Hugh Rundle 79b04c2240 various 2fa improvements
- cleaner code
- use TWO_FACTOR_LOGIN_MAX_SECONDS instead of hardcoded number
- render qrcode properly
- use nginx to rate limit login attempts
- do not throw error if session user is undefined
2022-10-15 07:47:20 +11:00
Hugh Rundle 9d36722783 code formatting 2022-10-15 07:47:20 +11:00
Hugh Rundle 28329c1781 use string for datetime in session
It seemed to work when testing manually, but both pytest and the django documentation indicate that you can't pass datetimes around as session values.
2022-10-15 07:47:20 +11:00
Hugh Rundle 9b74c26742 backup codes
- add hotp_secret to user model
- view to create backup codes in user prefs
- check backup code if otp doesn't work
- increment hotp count if used
- show correct errors if code wrong
2022-10-15 07:47:20 +11:00
Hugh Rundle 5b244f06d6 fix error messages when setting up 2FA 2022-10-15 07:47:20 +11:00
Hugh Rundle 6db4fb39ed improve security and fix error msg
- Instead of passing the user as a hidden form element, we use a session variable.
- Introduces a 60 second limit on completing the login, and an exponentially increasing delay to attempt to login with 2FA if the code is entered incorrectly.
- use proper Django form error when incorrect otp value entered
2022-10-15 07:47:20 +11:00
Hugh Rundle 9d12b7caff make pylint stop grumbling 2022-10-15 07:47:20 +11:00
Hugh Rundle 1d13f0ab4f lint 2022-10-15 07:47:20 +11:00
Hugh Rundle 8837495ffd redirect login to 2fa check if active 2022-10-15 07:47:20 +11:00
Hugh Rundle 2ec343c5db new views for capturing user for 2fa check 2022-10-15 07:47:20 +11:00
Hugh Rundle 0e1751eb57 prep for 2fa login check
- new 2fa checker page to be inserted between initial login and completion of login
- new views and forms for above
2022-10-15 07:47:20 +11:00
Hugh Rundle 54daade9f9 prepare for 2FA
- add and migrate User fields for 2FA
- add views for 2FA
- add new forms for 2FA
- update package list in requirements.txt
- add URLs for 2FA views
2022-10-15 07:47:20 +11:00
Mouse Reeve 3a73ced5fa Adds a couple tests to annual review views
Also I tweaked the save functions so they don't broadcast
2022-09-19 14:38:30 -07:00
Mouse Reeve fdc477afdf
Merge pull request #2258 from bookwyrm-social/form-perms
Check permissions automatically on form save
2022-09-19 13:32:41 -07:00
Mouse Reeve 35aebacf70 Fixes theme form and adds view tests 2022-09-19 13:13:21 -07:00
Mouse Reeve bf092ec44e Small fixes 2022-09-19 12:10:27 -07:00
Mouse Reeve 6947f3b787 Uses class method to get list of instance admins
Re-writing this query over and over is a bad approach
2022-09-19 10:43:52 -07:00
Mouse Reeve 9d8d85ebc1 Invite perms checks 2022-09-19 10:26:40 -07:00
Mouse Reeve 1e988cae6c More edit book lines 2022-09-19 10:26:29 -07:00
Mouse Reeve be480e40f0 Updates links form saves 2022-09-19 10:18:30 -07:00
Mouse Reeve 3fd573c0da Check perms on site model form 2022-09-19 10:16:38 -07:00
Mouse Reeve b0d8697006 Adds missing save in edit book view 2022-09-19 10:16:29 -07:00
Mouse Reeve e51980bc12 Use BookWyrmModel as parent for admin models
This will make them more internally consistent and give them built-in
permissions checking
2022-09-19 09:35:38 -07:00
Mouse Reeve b0236b95bd Merge branch 'main' into form-perms 2022-09-19 09:32:48 -07:00
Mouse Reeve d76eae358f Show queues and runtime instead of start time 2022-09-15 10:53:08 -07:00
Mouse Reeve 3739bdbf81 Better comments 2022-09-15 09:49:58 -07:00
Mouse Reeve 0f55b76a93 Adds celery status view 2022-09-14 18:58:51 -07:00
Mouse Reeve fcf796abe1 Null state for review view during imports
Without this, it will show an empty progress bar and no info about why
the table is empty.
2022-09-14 18:08:16 -07:00
Mouse Reeve 543d13af6e Removes explicit calls to raise_not_editable from views
These raises are handled implicitly in the form, so they don't have to
be called outright.
2022-09-08 11:03:06 -07:00
Mouse Reeve 351292fcda Catches places where form.save() needs the request
Thank you, tests.
2022-09-08 11:02:17 -07:00
Mouse Reeve 1f93dc9c62
Merge pull request #2260 from bookwyrm-social/mentions
Refactors how mentions are collected
2022-08-29 15:17:40 -07:00
Mouse Reeve e782b3f360 Fixes logic that displays search remote or manually add link 2022-08-29 14:03:47 -07:00
Hugh Rundle 22495e40bd strip spaces from user search
Strips leading and trailing spaces from user search to prevent errors when doing webfinger lookup.
Prior to this, webfinger user queries included everything after the second '@' as part of the hostname. This resulted in failed webfinger requests when there was one or more trailing spaces.
Fixes #2205
2022-08-13 15:40:53 +10:00
Mouse Reeve 5c3bb2da13 Refactors how mentions are collected
This should be quicker, because it queries the users in one go instead
of jumping straight to iterating over them, and it checks if a user
blocks the poster before allowing them to be tagged.
2022-08-05 14:06:39 -07:00