Commit graph

5766 commits

Author SHA1 Message Date
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
97513a43d6 Set import job status when job starts and finishes 2022-11-05 13:47:06 -07:00
Mouse Reeve
59fe9e4d3b Show import status in table 2022-11-05 13:44:07 -07:00
Mouse Reeve
9cfcad20e0 Avoid divide by zero error 2022-11-05 13:33:57 -07:00
Mouse Reeve
24e5ea3295 Check if import is stopped and create import status field 2022-11-05 13:32:23 -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
14e61fa32d Adds extremely basic tests file 2022-11-03 10:55:21 -07:00
Mouse Reeve
0ba4dbbc6f Fixes pagination and user links on import admin 2022-11-03 10:54:59 -07:00
Mouse Reeve
91b935bc0a
Merge pull request #2327 from bookwyrm-social/imports-admin
Imports admin
2022-11-01 20:53:58 -07:00
Mouse Reeve
5af195de58 Python formatting 2022-11-01 20:43:27 -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
Mouse Reeve
641fc325b4
Merge pull request #2326 from bookwyrm-social/synchronous-confirmation-emails
Send confirmation emails directly, rather than with celery
2022-11-01 18:43:53 -07:00
Mouse Reeve
881d5682e3 Updates test mock 2022-11-01 18:20:56 -07:00
Mouse Reeve
1c949a5d71 Send confirmation emails directly, rather than with celery
Whenver bookwyrm has an influx of new users, celery gets delayed and
the emails don't get sent out promptly, which causes people to first
resend the email multiple times, and then to email me, both of which
just create more work and confusion for everyone involved.
2022-11-01 18:08:45 -07:00
Mouse Reeve
553f170f89 Only show editions with the author on the author page 2022-11-01 18:04:27 -07:00
Olivier Brencklé
cfaec434c0 🚸 Close dropdown when opening modal item 2022-10-28 13:15:53 +02:00
Olivier Brencklé
474b78dad2 💄 Set dropdown menu below modals on mobile 2022-10-24 19:34:25 +02:00
Mouse Reeve
eb07deadf2
Merge pull request #2320 from bookwyrm-social/announcement-size
Remove extra whitespace in announcements
2022-10-20 20:56:52 -07:00
Mouse Reeve
b81a5faff7 Remove extra whitespace in announcements 2022-10-20 07:45:53 -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
905aa66f38 add test_post_login_with_2fa 2022-10-15 07:47:20 +11:00
Hugh Rundle
a1c3f15d80 remove unused import 2022-10-15 07:47:20 +11:00
Hugh Rundle
f55adbadf4 fix 2fa tests 2022-10-15 07:47:20 +11:00
Hugh Rundle
cffbf82ddb DRY footer for 2FA pages 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
aefc7a23bc fix 2fa templates
- translate all strings
- do not embed svg element inside svg element
- fix sizing of input for confirming 2fa setup
2022-10-15 07:47:20 +11:00
Hugh Rundle
e1513bf98d amend nginx rate limiting urls 2022-10-15 07:47:20 +11:00
Hugh Rundle
da613c9b26 ugh forgot to run black 2022-10-15 07:47:20 +11:00
Hugh Rundle
fda150fa0d resolve migration conflict 2022-10-15 07:47:20 +11:00
Hugh Rundle
119b4bf2ff clean up tests
- remove unnecessary crap
- add missing tests
2022-10-15 07:47:20 +11:00
Hugh Rundle
9d36722783 code formatting 2022-10-15 07:47:20 +11:00
Hugh Rundle
b63d4bec60 add tests for 2fa 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
e1b1bb20dc make password field less goofy in 2fa screen 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
9616abb6bd clean up 2fa prompt page 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
f26ac1ccde 2fa page templates 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
514762c233 fix typo in new user fields
oopsie
2022-10-15 07:47:20 +11:00
Hugh Rundle
aca5c19f70 2fa templates
- new page templates for 2FA
- add 2FA to menu in user preferences
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
fed6bcd375
Merge pull request #2314 from chambersh1129/2194-normalize-stored-ISNI
Closes #2194 Normalize stored ISNI
2022-10-14 12:20:07 -07:00
Mouse Reeve
b02ad2ec68
Merge pull request #2316 from redshiftss/bugfix/reading-status-future
Make it so that finishing a book cannot happen in the future
2022-10-14 12:17:42 -07:00
Mouse Reeve
b06c35b7dd
Update forms.py 2022-10-14 12:06:54 -07:00
Laura Pircalaboiu
f97b6f3da2 fix pylint complaint 2022-10-12 11:25:03 +02:00
Laura Pircalaboiu
4ab5e4b5d9 re-format code 2022-10-11 14:40:52 +02:00
Laura Pircalaboiu
b895fbd8f2 fix bug, can no longer finish a book in the future 2022-10-11 14:40:45 +02:00
Laura Pircalaboiu
aeeb2c3442 WIP: fix reading status ending in the future 2022-10-11 14:40:32 +02:00
Hunter Chambers
32f68c3f62 remove trailing whitespace causing pylint/black errors 2022-10-10 14:13:57 -04:00
Hunter Chambers
02c7397eaf Closes #2194 Normalize stored ISNI 2022-10-09 19:36:24 -04:00
Mouse Reeve
74b89b2d4a That test didn't work 2022-10-04 12:09:05 -07:00
Mouse Reeve
5b5e15d48b Just adds a couple tests 2022-10-04 11:40:01 -07:00
Mouse Reeve
78d36ebc39 Fixes typo in tour 2022-09-24 19:41:37 -07: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
7d61cb55bc Ignore pylint complaints about argument counts to form saves 2022-09-19 13:23:18 -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
4c099afc63 Python formatting 2022-09-19 11:23:40 -07:00
Mouse Reeve
37dacaff6f Fixes creating notifications for auto-moderation reports 2022-09-19 11:11:08 -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
330be16516 Adds permissions checking for admin models 2022-09-19 10:12:47 -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
3f5eb6c682 Adds raise_not_editable to User model
This model doens't inherit from BookwyrmModel for various reasons, but
it still needs to editability check.
2022-09-19 09:26:01 -07:00
Mouse Reeve
aa67f23b03 Override raise_not_editable for report model
This model uses "reporter" as the field that represents the onwer of the
object, and "user" and the subject. In retrospect, maybe not the ideal
way to do it.
2022-09-19 09:20:44 -07:00
Mouse Reeve
81d5195d20 Adds test 2022-09-15 11:12:05 -07:00
Mouse Reeve
fcd96c332d Null state 2022-09-15 11:09:07 -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
Hugh Rundle
aa18179dbc add migration 2022-09-10 10:27:17 +10:00
Hugh Rundle
0ad3dc6245 allow 0.5 star ratings 2022-09-10 07:24:11 +10:00
Hugh Rundle
230d30abb8 sidebar review stars should default to zero
PR #2283 surfaced an existing formerly-hidden issue with star rating defaults in the sidebar of book pages.
This commit ensures the default rating is zero, not half a star.

Fixes #2291
2022-09-10 07:03:12 +10: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
c71d133d2c
Merge pull request #2288 from mooseyboots/del-notifs-button
conditional display of notifs button
2022-09-08 10:16:07 -07:00
Mouse Reeve
834c7e9cd5
Merge pull request #2282 from hughrun/normalise-isbn
Normalise ISBNs for searching
2022-09-08 10:14:30 -07:00
marty hiatt
b4cc9f5753 conditional display of notifs button 2022-09-01 11:54:49 +02:00
Hugh Rundle
1ee2ff4811 normalise isbn on local book search
- uppercase ISBN before checking it's a number to account for trailing 'x'
- check maybe_isbn for search_identifiers search. Without this we are only searching external connectors, not locally!
2022-08-30 20:00:09 +10:00
Hugh Rundle
68d91086ed add wonky ISBN test 2022-08-30 19:57:25 +10: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
Mouse Reeve
98562dc92f Allow x in isbn path 2022-08-29 13:41:49 -07:00
Mouse Reeve
775ee6f590
Merge pull request #2283 from hughrun/halfstars
fix visibility of stars when editing a review
2022-08-29 13:39:47 -07:00
Mouse Reeve
f0effb9d3e Uses theme in remote follow template 2022-08-29 07:10:36 -07:00
Hugh Rundle
252fe7fd6a fix visibility of stars when editing a review
Previously the star rating appeared to be five stars when editing a review, regardless of what value was actually stored.
Now it will show the actual rating, including half stars.

Fixes #2213
2022-08-29 14:02:04 +10:00
Hugh Rundle
18d3d2f85d linting 2022-08-28 17:30:46 +10:00
Hugh Rundle
f219851f3a strip leading and following spaces from ISBN 2022-08-28 17:28:00 +10:00
Hugh Rundle
da5fd32196 normalise isbn searching
ISBNs are always numeric except for when the check digit in ISBN-10s is a ten, indicated with a capital X.
These changes ensure that ISBNs are always upper-case so that a lower-case 'x' is not used when searching.

Additionally some ancient ISBNs have been printed without a leading zero (i.e. they only have 9 characters on the physical book). This change prepends a zero if something looks like an ISBN but only has 9 chars.
2022-08-28 11:05:40 +10:00
Mouse Reeve
58c3a4c2bc
Merge pull request #2277 from hughrun/permissions
hide replies to posts user cannot see
2022-08-23 19:48:36 -07:00
Hugh Rundle
cc97c52d12 make get_audience logic clearer
Retains 'direct' messages at the top of the logic tree to make it easier to understand.
In practice because direct messages are excluded from feeds anyway, this doesn't seem to make much difference, but it's easier to read.
2022-08-21 09:33:43 +10:00
Hugh Rundle
8d593e4498 hide replies to posts user cannot see
This is in response to #1870

Users should not see links to posts they are not allowed to see, in their feed. The main question is how to stop that happening.
This commit hides all replies to posts if the original post was "followers only" and the user is not a follower of the original poster. The privacy of the reply is not considered relevant (except "direct").

I believe this is the cleanest way to deal with the problem, as it avoids orphaned replies and confusing 404s, and a reply without access to the context of the original post is not particularly useful to anyone. This also feels like it respects the wishes of the original poster more accurately, as it does not draw attention from non-followers to the original followers-only post.

A less draconian approach might be to remove the link to the original status in the feed interface, however that simply leads to confusion of another kind since it will make the interface inconsistent.

This commit does not change any ActivityPub behaviour - it only affects the Bookwyrm user feeds. This means orphaned posts may be sent to external apps like Mastodon.
2022-08-14 14:17:10 +10: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
d58282bc37
Merge pull request #2263 from bookwyrm-social/safer-book-description
Safer display of book descriptions
2022-08-09 10:21:11 -07:00
Mouse Reeve
0cf9e1033b Safer display of book descriptions 2022-08-07 13:26:05 -07:00
Mouse Reeve
1581491471 Removes duplicate version warning 2022-08-05 17:03:56 -07:00
Mouse Reeve
c8fc907705 Update version 2022-08-05 16:54:55 -07: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
Mouse Reeve
9d7ece47ef
Merge pull request #2254 from bookwyrm-social/fixes-search-pagination
Fixes search pagination
2022-08-05 12:32:47 -07:00
Mouse Reeve
9fad5b5623 Fixes isbn view 2022-08-05 11:44:10 -07:00
Mouse Reeve
bdf563748c
Merge pull request #2255 from joachimesque/front/mobile-header
Add notifications count on mobile header
2022-08-05 11:28:42 -07:00
Mouse Reeve
7c7df99cef Fixes template syntax error 2022-08-05 11:14:14 -07:00
Mouse Reeve
20572688ba Removes test exception 2022-08-05 11:04:32 -07:00
Mouse Reeve
1ba69acc49 Adds unit tests that checks if rel field is set on links 2022-08-05 11:01:02 -07:00
Mouse Reeve
4dd7f88e0a Updates all links that open in new tabs 2022-08-05 10:20:43 -07:00
Mouse Reeve
9407695328 Updates footer links
Adds a missing rel="nofollow noopener noreferrer" attribute for the
Patreon link, and makes the github link open in a new tab (and updates
the url, which was out of date)
2022-08-05 10:06:12 -07:00
Mouse Reeve
8f79b362f8 Check permissions automatically on form save 2022-08-05 09:56:32 -07:00
Mouse Reeve
2894aa37a2 Fixes perms checks for groups 2022-08-05 09:12:48 -07:00
Mouse Reeve
b4cfda0587 Updates tests 2022-08-05 08:56:24 -07:00
Joachim
610d8fdf5b Add notifications count on mobile header 2022-08-05 11:15:11 +02:00
Mouse Reeve
ed71b791c9 Python formatting 2022-08-04 12:19:26 -07:00
Mouse Reeve
48df5076e7 Use elided page range and paginate user and list results 2022-08-04 12:11:39 -07:00
Mouse Reeve
06d1936ac9 Fixes pagination of local search results 2022-08-04 12:04:13 -07:00
Mouse Reeve
3270d0a7d4
Merge pull request #2247 from bookwyrm-social/followers-following-views
Merges follower/following views
2022-08-02 11:59:06 -07:00
Mouse Reeve
0bc3c3b5f6 Adds locale migration 2022-08-02 11:09:58 -07:00
Mouse Reeve
f9b772e234 Adds polish locale 2022-08-02 10:59:40 -07:00
Mouse Reeve
6d258d5445 Fixes test mocks 2022-07-30 10:07:13 -07:00
Mouse Reeve
d7bf348c77
Merge pull request #2249 from bookwyrm-social/crsf-exempt
Removes improperly placed csrf_exempt decorator
2022-07-29 13:49:29 -07:00
Mouse Reeve
8e2a8ec6e0 Removes improperly places csrf_exempt decorator 2022-07-29 13:40:40 -07:00
Mouse Reeve
96f1521239
Merge pull request #2248 from bookwyrm-social/list-suggestions
Move list suggestions into helper function
2022-07-29 13:27:04 -07:00
Mouse Reeve
844023f104
Merge pull request #2246 from bookwyrm-social/goal-model
Moves annual goal to its own file
2022-07-29 13:22:12 -07:00
Mouse Reeve
d301cecc9f Move list suggestions into helper function
The view was complicated, this makes it a little easier to read and
test.
2022-07-29 13:15:24 -07:00
Mouse Reeve
23188dfc5f
Merge branch 'main' into followers-following-views 2022-07-29 13:09:30 -07:00
Mouse Reeve
d458001491 Merges follower/following views
They were almost identical!
2022-07-29 13:07:15 -07:00
Mouse Reeve
2298a478cf Moves annual goal to its own file
The user model file is just,, very long
2022-07-29 13:00:59 -07:00
Mouse Reeve
f52965b8f4 Fixes a couple typos 2022-07-29 12:08:36 -07:00
Mouse Reeve
29db9c68a1 Fixes typo and spacing 2022-07-29 11:31:35 -07:00
Mouse Reeve
868ab62863 Fixes template string quote escapes
It seems totally reasonable that using an escape slash would make
apostrophes in words work, but the translation system works in
mysterious ways that do not include supporting that. I've used backticks
as a third quote type to escape everything in a way that both
javascript and gettext understand.

While I was there I split up some strings that have more complicated
html in them, since that can be fragile when passed through translation,
and confusing for translators.
2022-07-29 11:22:31 -07:00
Mouse Reeve
2837d0148f Checks permissions when saving a list 2022-07-28 11:44:04 -07:00