]> Untitled Git - lemmy.git/commit
Make functions work with both connection and pool (#3420)
authordullbananas <dull.bananas0@gmail.com>
Tue, 11 Jul 2023 13:09:59 +0000 (06:09 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jul 2023 13:09:59 +0000 (09:09 -0400)
commit1d38aad9d3d51ef606074d5b49a8030c49dd0e9e
treed7d04c929472aa0b57e58f8185b05ac4731a0932
parent73492af4b09448684ffde3d55454434ec3ed490b
Make functions work with both connection and pool (#3420)

* a lot

* merge

* Fix stuff broken by merge

* Get rid of repetitive `&mut *context.conn().await?`

* Add blank lines under each line with `conn =`

* Fix style mistakes (partial)

* Revert "Fix style mistakes (partial)"

This reverts commit 48a033b87f4fdc1ce14ff86cc019e1c703cd2741.

* Revert "Add blank lines under each line with `conn =`"

This reverts commit 773a6d3beba2cf89eac75913078b40c4f5190dd4.

* Revert "Get rid of repetitive `&mut *context.conn().await?`"

This reverts commit d2c6263ea13710177d49b2791278db5ad115fca5.

* Use DbConn for CaptchaAnswer methods

* DbConn trait

* Remove more `&mut *`

* Fix stuff

* Re-run CI

* try to make ci start

* fix

* fix

* Fix api_common::utils

* Fix apub::activities::block

* Fix apub::api::resolve_object

* Fix some things

* Revert "Fix some things"

This reverts commit 2bf8574bc8333d8d34ca542d61a0a5b50039c24d.

* Revert "Fix apub::api::resolve_object"

This reverts commit 3e4059aabbe485b2ff060bdeced8ef958ff62832.

* Revert "Fix apub::activities::block"

This reverts commit 3b02389abd780a7b1b8a2c89e26febdaa6a12159.

* Revert "Fix api_common::utils"

This reverts commit 7dc73de613a5618fa57eb06450f3699bbcb41254.

* Revert "Revert "Fix api_common::utils""

This reverts commit f740f115e5457e83e53cc223e48196a2c47a9975.

* Revert "Revert "Fix apub::activities::block""

This reverts commit 2ee206af7c885c10092cf209bf4a5b1d60327866.

* Revert "Revert "Fix apub::api::resolve_object""

This reverts commit 96ed8bf2e9dcadae760743929498312334e23d2e.

* Fix fetch_local_site_data

* Fix get_comment_parent_creator

* Remove unused perma deleted text

* Fix routes::feeds

* Fix lib.rs

* Update lib.rs

* rerun ci

* Attempt to create custom GetConn and RunQueryDsl traits

* Start over

* Add GetConn trait

* aaaa

* Revert "aaaa"

This reverts commit acc9ca1aed10c39efdd91cefece066e035a1fe80.

* Revert "Revert "aaaa""

This reverts commit 443a2a00a56d152bb7eb429efd0d29a78e21b163.

* still aaaaaaaaaaaaa

* Return to earlier thing

Revert "Add GetConn trait"

This reverts commit ab4e94aea5bd9d34cbcddf017339131047e75344.

* Try to use DbPool enum

* Revert "Try to use DbPool enum"

This reverts commit e4d1712646a52006b865a1fbe0dcf79976fdb027.

* DbConn and DbPool enums (db_schema only fails to compile for tests)

* fmt

* Make functions take `&mut DbPool<'_>` and make db_schema tests compile

* Add try_join_with_pool macro and run fix-clippy on more crates

* Fix some errors

* I did it

* Remove function variants that take connection

* rerun ci

* rerun ci

* rerun ci
218 files changed:
crates/api/src/comment/distinguish.rs
crates/api/src/comment/like.rs
crates/api/src/comment/save.rs
crates/api/src/comment_report/create.rs
crates/api/src/comment_report/list.rs
crates/api/src/comment_report/resolve.rs
crates/api/src/community/add_mod.rs
crates/api/src/community/ban.rs
crates/api/src/community/block.rs
crates/api/src/community/follow.rs
crates/api/src/community/hide.rs
crates/api/src/community/transfer.rs
crates/api/src/lib.rs
crates/api/src/local_user/add_admin.rs
crates/api/src/local_user/ban_person.rs
crates/api/src/local_user/block.rs
crates/api/src/local_user/change_password.rs
crates/api/src/local_user/change_password_after_reset.rs
crates/api/src/local_user/get_captcha.rs
crates/api/src/local_user/list_banned.rs
crates/api/src/local_user/login.rs
crates/api/src/local_user/notifications/list_mentions.rs
crates/api/src/local_user/notifications/list_replies.rs
crates/api/src/local_user/notifications/mark_all_read.rs
crates/api/src/local_user/notifications/mark_mention_read.rs
crates/api/src/local_user/notifications/mark_reply_read.rs
crates/api/src/local_user/notifications/unread_count.rs
crates/api/src/local_user/report_count.rs
crates/api/src/local_user/reset_password.rs
crates/api/src/local_user/save_settings.rs
crates/api/src/local_user/verify_email.rs
crates/api/src/post/feature.rs
crates/api/src/post/like.rs
crates/api/src/post/lock.rs
crates/api/src/post/mark_read.rs
crates/api/src/post/save.rs
crates/api/src/post_report/create.rs
crates/api/src/post_report/list.rs
crates/api/src/post_report/resolve.rs
crates/api/src/private_message/mark_read.rs
crates/api/src/private_message_report/create.rs
crates/api/src/private_message_report/list.rs
crates/api/src/private_message_report/resolve.rs
crates/api/src/site/federated_instances.rs
crates/api/src/site/leave_admin.rs
crates/api/src/site/mod_log.rs
crates/api/src/site/purge/comment.rs
crates/api/src/site/purge/community.rs
crates/api/src/site/purge/person.rs
crates/api/src/site/purge/post.rs
crates/api/src/site/registration_applications/approve.rs
crates/api/src/site/registration_applications/list.rs
crates/api/src/site/registration_applications/unread_count.rs
crates/api_common/src/build_response.rs
crates/api_common/src/context.rs
crates/api_common/src/utils.rs
crates/api_crud/src/comment/create.rs
crates/api_crud/src/comment/delete.rs
crates/api_crud/src/comment/read.rs
crates/api_crud/src/comment/remove.rs
crates/api_crud/src/comment/update.rs
crates/api_crud/src/community/create.rs
crates/api_crud/src/community/delete.rs
crates/api_crud/src/community/list.rs
crates/api_crud/src/community/remove.rs
crates/api_crud/src/community/update.rs
crates/api_crud/src/custom_emoji/create.rs
crates/api_crud/src/custom_emoji/delete.rs
crates/api_crud/src/custom_emoji/update.rs
crates/api_crud/src/post/create.rs
crates/api_crud/src/post/delete.rs
crates/api_crud/src/post/read.rs
crates/api_crud/src/post/remove.rs
crates/api_crud/src/post/update.rs
crates/api_crud/src/private_message/create.rs
crates/api_crud/src/private_message/delete.rs
crates/api_crud/src/private_message/read.rs
crates/api_crud/src/private_message/update.rs
crates/api_crud/src/site/create.rs
crates/api_crud/src/site/read.rs
crates/api_crud/src/site/update.rs
crates/api_crud/src/user/create.rs
crates/apub/src/activities/block/block_user.rs
crates/apub/src/activities/block/mod.rs
crates/apub/src/activities/block/undo_block_user.rs
crates/apub/src/activities/community/collection_add.rs
crates/apub/src/activities/community/collection_remove.rs
crates/apub/src/activities/community/lock_page.rs
crates/apub/src/activities/community/mod.rs
crates/apub/src/activities/community/report.rs
crates/apub/src/activities/community/update.rs
crates/apub/src/activities/create_or_update/comment.rs
crates/apub/src/activities/create_or_update/post.rs
crates/apub/src/activities/create_or_update/private_message.rs
crates/apub/src/activities/deletion/delete.rs
crates/apub/src/activities/deletion/delete_user.rs
crates/apub/src/activities/deletion/mod.rs
crates/apub/src/activities/deletion/undo_delete.rs
crates/apub/src/activities/following/accept.rs
crates/apub/src/activities/following/follow.rs
crates/apub/src/activities/following/mod.rs
crates/apub/src/activities/following/undo_follow.rs
crates/apub/src/activities/mod.rs
crates/apub/src/activities/voting/mod.rs
crates/apub/src/activities/voting/vote.rs
crates/apub/src/api/list_comments.rs
crates/apub/src/api/list_posts.rs
crates/apub/src/api/read_community.rs
crates/apub/src/api/read_person.rs
crates/apub/src/api/resolve_object.rs
crates/apub/src/api/search.rs
crates/apub/src/collections/community_featured.rs
crates/apub/src/collections/community_moderators.rs
crates/apub/src/collections/community_outbox.rs
crates/apub/src/fetcher/mod.rs
crates/apub/src/fetcher/post_or_comment.rs
crates/apub/src/http/comment.rs
crates/apub/src/http/community.rs
crates/apub/src/http/mod.rs
crates/apub/src/http/person.rs
crates/apub/src/http/post.rs
crates/apub/src/http/site.rs
crates/apub/src/lib.rs
crates/apub/src/mentions.rs
crates/apub/src/objects/comment.rs
crates/apub/src/objects/community.rs
crates/apub/src/objects/instance.rs
crates/apub/src/objects/person.rs
crates/apub/src/objects/post.rs
crates/apub/src/objects/private_message.rs
crates/apub/src/protocol/activities/community/collection_add.rs
crates/apub/src/protocol/activities/community/collection_remove.rs
crates/apub/src/protocol/activities/community/lock_page.rs
crates/apub/src/protocol/activities/create_or_update/note.rs
crates/apub/src/protocol/activities/deletion/delete.rs
crates/apub/src/protocol/collections/group_followers.rs
crates/apub/src/protocol/objects/group.rs
crates/apub/src/protocol/objects/mod.rs
crates/apub/src/protocol/objects/note.rs
crates/db_schema/src/aggregates/comment_aggregates.rs
crates/db_schema/src/aggregates/community_aggregates.rs
crates/db_schema/src/aggregates/person_aggregates.rs
crates/db_schema/src/aggregates/person_post_aggregates.rs
crates/db_schema/src/aggregates/post_aggregates.rs
crates/db_schema/src/aggregates/site_aggregates.rs
crates/db_schema/src/impls/activity.rs
crates/db_schema/src/impls/actor_language.rs
crates/db_schema/src/impls/captcha_answer.rs
crates/db_schema/src/impls/comment.rs
crates/db_schema/src/impls/comment_reply.rs
crates/db_schema/src/impls/comment_report.rs
crates/db_schema/src/impls/community.rs
crates/db_schema/src/impls/community_block.rs
crates/db_schema/src/impls/custom_emoji.rs
crates/db_schema/src/impls/email_verification.rs
crates/db_schema/src/impls/federation_allowlist.rs
crates/db_schema/src/impls/federation_blocklist.rs
crates/db_schema/src/impls/instance.rs
crates/db_schema/src/impls/language.rs
crates/db_schema/src/impls/local_site.rs
crates/db_schema/src/impls/local_site_rate_limit.rs
crates/db_schema/src/impls/local_user.rs
crates/db_schema/src/impls/moderator.rs
crates/db_schema/src/impls/password_reset_request.rs
crates/db_schema/src/impls/person.rs
crates/db_schema/src/impls/person_block.rs
crates/db_schema/src/impls/person_mention.rs
crates/db_schema/src/impls/post.rs
crates/db_schema/src/impls/post_report.rs
crates/db_schema/src/impls/private_message.rs
crates/db_schema/src/impls/private_message_report.rs
crates/db_schema/src/impls/registration_application.rs
crates/db_schema/src/impls/secret.rs
crates/db_schema/src/impls/site.rs
crates/db_schema/src/impls/tagline.rs
crates/db_schema/src/traits.rs
crates/db_schema/src/utils.rs
crates/db_views/src/comment_report_view.rs
crates/db_views/src/comment_view.rs
crates/db_views/src/custom_emoji_view.rs
crates/db_views/src/local_user_view.rs
crates/db_views/src/post_report_view.rs
crates/db_views/src/post_view.rs
crates/db_views/src/private_message_report_view.rs
crates/db_views/src/private_message_view.rs
crates/db_views/src/registration_application_view.rs
crates/db_views/src/site_view.rs
crates/db_views_actor/src/comment_reply_view.rs
crates/db_views_actor/src/community_block_view.rs
crates/db_views_actor/src/community_follower_view.rs
crates/db_views_actor/src/community_moderator_view.rs
crates/db_views_actor/src/community_person_ban_view.rs
crates/db_views_actor/src/community_view.rs
crates/db_views_actor/src/person_block_view.rs
crates/db_views_actor/src/person_mention_view.rs
crates/db_views_actor/src/person_view.rs
crates/db_views_moderator/src/admin_purge_comment_view.rs
crates/db_views_moderator/src/admin_purge_community_view.rs
crates/db_views_moderator/src/admin_purge_person_view.rs
crates/db_views_moderator/src/admin_purge_post_view.rs
crates/db_views_moderator/src/mod_add_community_view.rs
crates/db_views_moderator/src/mod_add_view.rs
crates/db_views_moderator/src/mod_ban_from_community_view.rs
crates/db_views_moderator/src/mod_ban_view.rs
crates/db_views_moderator/src/mod_feature_post_view.rs
crates/db_views_moderator/src/mod_hide_community_view.rs
crates/db_views_moderator/src/mod_lock_post_view.rs
crates/db_views_moderator/src/mod_remove_comment_view.rs
crates/db_views_moderator/src/mod_remove_community_view.rs
crates/db_views_moderator/src/mod_remove_post_view.rs
crates/db_views_moderator/src/mod_transfer_community_view.rs
crates/routes/src/feeds.rs
crates/routes/src/images.rs
crates/routes/src/nodeinfo.rs
crates/routes/src/webfinger.rs
src/code_migrations.rs
src/lib.rs
src/prometheus_metrics.rs