Commit graph

90 commits

Author SHA1 Message Date
Adeodato Simó
cceccd1ecf
Merge from main into 'trigger_migrations'
Conflicts:
	requirements.txt
2024-03-17 21:54:15 -03:00
Adeodato Simó
8df408e07e
Define search_vector_trigger via Book.Meta.triggers 2023-11-25 17:02:54 -03:00
Adeodato Simó
416a6caf2d
Define author_search_vector_trigger via Author.Meta.triggers
Previously, triggers lived only in a particular migration file. With
this change, code for the triggers resides in the model, and their
lifecycle is managed through normal Django migrations.
2023-11-25 16:17:51 -03:00
Mouse Reeve
d94b27b723
Merge branch 'main' into user-migration 2023-11-19 19:18:22 -08:00
Adeodato Simó
ff1f239a57
Use typing_extensions.Self instead of TypeVar 2023-11-19 15:10:14 -03:00
Adeodato Simó
be9d92b1c2
Remove last references to "seal" in partial_date.py and migration 2023-11-09 14:00:45 -03:00
Adeodato Simó
edfa6b18a1
Rename utils.sealed_date module (and tests) to utils.partial_date 2023-11-09 14:00:44 -03:00
Adeodato Simó
fa80aa54a9
SealedDate renames, pt. 2
• SealedDate -> PartialDate
• MonthSeal  -> MonthParts
• YearSeal   -> YearParts
2023-11-09 14:00:44 -03:00
Adeodato Simó
0e4c5ed439
SealedDate renames, pt. 1
• SealedDateField      -> PartialDateModel
• SealedDateFormField  -> PartialDateFormField
• SealedDateDescriptor -> PartialDateDescriptor
2023-11-09 14:00:44 -03:00
Adeodato Simó
1952bb6ddc
fix mypy issues
The three "ignore" directives are:

  - avoid unreadable boilerplate from inherited `Field` methods; and:
  - https://github.com/typeddjango/django-stubs/issues/285#issuecomment-600029858
2023-10-24 18:14:05 -03:00
Adeodato Simó
170d1fe205
fix pylint issues (minus no-else-return) 2023-10-24 17:41:07 -03:00
Adeodato Simó
737ac8e908
Implement PartialDateField using SealedDate and a custom descriptor 2023-10-24 17:30:15 -03:00
Adeodato Simó
9752819bdb
Add support for parsing partial isoformats back 2023-10-24 17:30:13 -03:00
Adeodato Simó
4b47646e28
Fix typing hints in sealed_date module
In particular, SealedDate's class methods always return an instance
of the class they're invoked through (i.e., `SealedDate.from_date_parts`
intentionally never returns `MonthSeal` or `YearSeal`).

To propertly annotate this, a type variable is needed (or the much
simpler `Self` in Python 3.11).
2023-10-24 17:29:04 -03:00
Adeodato Simó
5f619d7a39
Implement SealedDateFormField to preserves partial dates
Note that Django forms _already_ have suppport for partial date data; we
just need to extend it when converting to Python (using SealedDate instead
of returning an error).
2023-10-24 17:29:00 -03:00
Adeodato Simó
46d80d56a5
Rename SealedDate.__str__ to partial_isoformat
Django uses `str(date)` for backends other than PostgreSQL, so do not
break "YYYY-MM-DD" formatting, just in case.
2023-10-24 04:32:27 -03:00
Adeodato Simó
a9c605ea97
Add SealedDate class for globally-stable, maybe-incomplete dates 2023-10-24 04:32:27 -03:00
Hugh Rundle
f30555be0f
minor pylint and mypy fixes 2023-10-23 21:30:17 +11:00
Hugh Rundle
ddec2dbaa9
fix tar types notification docstring 2023-10-23 20:43:49 +11:00
Hugh Rundle
2b6852e7a0
oops import Any 2023-10-22 17:56:46 +11:00
Hugh Rundle
b6b55b2e65
once more into the linting breach! 2023-10-22 17:49:26 +11:00
Hugh Rundle
6222088f15
Merge branch 'user-migrate' of github.com:hughrun/bookwyrm into user-migrate 2023-10-22 16:53:32 +11:00
Hugh Rundle
fd1ebf5f71
formatting and pylint fixes 2023-10-22 16:52:29 +11:00
Hugh Rundle
f07d730e03
Merge pull request #2980 from CSDUMMI/upstream2
Complete Migrations of Bookwyrm Accounts across instances

Merging this into `user-migration` branch to enable final work on this within the main Bookwyrm repository. We will pull in the final PR from there into `main` when ready.

Thanks to @CSDUMMI and the crew for this huge job.
2023-10-15 15:19:01 +11:00
Joeri de Ruiter
af5f71f5ac Revert return type for get_or_set 2023-09-13 10:21:30 +02:00
Joeri de Ruiter
a5cf912ae8 Fix some annotations 2023-09-13 09:22:53 +02:00
CSDUMMI
688978369f Implement self-contained archives to import and export entire users between instances (#38)
Co-authored-by: Daniel Burgess <developerdannymate@gmail.com>
Co-authored-by: Hugh Rundle <hugh@hughrundle.net>
Co-authored-by: dannymate <dannymate@noreply.codeberg.org>
Co-authored-by: hughrun <hughrun@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/GuildAlpha/bookwyrm/pulls/38
Co-authored-by: CSDUMMI <csdummi.misquality@simplelogin.co>
Co-committed-by: CSDUMMI <csdummi.misquality@simplelogin.co>
2023-09-07 22:37:28 +02:00
Joeri de Ruiter
2e88e73509 Remove returned None to make pylint happy 2023-08-21 14:00:09 +02:00
Joeri de Ruiter
0f2c0c034d Removed TODOs. When data is invalid return None. 2023-08-21 13:28:08 +02:00
Joeri de Ruiter
ff8e4597e5 Type annotations for utils 2023-08-21 12:56:32 +02:00
Joeri de Ruiter
ae5c27f3bb Sanitise description from Open Library 2023-08-02 19:30:40 +02: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
Christof Dorner
f3334b1550 Render hashtag links with data-mention="hashtag" attribute 2023-03-07 13:16:45 +01:00
Christof Dorner
c68304a99b Parse hashtags and store them in CreateStatus view 2023-03-07 12:55:36 +01:00
Hugh Rundle
c86fdfbd40 black 2023-01-26 16:56:11 +11:00
Hugh Rundle
1fe6892d0a pylint 2023-01-26 16:54:14 +11:00
Hugh Rundle
aa6eaccfbb use mocks for isni API calls
- fixes a couple of tests making author ISNI calls
- notes a future TODO to remove some possibly useless code
2023-01-26 16:22:50 +11:00
Joachim
fa3edea87b Update validate.py 2023-01-01 20:51:23 +01:00
Joachim
ac2ef667af Fix error when no referer 2023-01-01 19:57:10 +01:00
Joachim
bfe04feca9 Add validation util + test 2022-12-30 17:55:47 +01:00
Ell Bradshaw
c9adb7ff12 Linting fixes 2022-11-14 01:04:20 -08:00
Ell Bradshaw
b3603bc3f5 Merge branch 'main' into ignore-does-not-exist 2022-11-14 00:31:34 -08: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
9d9b7f366a Use "strip" in bleach
This removes forbidden html, rather than leaving them in place but
unrendered.
2022-07-04 13:55:58 -07:00
Mouse Reeve
7f78140015 Uses library for html cleanup 2022-07-04 13:21:13 -07:00
Mouse Reeve
94a6675dc4 Pylint fixes 2022-07-02 12:07:22 -07:00
Joel Bradshaw
7014786fe0 Run formatters 2022-06-05 13:41:00 -07:00
Joel Bradshaw
7ae0db7f4a Ignore VariableDoesNotExist errors in debug logging
They're so noisy as to make debug logging useless otherwise
2022-05-30 12:15:50 -07:00
Vivianne Langdon
b0d3eaeb40 allow empty slugs, for non-url-friendly book names 2022-04-08 22:11:05 -07:00
Vivianne Langdon
ebf463fc91 Generation of slugs and new urls to handle slugs
- TODO: redirect to correct slug if not found.
2022-03-02 00:21:23 -08:00