]> Untitled Git - lemmy.git/commit
Use URL type in most outstanding struct fields (#1468)
authorAndrew Yoon <andrew@nothing-to-say.org>
Tue, 2 Mar 2021 12:41:48 +0000 (07:41 -0500)
committerGitHub <noreply@github.com>
Tue, 2 Mar 2021 12:41:48 +0000 (12:41 +0000)
commite78ba38e94cdc6f31b6922a71eae05cbd8a8e435
treef7d69e9a3c1271875f486685f62f50102aa465fc
parent45e05dac30b6bada68609f8bdbfec8f2dbe2b4e7
Use URL type in most outstanding struct fields (#1468)

* Use URL type in most outstanding struct fields

This fixes all known remaining cases where url fields are stored as
plain strings, with the exception of form fields where empty strings
are used as sentinels (see `diesel_option_overwrite_to_url`).

Tested for regressions in the federated docker setup attempting to
exercise all changed fields, including through apub federation.

Fixes #1385

* Add migration to fix blank-string post.url values to be null

This also then fixes #602

* Address review feedback

- Fixed some unwraps and err message formatting
- Bumped the `url` library to 2.2.1 to fix a bug with serde error
  messages
- Add unit tests for the two diesel option override functions
- Fix migration teardown by adding a no-op

* Rename lemmy_db_queries::Url to lemmy_db_queries::DbUrl

* fix compile error

* box PostOrComment variants
44 files changed:
Cargo.lock
Cargo.toml
crates/api/Cargo.toml
crates/api/src/community.rs
crates/api/src/lib.rs
crates/api/src/post.rs
crates/api/src/site.rs
crates/api/src/user.rs
crates/api_structs/Cargo.toml
crates/api_structs/src/post.rs
crates/api_structs/src/site.rs
crates/apub/Cargo.toml
crates/apub/src/http/mod.rs
crates/apub/src/inbox/mod.rs
crates/apub/src/inbox/receive_for_community.rs
crates/apub/src/lib.rs
crates/apub/src/objects/community.rs
crates/apub/src/objects/mod.rs
crates/apub/src/objects/post.rs
crates/apub/src/objects/user.rs
crates/db_queries/Cargo.toml
crates/db_queries/src/lib.rs
crates/db_queries/src/source/activity.rs
crates/db_queries/src/source/comment.rs
crates/db_queries/src/source/community.rs
crates/db_queries/src/source/post.rs
crates/db_queries/src/source/private_message.rs
crates/db_queries/src/source/user.rs
crates/db_schema/Cargo.toml
crates/db_schema/src/lib.rs
crates/db_schema/src/source/activity.rs
crates/db_schema/src/source/comment.rs
crates/db_schema/src/source/community.rs
crates/db_schema/src/source/post.rs
crates/db_schema/src/source/post_report.rs
crates/db_schema/src/source/private_message.rs
crates/db_schema/src/source/site.rs
crates/db_schema/src/source/user.rs
crates/db_views/Cargo.toml
crates/routes/Cargo.toml
crates/utils/Cargo.toml
crates/utils/src/request.rs
migrations/2021-02-28-162616_clean_empty_post_urls/down.sql [new file with mode: 0644]
migrations/2021-02-28-162616_clean_empty_post_urls/up.sql [new file with mode: 0644]