# use minimum supported rust version for most steps
- name: prepare repo
- image: clux/muslrust:1.57.0
+ image: clux/muslrust:1.59.0
user: root
commands:
- git fetch --tags
- name: cargo clippy
image: rust:1.61-buster
commands:
+ - apt-get update
+ - apt-get -y install protobuf-compiler libprotobuf-dev
- rustup component add clippy
- cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
- cargo clippy --workspace --all-features -- -D clippy::unwrap_used
- name: cargo test
- image: clux/muslrust:1.57.0
+ image: clux/muslrust:1.59.0
environment:
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
LEMMY_CONFIG_LOCATION: ../../config/config.hjson
RUST_TEST_THREADS: 1
commands:
- apt-get update
- - apt-get -y install --no-install-recommends postgresql-client
+ - apt-get -y install --no-install-recommends postgresql-client protobuf-compiler libprotobuf-dev
- cargo test --workspace --no-fail-fast --all-features
- name: check defaults.hjson updated
- image: clux/muslrust:1.57.0
+ image: clux/muslrust:1.59.0
commands:
- ./scripts/update_config_defaults.sh config/defaults_current.hjson
- diff config/defaults.hjson config/defaults_current.hjson
- name: check with different features
- image: clux/muslrust:1.57.0
+ image: clux/muslrust:1.59.0
commands:
- cargo install cargo-workspaces
- cargo workspaces exec cargo check --no-default-features
- cargo workspaces exec cargo check --all-features
- name: cargo build
- image: clux/muslrust:1.57.0
+ image: clux/muslrust:1.59.0
commands:
- cargo build
- mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07520b54fc0f22ad30b90399b2a2689c6e5c113df0642ca3fa2f7ee823e54126"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
"futures-util",
"log",
"once_cell",
- "parking_lot 0.12.0",
+ "parking_lot",
"pin-project-lite",
"smallvec",
"tokio",
- "tokio-util 0.7.1",
+ "tokio-util 0.7.4",
]
[[package]]
"memchr",
"pin-project-lite",
"tokio",
- "tokio-util 0.7.1",
+ "tokio-util 0.7.4",
]
[[package]]
name = "actix-http"
-version = "3.0.4"
+version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5885cb81a0d4d0d322864bea1bb6c2a8144626b4fdc625d4c51eba197e7797a"
+checksum = "0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724"
dependencies = [
"actix-codec",
"actix-rt",
"itoa",
"language-tags",
"local-channel",
- "log",
"mime",
"percent-encoding",
"pin-project-lite",
"rand 0.8.5",
- "sha-1 0.10.0",
+ "sha1",
"smallvec",
+ "tracing",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6"
dependencies = [
- "quote 1.0.20",
- "syn 1.0.98",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "actix-router"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb60846b52c118f2f04a56cc90880a274271c489b2498623d58176f8ca21fa80"
+checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799"
dependencies = [
"bytestring",
- "firestorm",
"http",
- "log",
"regex",
"serde",
+ "tracing",
]
[[package]]
"log",
"pin-project-lite",
"tokio-rustls",
- "tokio-util 0.7.1",
+ "tokio-util 0.7.4",
"webpki-roots",
]
[[package]]
name = "actix-web"
-version = "4.0.1"
+version = "4.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31"
+checksum = "d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9"
dependencies = [
"actix-codec",
"actix-http",
"encoding_rs",
"futures-core",
"futures-util",
+ "http",
"itoa",
"language-tags",
"log",
"serde_urlencoded",
"smallvec",
"socket2",
- "time 0.3.9",
+ "time 0.3.14",
"url",
]
[[package]]
name = "actix-web-codegen"
-version = "4.0.0"
+version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc"
+checksum = "1fa9362663c8643d67b2d5eafba49e4cb2c8a053a29ed00a0bea121f17c76b13"
dependencies = [
"actix-router",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
-[[package]]
-name = "adler32"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
-
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.6",
+ "getrandom 0.2.7",
"once_cell",
"version_check",
]
[[package]]
name = "aho-corasick"
-version = "0.7.18"
+version = "0.7.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
dependencies = [
"memchr",
]
+[[package]]
+name = "android_system_properties"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "ansi_term"
version = "0.12.1"
[[package]]
name = "anyhow"
-version = "1.0.58"
+version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
+checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
[[package]]
name = "arrayvec"
[[package]]
name = "assert-json-diff"
-version = "2.0.1"
+version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f1c3703dd33532d7f0ca049168930e9099ecac238e23cf932f3a69c42f06da"
+checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12"
dependencies = [
"serde",
"serde_json",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "async-trait"
-version = "0.1.56"
+version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716"
+checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+[[package]]
+name = "axum"
+version = "0.5.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9e3356844c4d6a6d6467b8da2cffb4a2820be256f50a3a386c9d152bab31043"
+dependencies = [
+ "async-trait",
+ "axum-core",
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "itoa",
+ "matchit",
+ "memchr",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "serde",
+ "sync_wrapper",
+ "tokio",
+ "tower",
+ "tower-http",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "axum-core"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9f0c0a60006f2a293d82d571f635042a72edf927539b7685bd62d361963839b"
+dependencies = [
+ "async-trait",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "mime",
+ "tower-layer",
+ "tower-service",
+]
+
[[package]]
name = "background-jobs"
version = "0.12.0"
"tokio",
"tracing",
"tracing-futures",
- "uuid",
+ "uuid 0.8.2",
]
[[package]]
"serde",
"serde_json",
"thiserror",
- "time 0.3.9",
+ "time 0.3.14",
"tracing",
"tracing-futures",
- "uuid",
+ "uuid 0.8.2",
]
[[package]]
[[package]]
name = "bcrypt"
-version = "0.12.1"
+version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fe4fef31efb0f76133ae8e3576a88e58edb7cfc5584c81c758c349ba46b43fc"
+checksum = "a7e7c93a3fb23b2fdde989b2c9ec4dd153063ec81f408507f84c090cd91c6641"
dependencies = [
"base64",
"blowfish",
- "getrandom 0.2.6",
+ "getrandom 0.2.7",
"zeroize",
]
[[package]]
name = "bit-set"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
+checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
dependencies = [
"bit-vec",
]
[[package]]
name = "block-buffer"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
-dependencies = [
- "block-padding",
- "byte-tools",
- "byteorder",
- "generic-array 0.12.4",
-]
-
-[[package]]
-name = "block-buffer"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
-dependencies = [
- "generic-array 0.14.5",
-]
-
-[[package]]
-name = "block-padding"
-version = "0.1.5"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
+checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
- "byte-tools",
+ "generic-array",
]
[[package]]
[[package]]
name = "bumpalo"
-version = "3.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
-
-[[package]]
-name = "byte-tools"
-version = "0.3.1"
+version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
+checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
[[package]]
name = "bytemuck"
-version = "1.8.0"
+version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e851ca7c24871e7336801608a4797d7376545b6928a10d32d75685687141ead"
+checksum = "2f5715e491b5a1598fc2bef5a606847b5dc1d48ea625bd3c02c00de8285591da"
[[package]]
name = "byteorder"
[[package]]
name = "bytes"
-version = "1.1.0"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
+checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
[[package]]
name = "bytestring"
-version = "1.0.0"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90706ba19e97b90786e19dc0d5e2abd80008d99d4c0c5d1ad0b5e72cec7c494d"
+checksum = "86b6a75fd3048808ef06af5cd79712be8111960adaf89d90250974b38fc3928a"
dependencies = [
"bytes",
]
[[package]]
name = "chrono"
-version = "0.4.19"
+version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
+checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
- "libc",
+ "iana-time-zone",
+ "js-sys",
"num-integer",
"num-traits",
"serde",
"time 0.1.44",
+ "wasm-bindgen",
"winapi",
]
[[package]]
name = "combine"
-version = "4.6.3"
+version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50b727aacc797f9fc28e355d21f34709ac4fc9adecfe470ad07b8f4464f53062"
+checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
dependencies = [
"bytes",
"memchr",
[[package]]
name = "comrak"
-version = "0.12.1"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff3c476e1a33eb4df1212a02db79d0f788bbd760901f34f5897644623e0e4e74"
+checksum = "15bf1e432b302dc6236dd0db580d182ce520bb24af82d6462e2d7a5e0a31c50d"
dependencies = [
"entities",
"lazy_static",
+ "memchr",
"pest",
"pest_derive",
"regex",
"shell-words",
- "twoway",
"typed-arena",
"unicode_categories",
"xdg",
[[package]]
name = "console-api"
-version = "0.1.2"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc347c19eb5b940f396ac155822caee6662f850d97306890ac3773ed76c90c5a"
+checksum = "e57ff02e8ad8e06ab9731d5dc72dc23bef9200778eae1a89d555d8c42e5d4a86"
dependencies = [
- "prost",
- "prost-types",
- "tonic",
- "tonic-build",
+ "prost 0.11.0",
+ "prost-types 0.11.1",
+ "tonic 0.8.1",
"tracing-core",
]
[[package]]
name = "console-subscriber"
-version = "0.1.3"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "565a7dfea2d10dd0e5c57cc394d5d441b1910960d8c9211ed14135e0e6ec3a20"
+checksum = "22a3a81dfaf6b66bce5d159eddae701e3a002f194d378cbf7be5f053c281d9be"
dependencies = [
"console-api",
"crossbeam-channel",
"futures",
"hdrhistogram",
"humantime",
- "prost-types",
+ "prost-types 0.11.1",
"serde",
"serde_json",
"thread_local",
"tokio",
"tokio-stream",
- "tonic",
+ "tonic 0.8.1",
"tracing",
"tracing-core",
"tracing-subscriber",
checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05"
dependencies = [
"percent-encoding",
- "time 0.3.9",
+ "time 0.3.14",
"version_check",
]
[[package]]
name = "cpufeatures"
-version = "0.2.2"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b"
+checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crossbeam-channel"
-version = "0.5.4"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
+checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
dependencies = [
"cfg-if",
"crossbeam-utils",
[[package]]
name = "crossbeam-utils"
-version = "0.8.8"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
+checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
dependencies = [
"cfg-if",
- "lazy_static",
+ "once_cell",
]
[[package]]
name = "crypto-common"
-version = "0.1.3"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "generic-array 0.14.5",
+ "generic-array",
"typenum",
]
dependencies = [
"fnv",
"ident_case",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"strsim",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
dependencies = [
"fnv",
"ident_case",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"strsim",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
dependencies = [
"fnv",
"ident_case",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"strsim",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
dependencies = [
"darling_core 0.12.4",
- "quote 1.0.20",
- "syn 1.0.98",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
dependencies = [
"darling_core 0.13.4",
- "quote 1.0.20",
- "syn 1.0.98",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5"
dependencies = [
"darling_core 0.14.1",
- "quote 1.0.20",
- "syn 1.0.98",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
-name = "deflate"
-version = "1.0.0"
+name = "dashmap"
+version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c86f7e25f518f4b81808a2cf1c50996a61f5c2eb394b2393bd87f2a4780a432f"
+checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
- "adler32",
+ "cfg-if",
+ "hashbrown",
+ "lock_api",
+ "once_cell",
+ "parking_lot_core",
]
[[package]]
checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5"
dependencies = [
"darling 0.12.4",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4"
dependencies = [
"darling 0.14.1",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73"
dependencies = [
"derive_builder_core 0.10.2",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68"
dependencies = [
"derive_builder_core 0.11.2",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
"convert_case",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"rustc_version",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "diesel"
-version = "1.4.8"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b28135ecf6b7d446b43e27e225622a038cc4e2930a1022f51cdb97ada19b8e4d"
+checksum = "01e2adfd0a7a81070ed7beec0c62636458926326c16fedb77796d41e447b282d"
dependencies = [
"bitflags",
"byteorder",
"chrono",
"diesel_derives",
+ "itoa",
"pq-sys",
"r2d2",
"serde_json",
[[package]]
name = "diesel-derive-newtype"
-version = "0.1.2"
+version = "2.0.0-rc.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e844e8e6f65dcf27aa0b97d4234f974d93dfbf56816033d71b5e0c7eb701709f"
+checksum = "dd577654b63c049f4eecd2ce1187740a050166372673f6b09c351c53b575c34a"
dependencies = [
- "diesel",
"proc-macro2 0.4.30",
"quote 0.6.13",
"syn 0.14.9",
[[package]]
name = "diesel_derives"
-version = "1.4.1"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
+checksum = "22a7ab9d7967e6a1a247ea38aedf88ab808b4ac0c159576bc71866ab8f9f9250"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro-error",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "diesel_ltree"
-version = "0.2.7"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55a0b2b2e948a2d8ab673ccee9f37b20bdcc8b7acb40a242a0fdf53d4c2678b0"
+checksum = "92d9f0b872d6c87b68a71f105802b941a7262788bf69d1bcd05654669cdbd55d"
dependencies = [
"byteorder",
"diesel",
[[package]]
name = "diesel_migrations"
-version = "1.4.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c"
+checksum = "e9ae22beef5e9d6fab9225ddb073c1c6c1a7a6ded5019d5da11d1e5c5adc34e2"
dependencies = [
+ "diesel",
"migrations_internals",
"migrations_macros",
]
[[package]]
name = "digest"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
-dependencies = [
- "generic-array 0.12.4",
-]
-
-[[package]]
-name = "digest"
-version = "0.10.3"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
+checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
dependencies = [
- "block-buffer 0.10.2",
+ "block-buffer",
"crypto-common",
]
checksum = "6430bef5fcbfa22f3c431f05a14254d45f41ab634cabe09fad82e98d4f9fdc8b"
dependencies = [
"darling 0.13.4",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "either"
-version = "1.6.1"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
+checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "email-encoding"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "827e1fb86d24d558ab0454ca3fa084f8a6144ade1e3e6982f697c586bf96b41b"
+checksum = "34dd14c63662e0206599796cd5e1ad0268ab2b9d19b868d6050d688eba2bbf98"
dependencies = [
"base64",
"memchr",
[[package]]
name = "email_address"
-version = "0.2.1"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8684b7c9cb4857dfa1e5b9629ef584ba618c9b93bae60f58cb23f4f271d0468e"
+checksum = "b1b32a7a2580c4473f10f66b512c34bdd7d33c5e3473227ca833abdb5afe4809"
[[package]]
name = "encoding"
[[package]]
name = "encoding_rs"
-version = "0.8.30"
+version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df"
+checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
dependencies = [
"cfg-if",
]
[[package]]
name = "event-listener"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
-
-[[package]]
-name = "fake-simd"
-version = "0.1.2"
+version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "fallible_collections"
-version = "0.4.4"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52db5973b6a19247baf19b30f41c23a1bfffc2e9ce0a5db2f60e3cd5dc8895f7"
+checksum = "c195cf4b2285d3c993eb887b4dc56b0d5728bbe1d0f9a99c0ac6bec2da3e4d85"
dependencies = [
"hashbrown",
]
[[package]]
name = "fastrand"
-version = "1.7.0"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
+checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
dependencies = [
"instant",
]
-[[package]]
-name = "firestorm"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d3d6188b8804df28032815ea256b6955c9625c24da7525f387a7af02fbb8f01"
-
[[package]]
name = "fixedbitset"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
+checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flate2"
-version = "1.0.22"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
+checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [
- "cfg-if",
"crc32fast",
- "libc",
- "miniz_oxide 0.4.4",
+ "miniz_oxide",
]
[[package]]
[[package]]
name = "form_urlencoded"
-version = "1.0.1"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
+checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
dependencies = [
- "matches",
"percent-encoding",
]
[[package]]
name = "futures"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e"
+checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
dependencies = [
"futures-channel",
"futures-core",
[[package]]
name = "futures-channel"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
+checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
dependencies = [
"futures-core",
"futures-sink",
[[package]]
name = "futures-core"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
+checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
[[package]]
name = "futures-executor"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6"
+checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
dependencies = [
"futures-core",
"futures-task",
[[package]]
name = "futures-io"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
+checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
[[package]]
name = "futures-macro"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
+checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "futures-sink"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868"
+checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
[[package]]
name = "futures-task"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
+checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
[[package]]
name = "futures-util"
-version = "0.3.21"
+version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a"
+checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
dependencies = [
"futures-channel",
"futures-core",
[[package]]
name = "generic-array"
-version = "0.12.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
-dependencies = [
- "typenum",
-]
-
-[[package]]
-name = "generic-array"
-version = "0.14.5"
+version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
+checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
"version_check",
[[package]]
name = "getrandom"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
+checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [
"cfg-if",
"libc",
- "wasi 0.10.0+wasi-snapshot-preview1",
+ "wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
name = "h2"
-version = "0.3.12"
+version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b"
+checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be"
dependencies = [
"bytes",
"fnv",
"indexmap",
"slab",
"tokio",
- "tokio-util 0.6.9",
+ "tokio-util 0.7.4",
"tracing",
]
[[package]]
name = "hashbrown"
-version = "0.11.2"
+version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
]
[[package]]
name = "hdrhistogram"
-version = "7.5.0"
+version = "7.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0"
+checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8"
dependencies = [
"base64",
"byteorder",
[[package]]
name = "hound"
-version = "3.4.0"
+version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549"
+checksum = "4d13cdbd5dbb29f9c88095bbdc2590c9cba0d0a1269b983fef6b2cdd7e9f4db1"
[[package]]
name = "html2md"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61f6bf799d9770725ec13d66f4af9344e96285dc14d8e71e0fe02d272690667f"
dependencies = [
- "html5ever",
+ "html5ever 0.25.2",
"jni",
"lazy_static",
"markup5ever_rcdom",
[[package]]
name = "html2text"
-version = "0.3.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de2444cdc9d7e23756d000d9f49513bed8bb4e3743072fb45c63e6493e277bed"
+checksum = "617dbbb43af195e64f03eef3b9e412d8374764d88a554332624d83d782da7267"
dependencies = [
- "html5ever",
- "markup5ever_rcdom",
+ "html5ever 0.26.0",
+ "markup5ever 0.11.0",
+ "tendril",
"unicode-width",
+ "xml5ever 0.17.0",
]
[[package]]
dependencies = [
"log",
"mac",
- "markup5ever",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "markup5ever 0.10.1",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
+]
+
+[[package]]
+name = "html5ever"
+version = "0.26.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7"
+dependencies = [
+ "log",
+ "mac",
+ "markup5ever 0.11.0",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "http-body"
-version = "0.4.4"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6"
+checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
"bytes",
"http",
"pin-project-lite",
]
+[[package]]
+name = "http-range-header"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29"
+
[[package]]
name = "http-signature-normalization"
version = "0.6.0"
[[package]]
name = "httparse"
-version = "1.6.0"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4"
+checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "httpdate"
[[package]]
name = "hyper"
-version = "0.14.18"
+version = "0.14.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2"
+checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
dependencies = [
"bytes",
"futures-channel",
"tokio-native-tls",
]
+[[package]]
+name = "iana-time-zone"
+version = "0.1.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0"
+dependencies = [
+ "android_system_properties",
+ "core-foundation-sys",
+ "js-sys",
+ "wasm-bindgen",
+ "winapi",
+]
+
[[package]]
name = "ident_case"
version = "1.0.1"
"unicode-normalization",
]
+[[package]]
+name = "idna"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
[[package]]
name = "image"
-version = "0.24.2"
+version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28edd9d7bc256be2502e325ac0628bde30b7001b9b52e0abe31a1a9dc2701212"
+checksum = "7e30ca2ecf7666107ff827a8e481de6a132a9b687ed3bb20bb1c144a36c00964"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
- "num-iter",
"num-rational",
"num-traits",
"png",
[[package]]
name = "indexmap"
-version = "1.8.0"
+version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
+checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
[[package]]
name = "inout"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1f03d4ab4d5dc9ec2d219f86c15d2a15fc08239d1cd3b2d6a19717c0a2f443"
+checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
dependencies = [
- "generic-array 0.14.5",
+ "generic-array",
]
[[package]]
[[package]]
name = "ipnet"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c"
+checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]]
name = "itertools"
-version = "0.10.3"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
+checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "itoa"
-version = "1.0.1"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
+checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "jni"
[[package]]
name = "js-sys"
-version = "0.3.56"
+version = "0.3.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
+checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "jsonwebtoken"
-version = "8.0.1"
+version = "8.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "012bb02250fdd38faa5feee63235f7a459974440b9b57593822414c31f92839e"
+checksum = "1aa4b4af834c6cfd35d8763d359661b90f2e45d8f750a0849156c7f4671af09c"
dependencies = [
"base64",
"pem",
"serde",
"serde_json",
"tracing",
- "uuid",
+ "uuid 1.1.2",
]
[[package]]
"task-local-extensions",
"tracing",
"url",
- "uuid",
+ "uuid 1.1.2",
]
[[package]]
"lemmy_websocket",
"opentelemetry 0.17.0",
"opentelemetry-otlp",
- "parking_lot 0.12.0",
+ "parking_lot",
"reqwest",
"reqwest-middleware",
"reqwest-retry",
"tracing-actix-web",
"tracing-error",
"tracing-log",
- "tracing-opentelemetry 0.17.2",
+ "tracing-opentelemetry 0.17.4",
"tracing-subscriber",
"url",
]
"lettre",
"once_cell",
"openssl",
- "parking_lot 0.12.0",
+ "parking_lot",
"rand 0.8.5",
"regex",
"reqwest-middleware",
"tracing",
"tracing-error",
"url",
- "uuid",
+ "uuid 1.1.2",
]
[[package]]
"strum_macros",
"tokio",
"tracing",
- "tracing-opentelemetry 0.17.2",
+ "tracing-opentelemetry 0.17.4",
]
[[package]]
name = "lettre"
-version = "0.10.0-rc.7"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f7e87d9d44162eea7abd87b1a7540fcb10d5e58e8bb4f173178f3dc6e453944"
+checksum = "2eabca5e0b4d0e98e7f2243fb5b7520b6af2b65d8f87bcc86f2c75185a6ff243"
dependencies = [
"base64",
"email-encoding",
"futures-util",
"hostname",
"httpdate",
- "idna",
+ "idna 0.2.3",
"mime",
"native-tls",
"nom 7.1.1",
[[package]]
name = "libc"
-version = "0.2.121"
+version = "0.2.133"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
+checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966"
[[package]]
name = "local-channel"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6246c68cf195087205a0512559c97e15eaf95198bf0e206d662092cdcb03fe9f"
+checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c"
dependencies = [
"futures-core",
"futures-sink",
[[package]]
name = "local-waker"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "902eb695eb0591864543cbfbf6d742510642a605a61fc5e97fe6ceb5a30ac4fb"
+checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1"
[[package]]
name = "lock_api"
-version = "0.4.6"
+version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
+checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
dependencies = [
+ "autocfg",
"scopeguard",
]
[[package]]
name = "lodepng"
-version = "3.6.1"
+version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f84e1fdcdbe8b3f0f9caaadb6b86d0e0647786e993f6ea70686f6837b989ec7"
+checksum = "ff45534ec797452c044fcd47861059eddb501e30a8fd9fdadea7957cdff3ebc7"
dependencies = [
"crc32fast",
"fallible_collections",
[[package]]
name = "log"
-version = "0.4.16"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
+checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]]
-name = "maplit"
-version = "1.0.2"
+name = "markup5ever"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
+checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd"
+dependencies = [
+ "log",
+ "phf 0.8.0",
+ "phf_codegen 0.8.0",
+ "string_cache",
+ "string_cache_codegen",
+ "tendril",
+]
[[package]]
name = "markup5ever"
-version = "0.10.1"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd"
+checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
dependencies = [
"log",
- "phf",
- "phf_codegen",
+ "phf 0.10.1",
+ "phf_codegen 0.10.0",
"string_cache",
"string_cache_codegen",
"tendril",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f015da43bcd8d4f144559a3423f4591d69b8ce0652c905374da7205df336ae2b"
dependencies = [
- "html5ever",
- "markup5ever",
+ "html5ever 0.25.2",
+ "markup5ever 0.10.1",
"tendril",
- "xml5ever",
+ "xml5ever 0.16.2",
]
[[package]]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
+[[package]]
+name = "matchit"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb"
+
[[package]]
name = "memchr"
-version = "2.4.1"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "migrations_internals"
-version = "1.4.1"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b4fc84e4af020b837029e017966f86a1c2d5e83e64b589963d5047525995860"
+checksum = "c493c09323068c01e54c685f7da41a9ccf9219735c3766fbfd6099806ea08fbc"
dependencies = [
- "diesel",
+ "serde",
+ "toml",
]
[[package]]
name = "migrations_macros"
-version = "1.4.2"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c"
+checksum = "8a8ff27a350511de30cdabb77147501c36ef02e0451d957abea2f30caffb2b58"
dependencies = [
"migrations_internals",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
]
[[package]]
[[package]]
name = "miniz_oxide"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
-dependencies = [
- "adler",
- "autocfg",
-]
-
-[[package]]
-name = "miniz_oxide"
-version = "0.5.1"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
+checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
dependencies = [
"adler",
]
[[package]]
name = "mio"
-version = "0.8.2"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9"
+checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [
"libc",
"log",
- "miow",
- "ntapi",
"wasi 0.11.0+wasi-snapshot-preview1",
- "winapi",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
-dependencies = [
- "winapi",
+ "windows-sys",
]
[[package]]
"minimal-lexical",
]
-[[package]]
-name = "ntapi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "num-bigint"
version = "0.4.3"
[[package]]
name = "num-integer"
-version = "0.1.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
-dependencies = [
- "autocfg",
- "num-traits",
-]
-
-[[package]]
-name = "num-iter"
-version = "0.1.42"
+version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
+checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
- "num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
+checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
"autocfg",
"num-integer",
[[package]]
name = "num-traits"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
+checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "num_threads"
-version = "0.1.5"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0"
+checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
dependencies = [
"libc",
]
[[package]]
name = "once_cell"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
-
-[[package]]
-name = "opaque-debug"
-version = "0.2.3"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
+checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
[[package]]
name = "openssl"
-version = "0.10.40"
+version = "0.10.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e"
+checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0"
dependencies = [
"bitflags",
"cfg-if",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "openssl-sys"
-version = "0.9.74"
+version = "0.9.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1"
+checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f"
dependencies = [
"autocfg",
"cc",
"futures-util",
"http",
"opentelemetry 0.17.0",
- "prost",
+ "prost 0.9.0",
"thiserror",
"tokio",
- "tonic",
+ "tonic 0.6.2",
"tonic-build",
]
[[package]]
name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core 0.8.5",
-]
-
-[[package]]
-name = "parking_lot"
-version = "0.12.0"
+version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.1",
+ "parking_lot_core",
]
[[package]]
name = "parking_lot_core"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.9.1"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954"
+checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [
"cfg-if",
"libc",
[[package]]
name = "paste"
-version = "1.0.7"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc"
+checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
[[package]]
name = "pem"
-version = "1.0.2"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947"
+checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4"
dependencies = [
"base64",
]
[[package]]
name = "percent-encoding"
-version = "2.1.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
+checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
-version = "2.1.3"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
+checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048"
dependencies = [
+ "thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
-version = "2.1.0"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
+checksum = "502b62a6d0245378b04ffe0a7fb4f4419a4815fce813bd8a0ec89a56e07d67b1"
dependencies = [
"pest",
"pest_generator",
[[package]]
name = "pest_generator"
-version = "2.1.3"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
+checksum = "451e629bf49b750254da26132f1a5a9d11fd8a95a3df51d15c4abd1ba154cb6c"
dependencies = [
"pest",
"pest_meta",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "pest_meta"
-version = "2.1.3"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
+checksum = "bcec162c71c45e269dfc3fc2916eaeb97feab22993a21bcce4721d08cd7801a6"
dependencies = [
- "maplit",
+ "once_cell",
"pest",
- "sha-1 0.8.2",
+ "sha1",
]
[[package]]
name = "petgraph"
-version = "0.6.0"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
+checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
dependencies = [
"fixedbitset",
"indexmap",
"phf_shared 0.8.0",
]
+[[package]]
+name = "phf"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
+dependencies = [
+ "phf_shared 0.10.0",
+]
+
[[package]]
name = "phf_codegen"
version = "0.8.0"
"phf_shared 0.8.0",
]
+[[package]]
+name = "phf_codegen"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
+dependencies = [
+ "phf_generator 0.10.0",
+ "phf_shared 0.10.0",
+]
+
[[package]]
name = "phf_generator"
version = "0.8.0"
[[package]]
name = "pin-project"
-version = "1.0.10"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e"
+checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.0.10"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb"
+checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "pin-project-lite"
-version = "0.2.8"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
+checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
[[package]]
name = "pin-utils"
[[package]]
name = "pkg-config"
-version = "0.3.24"
+version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
+checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]]
name = "png"
-version = "0.17.5"
+version = "0.17.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba"
+checksum = "8f0e7f4c94ec26ff209cee506314212639d6c91b80afb82984819fafce9df01c"
dependencies = [
"bitflags",
"crc32fast",
- "deflate",
- "miniz_oxide 0.5.1",
+ "flate2",
+ "miniz_oxide",
]
[[package]]
[[package]]
name = "pq-sys"
-version = "0.4.6"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda"
+checksum = "3b845d6d8ec554f972a2c5298aad68953fd64e7441e846075450b44656a016d1"
dependencies = [
"vcpkg",
]
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
"version_check",
]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"version_check",
]
[[package]]
name = "proc-macro2"
-version = "1.0.40"
+version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
+checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
dependencies = [
"unicode-ident",
]
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
dependencies = [
"bytes",
- "prost-derive",
+ "prost-derive 0.9.0",
+]
+
+[[package]]
+name = "prost"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7"
+dependencies = [
+ "bytes",
+ "prost-derive 0.11.0",
]
[[package]]
"log",
"multimap",
"petgraph",
- "prost",
- "prost-types",
+ "prost 0.9.0",
+ "prost-types 0.9.0",
"regex",
"tempfile",
"which",
dependencies = [
"anyhow",
"itertools",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
+]
+
+[[package]]
+name = "prost-derive"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
dependencies = [
"bytes",
- "prost",
+ "prost 0.9.0",
]
[[package]]
-name = "quick-xml"
-version = "0.22.0"
+name = "prost-types"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
+checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e"
dependencies = [
- "encoding_rs",
- "memchr",
+ "bytes",
+ "prost 0.11.0",
]
[[package]]
-name = "quickcheck"
-version = "1.0.3"
+name = "quick-xml"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
+checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
dependencies = [
- "rand 0.8.5",
+ "encoding_rs",
+ "memchr",
]
[[package]]
[[package]]
name = "quote"
-version = "1.0.20"
+version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
+checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
- "proc-macro2 1.0.40",
+ "proc-macro2 1.0.43",
]
[[package]]
[[package]]
name = "r2d2"
-version = "0.8.9"
+version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f"
+checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"
dependencies = [
"log",
- "parking_lot 0.11.2",
+ "parking_lot",
"scheduled-thread-pool",
]
dependencies = [
"libc",
"rand_chacha 0.3.1",
- "rand_core 0.6.3",
+ "rand_core 0.6.4",
]
[[package]]
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
- "rand_core 0.6.3",
+ "rand_core 0.6.4",
]
[[package]]
[[package]]
name = "rand_core"
-version = "0.6.3"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.6",
+ "getrandom 0.2.7",
]
[[package]]
[[package]]
name = "redox_syscall"
-version = "0.2.12"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0"
+checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_users"
-version = "0.4.2"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55"
+checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
- "getrandom 0.2.6",
+ "getrandom 0.2.7",
"redox_syscall",
"thiserror",
]
[[package]]
name = "regex"
-version = "1.5.5"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
+checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
dependencies = [
"aho-corasick",
"memchr",
[[package]]
name = "regex-syntax"
-version = "0.6.25"
+version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "remove_dir_all"
[[package]]
name = "reqwest"
-version = "0.11.10"
+version = "0.11.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb"
+checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc"
dependencies = [
"base64",
"bytes",
"hyper-tls",
"ipnet",
"js-sys",
- "lazy_static",
"log",
"mime",
"mime_guess",
"native-tls",
+ "once_cell",
"percent-encoding",
"pin-project-lite",
"serde",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
- "tokio-util 0.6.9",
+ "tokio-util 0.7.4",
+ "tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
[[package]]
name = "reqwest-tracing"
-version = "0.2.1"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03f32bd53de59d66d157bd974bafbb69fbb9e98f665d14218b5b991e7dba8d75"
+checksum = "64977f9a47fa7768cc88751e29026e569730ac1667c2eaeaac04b32624849fbe"
dependencies = [
"async-trait",
"opentelemetry 0.16.0",
[[package]]
name = "rgb"
-version = "0.8.32"
+version = "0.8.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e74fdc210d8f24a7dbfedc13b04ba5764f5232754ccebfdf5fff1bad791ccbc6"
+checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3"
dependencies = [
"bytemuck",
]
dependencies = [
"convert_case",
"lazy_static",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"regex",
"tinyjson",
]
[[package]]
name = "rss"
-version = "2.0.0"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36e19e299f301be17927a7c05b8fa1c621e3227e6c3a0da65492701642901ff7"
+checksum = "acaf1331b7fc4edc3c2920819fee1766c27e8d40da593155832db3d6dea64e92"
dependencies = [
"atom_syndication",
"derive_builder 0.10.2",
[[package]]
name = "rustls"
-version = "0.20.4"
+version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921"
+checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
dependencies = [
"log",
"ring",
[[package]]
name = "rustversion"
-version = "1.0.6"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
+checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
[[package]]
name = "ryu"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
+checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "same-file"
[[package]]
name = "schannel"
-version = "0.1.19"
+version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
+checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2"
dependencies = [
"lazy_static",
- "winapi",
+ "windows-sys",
]
[[package]]
name = "scheduled-thread-pool"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7"
+checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf"
dependencies = [
- "parking_lot 0.11.2",
+ "parking_lot",
]
[[package]]
[[package]]
name = "security-framework"
-version = "2.6.1"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
+checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
dependencies = [
"bitflags",
"core-foundation",
checksum = "8ee061f90afcc8678bef7a78d0d121683f0ba753f740ff7005f833ec445876b7"
dependencies = [
"bit-set",
- "html5ever",
+ "html5ever 0.25.2",
"markup5ever_rcdom",
]
[[package]]
name = "semver"
-version = "1.0.7"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
+checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
[[package]]
name = "serde"
-version = "1.0.137"
+version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
+checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.137"
+version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
+checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "serde_json"
-version = "1.0.81"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
+checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"indexmap",
"itoa",
checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082"
dependencies = [
"darling 0.13.4",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "serial_test"
-version = "0.6.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5bcc41d18f7a1d50525d080fd3e953be87c4f9f1a974f3c21798ca00d54ec15"
+checksum = "92761393ee4dc3ff8f4af487bd58f4307c9329bbedea02cac0089ad9c411e153"
dependencies = [
+ "dashmap",
+ "futures",
"lazy_static",
- "parking_lot 0.11.2",
+ "log",
+ "parking_lot",
"serial_test_derive",
]
[[package]]
name = "serial_test_derive"
-version = "0.6.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8"
+checksum = "4b6f5d1c3087fb119617cff2966fe3808a80e5eb59a8c1601d5994d66f4346a5"
dependencies = [
"proc-macro-error",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "rustversion",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
-name = "sha-1"
-version = "0.8.2"
+name = "sha1"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
-dependencies = [
- "block-buffer 0.7.3",
- "digest 0.8.1",
- "fake-simd",
- "opaque-debug",
-]
-
-[[package]]
-name = "sha-1"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
+checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.3",
+ "digest",
]
[[package]]
name = "sha2"
-version = "0.10.2"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
+checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.3",
+ "digest",
]
[[package]]
[[package]]
name = "simple_asn1"
-version = "0.6.1"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a762b1c38b9b990c694b9c2f8abe3372ce6a9ceaae6bca39cfc46e054f45745"
+checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085"
dependencies = [
"num-bigint",
"num-traits",
"thiserror",
- "time 0.3.9",
+ "time 0.3.14",
]
[[package]]
[[package]]
name = "slab"
-version = "0.4.5"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
+checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
+dependencies = [
+ "autocfg",
+]
[[package]]
name = "smallvec"
-version = "1.8.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
+checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
[[package]]
name = "smart-default"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "socket2"
-version = "0.4.4"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
+checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
dependencies = [
"libc",
"winapi",
dependencies = [
"new_debug_unreachable",
"once_cell",
- "parking_lot 0.12.0",
+ "parking_lot",
"phf_shared 0.10.0",
"precomputed-hash",
"serde",
dependencies = [
"phf_generator 0.10.0",
"phf_shared 0.10.0",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
]
[[package]]
[[package]]
name = "strum"
-version = "0.24.0"
+version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e96acfc1b70604b8b2f1ffa4c57e59176c7dbb05d556c71ecd2f5498a1dee7f8"
+checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
[[package]]
name = "strum_macros"
-version = "0.24.0"
+version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6878079b17446e4d3eba6192bb0a2950d5b14f0ed8424b852310e5a94345d0ef"
+checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
dependencies = [
"heck 0.4.0",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"rustversion",
- "syn 1.0.98",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "syn"
-version = "1.0.98"
+version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
+checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
"unicode-ident",
]
+[[package]]
+name = "sync_wrapper"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"
+
[[package]]
name = "tap"
version = "1.0.1"
[[package]]
name = "task-local-extensions"
-version = "0.1.1"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36794203e10c86e5998179e260869d156e0674f02d5451b4a3fb9fd86d02aaab"
+checksum = "4167afbec18ae012de40f8cf1b9bf48420abb390678c34821caa07d924941cc4"
dependencies = [
"tokio",
]
[[package]]
name = "thiserror"
-version = "1.0.31"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
+checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.31"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
+checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "time"
-version = "0.3.9"
+version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd"
+checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
dependencies = [
"itoa",
"libc",
"num_threads",
- "quickcheck",
"serde",
"time-macros",
]
[[package]]
name = "tinyjson"
-version = "2.3.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a8304da9f9370f6a6f9020b7903b044aa9ce3470f300a1fba5bc77c78145a16"
+checksum = "b4b2f023483085707f4f0c1238a8a7baf8b502a1d427b9ed2a243884d3d687bb"
[[package]]
name = "tinyvec"
-version = "1.5.1"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tokio"
-version = "1.17.0"
+version = "1.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
+checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95"
dependencies = [
+ "autocfg",
"bytes",
"libc",
"memchr",
"mio",
"num_cpus",
"once_cell",
- "parking_lot 0.12.0",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
[[package]]
name = "tokio-macros"
-version = "1.7.0"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
+checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "tokio-rustls"
-version = "0.23.3"
+version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4151fda0cf2798550ad0b34bcfc9b9dcc2a9d2471c895c68f3a8818e54f2389e"
+checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls",
"tokio",
[[package]]
name = "tokio-stream"
-version = "0.1.8"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3"
+checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af"
dependencies = [
"futures-core",
"pin-project-lite",
[[package]]
name = "tokio-util"
-version = "0.6.9"
+version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
+checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"
dependencies = [
"bytes",
"futures-core",
[[package]]
name = "tokio-util"
-version = "0.7.1"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
+checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
dependencies = [
"bytes",
"futures-core",
"tracing",
]
+[[package]]
+name = "toml"
+version = "0.5.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "tonic"
version = "0.6.2"
"hyper-timeout",
"percent-encoding",
"pin-project",
- "prost",
- "prost-derive",
+ "prost 0.9.0",
+ "prost-derive 0.9.0",
"tokio",
"tokio-stream",
- "tokio-util 0.6.9",
+ "tokio-util 0.6.10",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+ "tracing-futures",
+]
+
+[[package]]
+name = "tonic"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11cd56bdb54ef93935a6a79dbd1d91f1ebd4c64150fd61654031fd6b8b775c91"
+dependencies = [
+ "async-stream",
+ "async-trait",
+ "axum",
+ "base64",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "h2",
+ "http",
+ "http-body",
+ "hyper",
+ "hyper-timeout",
+ "percent-encoding",
+ "pin-project",
+ "prost 0.11.0",
+ "prost-derive 0.11.0",
+ "tokio",
+ "tokio-stream",
+ "tokio-util 0.7.4",
"tower",
"tower-layer",
"tower-service",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
dependencies = [
- "proc-macro2 1.0.40",
+ "proc-macro2 1.0.43",
"prost-build",
- "quote 1.0.20",
- "syn 1.0.98",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "tower"
-version = "0.4.12"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e"
+checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
"rand 0.8.5",
"slab",
"tokio",
- "tokio-util 0.7.1",
+ "tokio-util 0.7.4",
"tower-layer",
"tower-service",
"tracing",
]
+[[package]]
+name = "tower-http"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body",
+ "http-range-header",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+]
+
[[package]]
name = "tower-layer"
version = "0.3.1"
[[package]]
name = "tower-service"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
+checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
[[package]]
name = "tracing"
-version = "0.1.35"
+version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
+checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
dependencies = [
"cfg-if",
"log",
[[package]]
name = "tracing-actix-web"
-version = "0.5.1"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99bcebac55fba44eadf75a424ee403e756f9165596a613d125876388e5fb4c34"
+checksum = "ee7247a77b494ee07bda43bce40a33e76f885662f11b3dda9894ecfdbe31fa06"
dependencies = [
"actix-web",
"pin-project",
"tracing",
- "tracing-futures",
- "uuid",
+ "uuid 1.1.2",
]
[[package]]
name = "tracing-attributes"
-version = "0.1.20"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b"
+checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
name = "tracing-core"
-version = "0.1.27"
+version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921"
+checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
dependencies = [
"once_cell",
"valuable",
[[package]]
name = "tracing-log"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
+checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
dependencies = [
"lazy_static",
"log",
[[package]]
name = "tracing-opentelemetry"
-version = "0.17.2"
+version = "0.17.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f9378e96a9361190ae297e7f3a8ff644aacd2897f244b1ff81f381669196fa6"
+checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f"
dependencies = [
+ "once_cell",
"opentelemetry 0.17.0",
"tracing",
"tracing-core",
[[package]]
name = "tracing-subscriber"
-version = "0.3.9"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce"
+checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b"
dependencies = [
"ansi_term",
- "lazy_static",
"matchers",
+ "once_cell",
"regex",
"sharded-slab",
"smallvec",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
-[[package]]
-name = "twoway"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c57ffb460d7c24cd6eda43694110189030a3d1dfe418416d9468fd1c1d290b47"
-dependencies = [
- "memchr",
- "unchecked-index",
-]
-
[[package]]
name = "typed-arena"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
]
[[package]]
[[package]]
name = "ucd-trie"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
-
-[[package]]
-name = "unchecked-index"
-version = "0.2.2"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c"
+checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]]
name = "unicase"
[[package]]
name = "unicode-bidi"
-version = "0.3.7"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
+checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-ident"
-version = "1.0.1"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
+checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
[[package]]
name = "unicode-normalization"
-version = "0.1.19"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-segmentation"
-version = "1.9.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
+checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
[[package]]
name = "unicode-width"
-version = "0.1.9"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
+checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "unicode-xid"
[[package]]
name = "url"
-version = "2.2.2"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
+checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
- "idna",
- "matches",
+ "idna 0.3.0",
"percent-encoding",
"serde",
]
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
- "getrandom 0.2.6",
+ "getrandom 0.2.7",
+ "serde",
+]
+
+[[package]]
+name = "uuid"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
+dependencies = [
+ "getrandom 0.2.7",
"serde",
]
[[package]]
name = "wasm-bindgen"
-version = "0.2.79"
+version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
+checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.79"
+version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
+checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
dependencies = [
"bumpalo",
- "lazy_static",
"log",
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "once_cell",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.29"
+version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395"
+checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
dependencies = [
"cfg-if",
"js-sys",
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.79"
+version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
+checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
dependencies = [
- "quote 1.0.20",
+ "quote 1.0.21",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.79"
+version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
+checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
dependencies = [
- "proc-macro2 1.0.40",
- "quote 1.0.20",
- "syn 1.0.98",
+ "proc-macro2 1.0.43",
+ "quote 1.0.21",
+ "syn 1.0.100",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.79"
+version = "0.2.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
+checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
[[package]]
name = "web-sys"
-version = "0.3.56"
+version = "0.3.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
+checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
dependencies = [
"js-sys",
"wasm-bindgen",
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d03ebca8fe2492fffdb5be0f681a942665c50488348d8abc00efb470e0ea890"
dependencies = [
- "html5ever",
+ "html5ever 0.25.2",
"markup5ever_rcdom",
"serde",
"serde_json",
[[package]]
name = "webpki-roots"
-version = "0.22.2"
+version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "552ceb903e957524388c4d3475725ff2c8b7960922063af6ce53c9a43da07449"
+checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf"
dependencies = [
"webpki",
]
[[package]]
name = "which"
-version = "4.2.5"
+version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae"
+checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
dependencies = [
"either",
- "lazy_static",
"libc",
+ "once_cell",
]
[[package]]
[[package]]
name = "windows-sys"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6"
+checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
[[package]]
name = "windows_aarch64_msvc"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5"
+checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_i686_gnu"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615"
+checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_msvc"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172"
+checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc"
+checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.32.0"
+version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316"
+checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "winreg"
dependencies = [
"log",
"mac",
- "markup5ever",
+ "markup5ever 0.10.1",
"time 0.1.44",
]
+[[package]]
+name = "xml5ever"
+version = "0.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4034e1d05af98b51ad7214527730626f019682d797ba38b51689212118d8e650"
+dependencies = [
+ "log",
+ "mac",
+ "markup5ever 0.11.0",
+]
+
[[package]]
name = "zeroize"
-version = "1.5.4"
+version = "1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7eb5728b8afd3f280a869ce1d4c554ffaed35f45c231fc41bfbd0381bef50317"
+checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f"
lemmy_websocket = { version = "=0.16.5", path = "./crates/websocket" }
lemmy_routes = { version = "=0.16.5", path = "./crates/routes" }
activitypub_federation = "0.2.0"
-diesel = "1.4.8"
-diesel_migrations = "1.4.0"
-serde = { version = "1.0.136", features = ["derive"] }
+diesel = "2.0.0"
+diesel_migrations = "2.0.0"
+serde = { version = "1.0.145", features = ["derive"] }
actix = "0.13.0"
-actix-web = { version = "4.0.1", default-features = false, features = ["macros", "rustls"] }
-tracing = "0.1.32"
-tracing-actix-web = { version = "0.5.1", default-features = false }
+actix-web = { version = "4.2.1", default-features = false, features = ["macros", "rustls"] }
+tracing = "0.1.36"
+tracing-actix-web = { version = "0.6.1", default-features = false }
tracing-error = "0.2.0"
-tracing-log = "0.1.2"
-tracing-subscriber = { version = "0.3.9", features = ["env-filter"] }
-url = { version = "2.2.2", features = ["serde"] }
-reqwest = { version = "0.11.10", features = ["json"] }
-reqwest-middleware = "0.1.5"
-reqwest-tracing = "0.2.1"
+tracing-log = "0.1.3"
+tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
+url = { version = "2.3.1", features = ["serde"] }
+reqwest = { version = "0.11.12", features = ["json"] }
+reqwest-middleware = "0.1.6"
+reqwest-tracing = "0.3.1"
clokwerk = "0.3.5"
doku = { version = "0.12.0", features = ["url-2"] }
-parking_lot = "0.12.0"
+parking_lot = "0.12.1"
reqwest-retry = "0.1.5"
-console-subscriber = { version = "0.1.3", optional = true }
+console-subscriber = { version = "0.1.8", optional = true }
opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true }
opentelemetry-otlp = { version = "0.10.0", optional = true }
tracing-opentelemetry = { version = "0.17.2", optional = true }
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.2.0"
-diesel = "1.4.8"
-bcrypt = "0.12.1"
-chrono = { version = "0.4.19", features = ["serde"], default-features = false }
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
-serde = { version = "1.0.136", features = ["derive"] }
-actix-web = { version = "4.0.1", default-features = false }
+diesel = "2.0.0"
+bcrypt = "0.13.0"
+chrono = { version = "0.4.22", features = ["serde"], default-features = false }
+serde_json = { version = "1.0.85", features = ["preserve_order"] }
+serde = { version = "1.0.145", features = ["derive"] }
+actix-web = { version = "4.2.1", default-features = false }
base64 = "0.13.0"
-uuid = { version = "0.8.2", features = ["serde", "v4"] }
-async-trait = "0.1.53"
+uuid = { version = "1.1.2", features = ["serde", "v4"] }
+async-trait = "0.1.57"
captcha = "0.0.9"
-anyhow = "1.0.56"
-tracing = "0.1.32"
+anyhow = "1.0.65"
+tracing = "0.1.36"
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
let like_form2 = like_form.clone();
- let like = move |conn: &'_ _| CommentLike::like(conn, &like_form2);
+ let like = move |conn: &mut _| CommentLike::like(conn, &like_form2);
blocking(context.pool(), like)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
};
if data.save {
- let save_comment = move |conn: &'_ _| CommentSaved::save(conn, &comment_saved_form);
+ let save_comment = move |conn: &mut _| CommentSaved::save(conn, &comment_saved_form);
blocking(context.pool(), save_comment)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_save_comment"))?;
} else {
- let unsave_comment = move |conn: &'_ _| CommentSaved::unsave(conn, &comment_saved_form);
+ let unsave_comment = move |conn: &mut _| CommentSaved::unsave(conn, &comment_saved_form);
blocking(context.pool(), unsave_comment)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_save_comment"))?;
is_mod_or_admin(context.pool(), person_id, report.community.id).await?;
let resolved = data.resolved;
- let resolve_fun = move |conn: &'_ _| {
+ let resolve_fun = move |conn: &mut _| {
if resolved {
CommentReport::resolve(conn, report_id, person_id)
} else {
person_id: data.person_id,
};
if data.added {
- let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
+ let join = move |conn: &mut _| CommunityModerator::join(conn, &community_moderator_form);
blocking(context.pool(), join)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
} else {
- let leave = move |conn: &'_ _| CommunityModerator::leave(conn, &community_moderator_form);
+ let leave = move |conn: &mut _| CommunityModerator::leave(conn, &community_moderator_form);
blocking(context.pool(), leave)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
expires: Some(expires),
};
- let community: ApubCommunity = blocking(context.pool(), move |conn: &'_ _| {
+ let community: ApubCommunity = blocking(context.pool(), move |conn: &mut _| {
Community::read(conn, community_id)
})
.await??
.into();
- let banned_person: ApubPerson = blocking(context.pool(), move |conn: &'_ _| {
+ let banned_person: ApubPerson = blocking(context.pool(), move |conn: &mut _| {
Person::read(conn, banned_person_id)
})
.await??
.into();
if data.ban {
- let ban = move |conn: &'_ _| CommunityPersonBan::ban(conn, &community_user_ban_form);
+ let ban = move |conn: &mut _| CommunityPersonBan::ban(conn, &community_user_ban_form);
blocking(context.pool(), ban)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_user_already_banned"))?;
person_id: banned_person_id,
pending: false,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
CommunityFollower::unfollow(conn, &community_follower_form)
})
.await?
)
.await?;
} else {
- let unban = move |conn: &'_ _| CommunityPersonBan::unban(conn, &community_user_ban_form);
+ let unban = move |conn: &mut _| CommunityPersonBan::unban(conn, &community_user_ban_form);
blocking(context.pool(), unban)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_user_already_banned"))?;
};
if data.block {
- let block = move |conn: &'_ _| CommunityBlock::block(conn, &community_block_form);
+ let block = move |conn: &mut _| CommunityBlock::block(conn, &community_block_form);
blocking(context.pool(), block)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_block_already_exists"))?;
person_id,
pending: false,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
CommunityFollower::unfollow(conn, &community_follower_form)
})
.await?
.await??;
UndoFollowCommunity::send(&local_user_view.person.into(), &community.into(), context).await?;
} else {
- let unblock = move |conn: &'_ _| CommunityBlock::unblock(conn, &community_block_form);
+ let unblock = move |conn: &mut _| CommunityBlock::unblock(conn, &community_block_form);
blocking(context.pool(), unblock)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_block_already_exists"))?;
check_community_ban(local_user_view.person.id, community_id, context.pool()).await?;
check_community_deleted_or_removed(community_id, context.pool()).await?;
- let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
+ let follow = move |conn: &mut _| CommunityFollower::follow(conn, &community_follower_form);
blocking(context.pool(), follow)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
} else {
let unfollow =
- move |conn: &'_ _| CommunityFollower::unfollow(conn, &community_follower_form);
+ move |conn: &mut _| CommunityFollower::unfollow(conn, &community_follower_form);
blocking(context.pool(), unfollow)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
} else {
UndoFollowCommunity::send(&local_user_view.person.clone().into(), &community, context)
.await?;
- let unfollow = move |conn: &'_ _| CommunityFollower::unfollow(conn, &community_follower_form);
+ let unfollow =
+ move |conn: &mut _| CommunityFollower::unfollow(conn, &community_follower_form);
blocking(context.pool(), unfollow)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
person_id: cmod.moderator.id,
};
- let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
+ let join = move |conn: &mut _| CommunityModerator::join(conn, &community_moderator_form);
blocking(context.pool(), join)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
#[test]
fn test_should_not_validate_user_token_after_password_change() {
- let conn = establish_unpooled_connection();
- let secret = Secret::init(&conn).unwrap();
+ let conn = &mut establish_unpooled_connection();
+ let secret = Secret::init(conn).unwrap();
let settings = &SETTINGS.to_owned();
let new_person = PersonForm {
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let local_user_form = LocalUserForm {
person_id: Some(inserted_person.id),
..LocalUserForm::default()
};
- let inserted_local_user = LocalUser::create(&conn, &local_user_form).unwrap();
+ let inserted_local_user = LocalUser::create(conn, &local_user_form).unwrap();
let jwt = Claims::jwt(
inserted_local_user.id.0,
// The check should fail, since the validator time is now newer than the jwt issue time
let updated_local_user =
- LocalUser::update_password(&conn, inserted_local_user.id, "password111").unwrap();
+ LocalUser::update_password(conn, inserted_local_user.id, "password111").unwrap();
let check_after = check_validator_time(&updated_local_user.validator_time, &claims);
assert!(check_after.is_err());
- let num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, num_deleted);
}
}
let banned_person_id = data.person_id;
let expires = data.expires.map(naive_from_unix);
- let ban_person = move |conn: &'_ _| Person::ban_person(conn, banned_person_id, ban, expires);
+ let ban_person = move |conn: &mut _| Person::ban_person(conn, banned_person_id, ban, expires);
let person = blocking(context.pool(), ban_person)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_user"))?;
}
if data.block {
- let block = move |conn: &'_ _| PersonBlock::block(conn, &person_block_form);
+ let block = move |conn: &mut _| PersonBlock::block(conn, &person_block_form);
blocking(context.pool(), block)
.await?
.map_err(|e| LemmyError::from_error_message(e, "person_block_already_exists"))?;
} else {
- let unblock = move |conn: &'_ _| PersonBlock::unblock(conn, &person_block_form);
+ let unblock = move |conn: &mut _| PersonBlock::unblock(conn, &person_block_form);
blocking(context.pool(), unblock)
.await?
.map_err(|e| LemmyError::from_error_message(e, "person_block_already_exists"))?;
let person_mention_id = read_person_mention.id;
let read = data.read;
let update_mention =
- move |conn: &'_ _| PersonMention::update_read(conn, person_mention_id, read);
+ move |conn: &mut _| PersonMention::update_read(conn, person_mention_id, read);
blocking(context.pool(), update_mention)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_comment"))?;
let comment_reply_id = read_comment_reply.id;
let read = data.read;
- let update_reply = move |conn: &'_ _| CommentReply::update_read(conn, comment_reply_id, read);
+ let update_reply = move |conn: &mut _| CommentReply::update_read(conn, comment_reply_id, read);
blocking(context.pool(), update_reply)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_comment"))?;
let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1);
if do_add {
let like_form2 = like_form.clone();
- let like = move |conn: &'_ _| PostLike::like(conn, &like_form2);
+ let like = move |conn: &mut _| PostLike::like(conn, &like_form2);
blocking(context.pool(), like)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
};
if data.save {
- let save = move |conn: &'_ _| PostSaved::save(conn, &post_saved_form);
+ let save = move |conn: &mut _| PostSaved::save(conn, &post_saved_form);
blocking(context.pool(), save)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_save_post"))?;
} else {
- let unsave = move |conn: &'_ _| PostSaved::unsave(conn, &post_saved_form);
+ let unsave = move |conn: &mut _| PostSaved::unsave(conn, &post_saved_form);
blocking(context.pool(), unsave)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_save_post"))?;
is_mod_or_admin(context.pool(), person_id, report.community.id).await?;
let resolved = data.resolved;
- let resolve_fun = move |conn: &'_ _| {
+ let resolve_fun = move |conn: &mut _| {
if resolved {
PostReport::resolve(conn, report_id, person_id)
} else {
let resolved = self.resolved;
let report_id = self.report_id;
let person_id = local_user_view.person.id;
- let resolve_fn = move |conn: &'_ _| {
+ let resolve_fn = move |conn: &mut _| {
if resolved {
PrivateMessageReport::resolve(conn, report_id, person_id)
} else {
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", default-features = false }
lemmy_utils = { version = "=0.16.5", path = "../utils", optional = true }
-serde = { version = "1.0.136", features = ["derive"] }
-url = "2.2.2"
-actix-web = { version = "4.0.1", default-features = false, features = ["cookies"], optional = true }
-chrono = { version = "0.4.19", features = ["serde"], optional = true }
-diesel = { version = "1.4.8", optional = true }
-tracing = { version = "0.1.32", optional = true }
+serde = { version = "1.0.145", features = ["derive"] }
+url = "2.3.1"
+actix-web = { version = "4.2.1", default-features = false, features = ["cookies"], optional = true }
+chrono = { version = "0.4.22", features = ["serde"], optional = true }
+diesel = { version = "2.0.0", optional = true }
+tracing = { version = "0.1.36", optional = true }
rosetta-i18n = { version = "0.1.2", optional = true }
-percent-encoding = { version = "2.1.0", optional = true }
+percent-encoding = { version = "2.2.0", optional = true }
encoding = { version = "0.2.33", optional = true }
-reqwest-middleware = { version = "0.1.5", optional = true }
+reqwest-middleware = { version = "0.1.6", optional = true }
webpage = { version = "1.4.0", default-features = false, features = ["serde"], optional = true }
[dev-dependencies]
actix-rt = { version = "2.7.0", default-features = false }
-reqwest = { version = "0.11.10", features = ["json"] }
+reqwest = { version = "0.11.12", features = ["json"] }
pub metadata: SiteMetadata,
}
-#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)]
+#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
pub struct SiteMetadata {
pub title: Option<String>,
pub description: Option<String>,
pub async fn blocking<F, T>(pool: &DbPool, f: F) -> Result<T, LemmyError>
where
- F: FnOnce(&diesel::PgConnection) -> T + Send + 'static,
+ F: FnOnce(&mut diesel::PgConnection) -> T + Send + 'static,
T: Send + 'static,
{
let pool = pool.clone();
let blocking_span = tracing::info_span!("blocking operation");
actix_web::web::block(move || {
let entered = blocking_span.enter();
- let conn = pool.get()?;
- let res = (f)(&conn);
+ let mut conn = pool.get()?;
+ let res = (f)(&mut conn);
drop(entered);
Ok(res) as Result<T, LemmyError>
})
pool: &DbPool,
) -> Result<(), LemmyError> {
let is_banned =
- move |conn: &'_ _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
+ move |conn: &mut _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
if blocking(pool, is_banned).await? {
Err(LemmyError::from_message("community_ban"))
} else {
potential_blocker_id: PersonId,
pool: &DbPool,
) -> Result<(), LemmyError> {
- let is_blocked = move |conn: &'_ _| PersonBlock::read(conn, potential_blocker_id, my_id).is_ok();
+ let is_blocked = move |conn: &mut _| PersonBlock::read(conn, potential_blocker_id, my_id).is_ok();
if blocking(pool, is_blocked).await? {
Err(LemmyError::from_message("person_block"))
} else {
settings: &Settings,
client: &ClientWithMiddleware,
) -> Result<(), LemmyError> {
- let posts = blocking(pool, move |conn: &'_ _| {
+ let posts = blocking(pool, move |conn: &mut _| {
Post::fetch_pictrs_posts_for_creator(conn, banned_person_id)
})
.await??;
settings: &Settings,
client: &ClientWithMiddleware,
) -> Result<(), LemmyError> {
- let posts = blocking(pool, move |conn: &'_ _| {
+ let posts = blocking(pool, move |conn: &mut _| {
Post::fetch_pictrs_posts_for_community(conn, banned_community_id)
})
.await??;
.await??;
// Posts
- blocking(pool, move |conn: &'_ _| {
+ blocking(pool, move |conn: &mut _| {
Post::update_removed_for_creator(conn, banned_person_id, None, true)
})
.await??;
// Communities
// Remove all communities where they're the top mod
// for now, remove the communities manually
- let first_mod_communities = blocking(pool, move |conn: &'_ _| {
+ let first_mod_communities = blocking(pool, move |conn: &mut _| {
CommunityModeratorView::get_community_first_mods(conn)
})
.await??;
for first_mod_community in banned_user_first_communities {
let community_id = first_mod_community.community.id;
- blocking(pool, move |conn: &'_ _| {
+ blocking(pool, move |conn: &mut _| {
Community::update_removed(conn, community_id, true)
})
.await??;
}
// Comments
- blocking(pool, move |conn: &'_ _| {
+ blocking(pool, move |conn: &mut _| {
Comment::update_removed_for_creator(conn, banned_person_id, true)
})
.await??;
// No need to update avatar and banner, those are handled in Person::delete_account
// Comments
- let permadelete = move |conn: &'_ _| Comment::permadelete_for_creator(conn, person_id);
+ let permadelete = move |conn: &mut _| Comment::permadelete_for_creator(conn, person_id);
blocking(pool, permadelete)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_comment"))?;
// Posts
- let permadelete = move |conn: &'_ _| Post::permadelete_for_creator(conn, person_id);
+ let permadelete = move |conn: &mut _| Post::permadelete_for_creator(conn, person_id);
blocking(pool, permadelete)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_post"))?;
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.2.0"
-bcrypt = "0.12.1"
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
-serde = { version = "1.0.136", features = ["derive"] }
-actix-web = { version = "4.0.1", default-features = false }
-tracing = "0.1.32"
-url = { version = "2.2.2", features = ["serde"] }
-async-trait = "0.1.53"
+bcrypt = "0.13.0"
+serde_json = { version = "1.0.85", features = ["preserve_order"] }
+serde = { version = "1.0.145", features = ["derive"] }
+actix-web = { version = "4.2.1", default-features = false }
+tracing = "0.1.36"
+url = { version = "2.3.1", features = ["serde"] }
+async-trait = "0.1.57"
webmention = "0.4.0"
score: 1,
};
- let like = move |conn: &'_ _| CommentLike::like(conn, &like_form);
+ let like = move |conn: &mut _| CommentLike::like(conn, &like_form);
blocking(context.pool(), like)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_comment"))?;
person_id: local_user_view.person.id,
};
- let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
+ let join = move |conn: &mut _| CommunityModerator::join(conn, &community_moderator_form);
blocking(context.pool(), join)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_moderator_already_exists"))?;
pending: false,
};
- let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
+ let follow = move |conn: &mut _| CommunityFollower::follow(conn, &community_follower_form);
blocking(context.pool(), follow)
.await?
.map_err(|e| LemmyError::from_error_message(e, "community_follower_already_exists"))?;
score: 1,
};
- let like = move |conn: &'_ _| PostLike::like(conn, &like_form);
+ let like = move |conn: &mut _| PostLike::like(conn, &like_form);
blocking(context.pool(), like)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_like_post"))?;
..SiteForm::default()
};
- let create_site = move |conn: &'_ _| Site::create(conn, &site_form);
+ let create_site = move |conn: &mut _| Site::create(conn, &site_form);
blocking(context.pool(), create_site)
.await?
.map_err(|e| LemmyError::from_error_message(e, "site_already_exists"))?;
let saved_only = data.saved_only;
let show_deleted_and_removed = data.show_deleted_and_removed;
let community_id = data.community_id;
+ let local_user = local_user_view.map(|l| l.local_user);
+ let local_user_clone = local_user.to_owned();
- let (posts, comments) = blocking(context.pool(), move |conn| {
+ let posts = blocking(context.pool(), move |conn| {
let posts_query = PostQuery::builder()
.conn(conn)
+ .local_user(local_user.as_ref())
.sort(sort)
.saved_only(saved_only)
.community_id(community_id)
.page(page)
.limit(limit);
- let local_user = local_user_view.map(|l| l.local_user);
+ // If its saved only, you don't care what creator it was
+ // Or, if its not saved, then you only want it for that specific creator
+ if !saved_only.unwrap_or(false) {
+ posts_query
+ .creator_id(Some(person_details_id))
+ .build()
+ .list()
+ } else {
+ posts_query.build().list()
+ }
+ })
+ .await??;
+
+ let comments = blocking(context.pool(), move |conn| {
let comments_query = CommentQuery::builder()
.conn(conn)
- .local_user(local_user.as_ref())
+ .local_user(local_user_clone.as_ref())
.sort(sort.map(post_to_comment_sort_type))
.saved_only(saved_only)
.show_deleted_and_removed(show_deleted_and_removed)
// If its saved only, you don't care what creator it was
// Or, if its not saved, then you only want it for that specific creator
- let (posts, comments) = if !saved_only.unwrap_or(false) {
- (
- posts_query
- .creator_id(Some(person_details_id))
- .build()
- .list()?,
- comments_query
- .creator_id(Some(person_details_id))
- .build()
- .list()?,
- )
+ if !saved_only.unwrap_or(false) {
+ comments_query
+ .creator_id(Some(person_details_id))
+ .build()
+ .list()
} else {
- (posts_query.build().list()?, comments_query.build().list()?)
- };
-
- Ok((posts, comments)) as Result<_, LemmyError>
+ comments_query.build().list()
+ }
})
.await??;
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.2.0"
-diesel = "1.4.8"
+diesel = "2.0.0"
activitystreams-kinds = "0.2.1"
-chrono = { version = "0.4.19", features = ["serde"], default-features = false }
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
-serde = { version = "1.0.136", features = ["derive"] }
-serde_with = "1.12.0"
+chrono = { version = "0.4.22", features = ["serde"], default-features = false }
+serde_json = { version = "1.0.85", features = ["preserve_order"] }
+serde = { version = "1.0.145", features = ["derive"] }
+serde_with = "1.14.0"
actix = "0.13.0"
-actix-web = { version = "4.0.1", default-features = false }
+actix-web = { version = "4.2.1", default-features = false }
actix-rt = { version = "2.7.0", default-features = false }
-tracing = "0.1.32"
-strum_macros = "0.24.0"
-url = { version = "2.2.2", features = ["serde"] }
-http = "0.2.6"
+tracing = "0.1.36"
+strum_macros = "0.24.3"
+url = { version = "2.3.1", features = ["serde"] }
+http = "0.2.8"
http-signature-normalization-actix = { version = "0.6.1", default-features = false, features = ["server", "sha-2"] }
-futures = "0.3.21"
-itertools = "0.10.3"
-uuid = { version = "0.8.2", features = ["serde", "v4"] }
-sha2 = "0.10.2"
-async-trait = "0.1.53"
-anyhow = "1.0.56"
-reqwest = { version = "0.11.10", features = ["json"] }
+futures = "0.3.24"
+itertools = "0.10.5"
+uuid = { version = "1.1.2", features = ["serde", "v4"] }
+sha2 = "0.10.6"
+async-trait = "0.1.57"
+anyhow = "1.0.65"
+reqwest = { version = "0.11.12", features = ["json"] }
html2md = "0.2.13"
-once_cell = "1.10.0"
+once_cell = "1.15.0"
[dev-dependencies]
-serial_test = "0.6.0"
-assert-json-diff = "2.0.1"
-reqwest-middleware = "0.1.5"
-task-local-extensions = "0.1.1"
+serial_test = "0.9.0"
+assert-json-diff = "2.0.2"
+reqwest-middleware = "0.1.6"
+task-local-extensions = "0.1.3"
person_id: blocked_person.id,
pending: false,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
CommunityFollower::unfollow(conn, &community_follower_form)
})
.await?
person_id: blocked_person.id,
expires: None,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
CommunityPersonBan::unban(conn, &community_user_ban_form)
})
.await??;
person_id: comment.creator_id,
score: 1,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
CommentLike::like(conn, &like_form)
})
.await??;
person_id: post.creator_id,
score: 1,
};
- blocking(context.pool(), move |conn: &'_ _| {
+ blocking(context.pool(), move |conn: &mut _| {
PostLike::like(conn, &like_form)
})
.await??;
let person_id = person.id;
let community_id = community.id;
let is_banned =
- move |conn: &'_ _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
+ move |conn: &mut _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
if blocking(context.pool(), is_banned).await? {
return Err(LemmyError::from_message("Person is banned from community"));
}
#[serial]
async fn test_parse_lemmy_community_moderators() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let (new_mod, site) = parse_lemmy_person(&context).await;
let community = parse_lemmy_community(&context).await;
let community_id = community.id;
public_key: Some("pubkey".to_string()),
..PersonForm::default()
};
- let old_mod = Person::create(&context.pool().get().unwrap(), &old_mod).unwrap();
+ let old_mod = Person::create(conn, &old_mod).unwrap();
let community_moderator_form = CommunityModeratorForm {
community_id: community.id,
person_id: old_mod.id,
};
- CommunityModerator::join(&context.pool().get().unwrap(), &community_moderator_form).unwrap();
+ CommunityModerator::join(conn, &community_moderator_form).unwrap();
assert_eq!(site.actor_id.to_string(), "https://enterprise.lemmy.ml/");
assert_eq!(current_moderators.len(), 1);
assert_eq!(current_moderators[0].moderator.id, new_mod.id);
- Person::delete(&*community_context.1.pool().get().unwrap(), old_mod.id).unwrap();
- Person::delete(&*community_context.1.pool().get().unwrap(), new_mod.id).unwrap();
- Community::delete(
- &*community_context.1.pool().get().unwrap(),
- community_context.0.id,
- )
- .unwrap();
- Site::delete(&*community_context.1.pool().get().unwrap(), site.id).unwrap();
+ Person::delete(conn, old_mod.id).unwrap();
+ Person::delete(conn, new_mod.id).unwrap();
+ Community::delete(conn, community_context.0.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
}
Group(Group),
}
-#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub enum PersonOrGroupType {
Person,
Group,
}
fn cleanup(data: (ApubPerson, ApubCommunity, ApubPost, ApubSite), context: &LemmyContext) {
- Post::delete(&*context.pool().get().unwrap(), data.2.id).unwrap();
- Community::delete(&*context.pool().get().unwrap(), data.1.id).unwrap();
- Person::delete(&*context.pool().get().unwrap(), data.0.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), data.3.id).unwrap();
+ let conn = &mut context.pool().get().unwrap();
+ Post::delete(conn, data.2.id).unwrap();
+ Community::delete(conn, data.1.id).unwrap();
+ Person::delete(conn, data.0.id).unwrap();
+ Site::delete(conn, data.3.id).unwrap();
}
#[actix_rt::test]
#[serial]
pub(crate) async fn test_parse_lemmy_comment() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/comment/38741").unwrap();
let data = prepare_comment_test(&url, &context).await;
let to_apub = comment.into_apub(&context).await.unwrap();
assert_json_include!(actual: json, expected: to_apub);
- Comment::delete(&*context.pool().get().unwrap(), comment_id).unwrap();
+ Comment::delete(conn, comment_id).unwrap();
cleanup(data, &context);
}
#[serial]
async fn test_parse_pleroma_comment() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/comment/38741").unwrap();
let data = prepare_comment_test(&url, &context).await;
assert!(!comment.local);
assert_eq!(request_counter, 0);
- Comment::delete(&*context.pool().get().unwrap(), comment.id).unwrap();
+ Comment::delete(conn, comment.id).unwrap();
cleanup(data, &context);
}
#[serial]
async fn test_parse_lemmy_community() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let site = parse_lemmy_instance(&context).await;
let community = parse_lemmy_community(&context).await;
assert!(!community.local);
assert_eq!(community.description.as_ref().unwrap().len(), 132);
- Community::delete(&*context.pool().get().unwrap(), community.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
+ Community::delete(conn, community.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
}
#[serial]
async fn test_parse_lemmy_instance() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let site = parse_lemmy_instance(&context).await;
assert_eq!(site.name, "Enterprise");
assert_eq!(site.description.as_ref().unwrap().len(), 15);
- Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
}
use std::ops::Deref;
use url::Url;
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ApubPerson(DbPerson);
impl Deref for ApubPerson {
#[serial]
async fn test_parse_lemmy_person() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let (person, site) = parse_lemmy_person(&context).await;
assert_eq!(person.display_name, Some("Jean-Luc Picard".to_string()));
assert!(!person.local);
assert_eq!(person.bio.as_ref().unwrap().len(), 39);
- DbPerson::delete(&*context.pool().get().unwrap(), person.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
+ DbPerson::delete(conn, person.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
#[actix_rt::test]
#[serial]
async fn test_parse_pleroma_person() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
// create and parse a fake pleroma instance actor, to avoid network request during test
let mut json: Instance = file_to_json_object("assets/lemmy/objects/instance.json").unwrap();
assert_eq!(request_counter, 0);
assert_eq!(person.bio.as_ref().unwrap().len(), 873);
- DbPerson::delete(&*context.pool().get().unwrap(), person.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
+ DbPerson::delete(conn, person.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
}
#[serial]
async fn test_parse_lemmy_post() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let (person, site) = parse_lemmy_person(&context).await;
let community = parse_lemmy_community(&context).await;
assert!(post.stickied);
assert_eq!(request_counter, 0);
- Post::delete(&*context.pool().get().unwrap(), post.id).unwrap();
- Person::delete(&*context.pool().get().unwrap(), person.id).unwrap();
- Community::delete(&*context.pool().get().unwrap(), community.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), site.id).unwrap();
+ Post::delete(conn, post.id).unwrap();
+ Person::delete(conn, person.id).unwrap();
+ Community::delete(conn, community.id).unwrap();
+ Site::delete(conn, site.id).unwrap();
}
}
}
fn cleanup(data: (ApubPerson, ApubPerson, ApubSite), context: &LemmyContext) {
- Person::delete(&*context.pool().get().unwrap(), data.0.id).unwrap();
- Person::delete(&*context.pool().get().unwrap(), data.1.id).unwrap();
- Site::delete(&*context.pool().get().unwrap(), data.2.id).unwrap();
+ let conn = &mut context.pool().get().unwrap();
+ Person::delete(conn, data.0.id).unwrap();
+ Person::delete(conn, data.1.id).unwrap();
+ Site::delete(conn, data.2.id).unwrap();
}
#[actix_rt::test]
#[serial]
async fn test_parse_lemmy_pm() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/private_message/1621").unwrap();
let data = prepare_comment_test(&url, &context).await;
let json: ChatMessage = file_to_json_object("assets/lemmy/objects/chat_message.json").unwrap();
let to_apub = pm.into_apub(&context).await.unwrap();
assert_json_include!(actual: json, expected: to_apub);
- PrivateMessage::delete(&*context.pool().get().unwrap(), pm_id).unwrap();
+ PrivateMessage::delete(conn, pm_id).unwrap();
cleanup(data, &context);
}
#[serial]
async fn test_parse_pleroma_pm() {
let context = init_context();
+ let conn = &mut context.pool().get().unwrap();
let url = Url::parse("https://enterprise.lemmy.ml/private_message/1621").unwrap();
let data = prepare_comment_test(&url, &context).await;
let pleroma_url = Url::parse("https://queer.hacktivis.me/objects/2").unwrap();
assert_eq!(pm.content.len(), 3);
assert_eq!(request_counter, 0);
- PrivateMessage::delete(&*context.pool().get().unwrap(), pm.id).unwrap();
+ PrivateMessage::delete(conn, pm.id).unwrap();
cleanup(data, &context);
}
}
pub mod following;
pub mod voting;
-#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
pub enum CreateOrUpdateType {
Create,
Update,
pub(crate) unparsed: Unparsed,
}
-#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Debug, Display, Deserialize, Serialize, PartialEq, Eq)]
pub enum VoteType {
Like,
Dislike,
use serde_with::skip_serializing_none;
use url::Url;
-#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum InstanceType {
Application,
Service,
use serde_with::skip_serializing_none;
use url::Url;
-#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum PageType {
Page,
Article,
use serde_with::skip_serializing_none;
use url::Url;
-#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
+#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum UserTypes {
Person,
Service,
--- /dev/null
+[package]
+name = "lemmy_apub_lib"
+version = "0.16.3"
+edition = "2021"
+description = "A link aggregator for the fediverse"
+license = "AGPL-3.0"
+homepage = "https://join-lemmy.org/"
+documentation = "https://join-lemmy.org/docs/en/index.html"
+
+[dependencies]
+lemmy_utils = { version = "=0.16.3", path = "../utils" }
+lemmy_apub_lib_derive = { version = "=0.16.3", path = "../apub_lib_derive" }
+chrono = { version = "0.4.19", default-features = false }
+serde = { version = "1.0.136", features = ["derive"] }
+async-trait = "0.1.53"
+url = { version = "2.2.2", features = ["serde"] }
+serde_json = { version = "1.0.79", features = ["preserve_order"] }
+anyhow = "1.0.56"
+reqwest = { version = "0.11.10", features = ["json"] }
+reqwest-middleware = "0.1.5"
+tracing = "0.1.32"
+base64 = "0.13.0"
+openssl = "0.10.38"
+once_cell = "1.10.0"
+http = "0.2.6"
+sha2 = "0.10.2"
+actix-web = { version = "4.0.1", default-features = false }
+http-signature-normalization-actix = { version = "0.6.1", default-features = false, features = ["server", "sha-2"] }
+http-signature-normalization-reqwest = { version = "0.5.0", default-features = false, features = ["sha-2", "middleware"] }
+background-jobs = "0.12.0"
+diesel = { version = "2.0.0-rc.0", features = ["chrono"] }
"activitypub_federation", "sha2", "regex", "once_cell", "serde_json"]
[dependencies]
-chrono = { version = "0.4.19", features = ["serde"], default-features = false }
-serde = { version = "1.0.136", features = ["derive"] }
-url = { version = "2.2.2", features = ["serde"] }
-strum = "0.24.0"
-strum_macros = "0.24.0"
-serde_json = { version = "1.0.79", features = ["preserve_order"], optional = true }
+chrono = { version = "0.4.22", features = ["serde"], default-features = false }
+serde = { version = "1.0.145", features = ["derive"] }
+url = { version = "2.3.1", features = ["serde"] }
+strum = "0.24.1"
+strum_macros = "0.24.3"
+serde_json = { version = "1.0.85", features = ["preserve_order"], optional = true }
activitypub_federation = { version = "0.2.0", optional = true }
lemmy_utils = { version = "=0.16.5", path = "../utils", optional = true }
-bcrypt = { version = "0.12.1", optional = true }
-diesel = { version = "1.4.8", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
-diesel-derive-newtype = { version = "0.1.2", optional = true }
-diesel_migrations = { version = "1.4.0", optional = true }
-sha2 = { version = "0.10.2", optional = true }
-regex = { version = "1.5.5", optional = true }
-once_cell = { version = "1.10.0", optional = true }
-diesel_ltree = "0.2.7"
+bcrypt = { version = "0.13.0", optional = true }
+diesel = { version = "2.0.0", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
+diesel-derive-newtype = { version = "2.0.0-rc.0", optional = true }
+diesel_migrations = { version = "2.0.0", optional = true }
+sha2 = { version = "0.10.6", optional = true }
+regex = { version = "1.6.0", optional = true }
+once_cell = { version = "1.15.0", optional = true }
+diesel_ltree = "0.3.0"
[dev-dependencies]
-serial_test = "0.6.0"
+serial_test = "0.9.0"
use diesel::{result::Error, *};
impl CommentAggregates {
- pub fn read(conn: &PgConnection, comment_id: CommentId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, comment_id: CommentId) -> Result<Self, Error> {
comment_aggregates::table
.filter(comment_aggregates::comment_id.eq(comment_id))
.first::<Self>(conn)
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy_comment_agg".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_comment_agg".into(),
..PersonForm::default()
};
- let another_inserted_person = Person::create(&conn, &another_person).unwrap();
+ let another_inserted_person = Person::create(conn, &another_person).unwrap();
let new_community = CommunityForm {
name: "TIL_comment_agg".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let child_comment_form = CommentForm {
content: "A test comment".into(),
};
let _inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
let comment_like = CommentLikeForm {
comment_id: inserted_comment.id,
score: 1,
};
- CommentLike::like(&conn, &comment_like).unwrap();
+ CommentLike::like(conn, &comment_like).unwrap();
- let comment_aggs_before_delete = CommentAggregates::read(&conn, inserted_comment.id).unwrap();
+ let comment_aggs_before_delete = CommentAggregates::read(conn, inserted_comment.id).unwrap();
assert_eq!(1, comment_aggs_before_delete.score);
assert_eq!(1, comment_aggs_before_delete.upvotes);
score: -1,
};
- CommentLike::like(&conn, &comment_dislike).unwrap();
+ CommentLike::like(conn, &comment_dislike).unwrap();
- let comment_aggs_after_dislike = CommentAggregates::read(&conn, inserted_comment.id).unwrap();
+ let comment_aggs_after_dislike = CommentAggregates::read(conn, inserted_comment.id).unwrap();
assert_eq!(0, comment_aggs_after_dislike.score);
assert_eq!(1, comment_aggs_after_dislike.upvotes);
assert_eq!(1, comment_aggs_after_dislike.downvotes);
// Remove the first comment like
- CommentLike::remove(&conn, inserted_person.id, inserted_comment.id).unwrap();
- let after_like_remove = CommentAggregates::read(&conn, inserted_comment.id).unwrap();
+ CommentLike::remove(conn, inserted_person.id, inserted_comment.id).unwrap();
+ let after_like_remove = CommentAggregates::read(conn, inserted_comment.id).unwrap();
assert_eq!(-1, after_like_remove.score);
assert_eq!(0, after_like_remove.upvotes);
assert_eq!(1, after_like_remove.downvotes);
// Remove the parent post
- Post::delete(&conn, inserted_post.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
// Should be none found, since the post was deleted
- let after_delete = CommentAggregates::read(&conn, inserted_comment.id);
+ let after_delete = CommentAggregates::read(conn, inserted_comment.id);
assert!(after_delete.is_err());
// This should delete all the associated rows, and fire triggers
- Person::delete(&conn, another_inserted_person.id).unwrap();
- let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ Person::delete(conn, another_inserted_person.id).unwrap();
+ let person_num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, person_num_deleted);
// Delete the community
- let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
+ let community_num_deleted = Community::delete(conn, inserted_community.id).unwrap();
assert_eq!(1, community_num_deleted);
}
}
use diesel::{result::Error, *};
impl CommunityAggregates {
- pub fn read(conn: &PgConnection, community_id: CommunityId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, community_id: CommunityId) -> Result<Self, Error> {
community_aggregates::table
.filter(community_aggregates::community_id.eq(community_id))
.first::<Self>(conn)
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy_community_agg".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_community_agg".into(),
..PersonForm::default()
};
- let another_inserted_person = Person::create(&conn, &another_person).unwrap();
+ let another_inserted_person = Person::create(conn, &another_person).unwrap();
let new_community = CommunityForm {
name: "TIL_community_agg".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let another_community = CommunityForm {
name: "TIL_community_agg_2".into(),
..CommunityForm::default()
};
- let another_inserted_community = Community::create(&conn, &another_community).unwrap();
+ let another_inserted_community = Community::create(conn, &another_community).unwrap();
let first_person_follow = CommunityFollowerForm {
community_id: inserted_community.id,
pending: false,
};
- CommunityFollower::follow(&conn, &first_person_follow).unwrap();
+ CommunityFollower::follow(conn, &first_person_follow).unwrap();
let second_person_follow = CommunityFollowerForm {
community_id: inserted_community.id,
pending: false,
};
- CommunityFollower::follow(&conn, &second_person_follow).unwrap();
+ CommunityFollower::follow(conn, &second_person_follow).unwrap();
let another_community_follow = CommunityFollowerForm {
community_id: another_inserted_community.id,
pending: false,
};
- CommunityFollower::follow(&conn, &another_community_follow).unwrap();
+ CommunityFollower::follow(conn, &another_community_follow).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let child_comment_form = CommentForm {
content: "A test comment".into(),
};
let _inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
let community_aggregates_before_delete =
- CommunityAggregates::read(&conn, inserted_community.id).unwrap();
+ CommunityAggregates::read(conn, inserted_community.id).unwrap();
assert_eq!(2, community_aggregates_before_delete.subscribers);
assert_eq!(1, community_aggregates_before_delete.posts);
// Test the other community
let another_community_aggs =
- CommunityAggregates::read(&conn, another_inserted_community.id).unwrap();
+ CommunityAggregates::read(conn, another_inserted_community.id).unwrap();
assert_eq!(1, another_community_aggs.subscribers);
assert_eq!(0, another_community_aggs.posts);
assert_eq!(0, another_community_aggs.comments);
// Unfollow test
- CommunityFollower::unfollow(&conn, &second_person_follow).unwrap();
- let after_unfollow = CommunityAggregates::read(&conn, inserted_community.id).unwrap();
+ CommunityFollower::unfollow(conn, &second_person_follow).unwrap();
+ let after_unfollow = CommunityAggregates::read(conn, inserted_community.id).unwrap();
assert_eq!(1, after_unfollow.subscribers);
// Follow again just for the later tests
- CommunityFollower::follow(&conn, &second_person_follow).unwrap();
- let after_follow_again = CommunityAggregates::read(&conn, inserted_community.id).unwrap();
+ CommunityFollower::follow(conn, &second_person_follow).unwrap();
+ let after_follow_again = CommunityAggregates::read(conn, inserted_community.id).unwrap();
assert_eq!(2, after_follow_again.subscribers);
// Remove a parent comment (the comment count should also be 0)
- Post::delete(&conn, inserted_post.id).unwrap();
- let after_parent_post_delete = CommunityAggregates::read(&conn, inserted_community.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ let after_parent_post_delete = CommunityAggregates::read(conn, inserted_community.id).unwrap();
assert_eq!(0, after_parent_post_delete.comments);
assert_eq!(0, after_parent_post_delete.posts);
// Remove the 2nd person
- Person::delete(&conn, another_inserted_person.id).unwrap();
- let after_person_delete = CommunityAggregates::read(&conn, inserted_community.id).unwrap();
+ Person::delete(conn, another_inserted_person.id).unwrap();
+ let after_person_delete = CommunityAggregates::read(conn, inserted_community.id).unwrap();
assert_eq!(1, after_person_delete.subscribers);
// This should delete all the associated rows, and fire triggers
- let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let person_num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, person_num_deleted);
// Delete the community
- let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
+ let community_num_deleted = Community::delete(conn, inserted_community.id).unwrap();
assert_eq!(1, community_num_deleted);
let another_community_num_deleted =
- Community::delete(&conn, another_inserted_community.id).unwrap();
+ Community::delete(conn, another_inserted_community.id).unwrap();
assert_eq!(1, another_community_num_deleted);
// Should be none found, since the creator was deleted
- let after_delete = CommunityAggregates::read(&conn, inserted_community.id);
+ let after_delete = CommunityAggregates::read(conn, inserted_community.id);
assert!(after_delete.is_err());
}
}
use diesel::{result::Error, *};
impl PersonAggregates {
- pub fn read(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, person_id: PersonId) -> Result<Self, Error> {
person_aggregates::table
.filter(person_aggregates::person_id.eq(person_id))
.first::<Self>(conn)
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy_user_agg".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_user_agg".into(),
..PersonForm::default()
};
- let another_inserted_person = Person::create(&conn, &another_person).unwrap();
+ let another_inserted_person = Person::create(conn, &another_person).unwrap();
let new_community = CommunityForm {
name: "TIL_site_agg".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let post_like = PostLikeForm {
post_id: inserted_post.id,
score: 1,
};
- let _inserted_post_like = PostLike::like(&conn, &post_like).unwrap();
+ let _inserted_post_like = PostLike::like(conn, &post_like).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let mut comment_like = CommentLikeForm {
comment_id: inserted_comment.id,
score: 1,
};
- let _inserted_comment_like = CommentLike::like(&conn, &comment_like).unwrap();
+ let _inserted_comment_like = CommentLike::like(conn, &comment_like).unwrap();
let child_comment_form = CommentForm {
content: "A test comment".into(),
};
let inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
let child_comment_like = CommentLikeForm {
comment_id: inserted_child_comment.id,
score: 1,
};
- let _inserted_child_comment_like = CommentLike::like(&conn, &child_comment_like).unwrap();
+ let _inserted_child_comment_like = CommentLike::like(conn, &child_comment_like).unwrap();
- let person_aggregates_before_delete =
- PersonAggregates::read(&conn, inserted_person.id).unwrap();
+ let person_aggregates_before_delete = PersonAggregates::read(conn, inserted_person.id).unwrap();
assert_eq!(1, person_aggregates_before_delete.post_count);
assert_eq!(1, person_aggregates_before_delete.post_score);
assert_eq!(2, person_aggregates_before_delete.comment_score);
// Remove a post like
- PostLike::remove(&conn, inserted_person.id, inserted_post.id).unwrap();
- let after_post_like_remove = PersonAggregates::read(&conn, inserted_person.id).unwrap();
+ PostLike::remove(conn, inserted_person.id, inserted_post.id).unwrap();
+ let after_post_like_remove = PersonAggregates::read(conn, inserted_person.id).unwrap();
assert_eq!(0, after_post_like_remove.post_score);
// Remove a parent comment (the scores should also be removed)
- Comment::delete(&conn, inserted_comment.id).unwrap();
- Comment::delete(&conn, inserted_child_comment.id).unwrap();
- let after_parent_comment_delete = PersonAggregates::read(&conn, inserted_person.id).unwrap();
+ Comment::delete(conn, inserted_comment.id).unwrap();
+ Comment::delete(conn, inserted_child_comment.id).unwrap();
+ let after_parent_comment_delete = PersonAggregates::read(conn, inserted_person.id).unwrap();
assert_eq!(0, after_parent_comment_delete.comment_count);
assert_eq!(0, after_parent_comment_delete.comment_score);
// Add in the two comments again, then delete the post.
- let new_parent_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let new_parent_comment = Comment::create(conn, &comment_form, None).unwrap();
let _new_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&new_parent_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&new_parent_comment.path)).unwrap();
comment_like.comment_id = new_parent_comment.id;
- CommentLike::like(&conn, &comment_like).unwrap();
- let after_comment_add = PersonAggregates::read(&conn, inserted_person.id).unwrap();
+ CommentLike::like(conn, &comment_like).unwrap();
+ let after_comment_add = PersonAggregates::read(conn, inserted_person.id).unwrap();
assert_eq!(2, after_comment_add.comment_count);
assert_eq!(1, after_comment_add.comment_score);
- Post::delete(&conn, inserted_post.id).unwrap();
- let after_post_delete = PersonAggregates::read(&conn, inserted_person.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ let after_post_delete = PersonAggregates::read(conn, inserted_person.id).unwrap();
assert_eq!(0, after_post_delete.comment_score);
assert_eq!(0, after_post_delete.comment_count);
assert_eq!(0, after_post_delete.post_score);
assert_eq!(0, after_post_delete.post_count);
// This should delete all the associated rows, and fire triggers
- let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let person_num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, person_num_deleted);
- Person::delete(&conn, another_inserted_person.id).unwrap();
+ Person::delete(conn, another_inserted_person.id).unwrap();
// Delete the community
- let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
+ let community_num_deleted = Community::delete(conn, inserted_community.id).unwrap();
assert_eq!(1, community_num_deleted);
// Should be none found
- let after_delete = PersonAggregates::read(&conn, inserted_person.id);
+ let after_delete = PersonAggregates::read(conn, inserted_person.id);
assert!(after_delete.is_err());
}
}
use diesel::{result::Error, *};
impl PostAggregates {
- pub fn read(conn: &PgConnection, post_id: PostId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, post_id: PostId) -> Result<Self, Error> {
post_aggregates::table
.filter(post_aggregates::post_id.eq(post_id))
.first::<Self>(conn)
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy_community_agg".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_community_agg".into(),
..PersonForm::default()
};
- let another_inserted_person = Person::create(&conn, &another_person).unwrap();
+ let another_inserted_person = Person::create(conn, &another_person).unwrap();
let new_community = CommunityForm {
name: "TIL_community_agg".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let child_comment_form = CommentForm {
content: "A test comment".into(),
};
let inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
let post_like = PostLikeForm {
post_id: inserted_post.id,
score: 1,
};
- PostLike::like(&conn, &post_like).unwrap();
+ PostLike::like(conn, &post_like).unwrap();
- let post_aggs_before_delete = PostAggregates::read(&conn, inserted_post.id).unwrap();
+ let post_aggs_before_delete = PostAggregates::read(conn, inserted_post.id).unwrap();
assert_eq!(2, post_aggs_before_delete.comments);
assert_eq!(1, post_aggs_before_delete.score);
score: -1,
};
- PostLike::like(&conn, &post_dislike).unwrap();
+ PostLike::like(conn, &post_dislike).unwrap();
- let post_aggs_after_dislike = PostAggregates::read(&conn, inserted_post.id).unwrap();
+ let post_aggs_after_dislike = PostAggregates::read(conn, inserted_post.id).unwrap();
assert_eq!(2, post_aggs_after_dislike.comments);
assert_eq!(0, post_aggs_after_dislike.score);
assert_eq!(1, post_aggs_after_dislike.downvotes);
// Remove the comments
- Comment::delete(&conn, inserted_comment.id).unwrap();
- Comment::delete(&conn, inserted_child_comment.id).unwrap();
- let after_comment_delete = PostAggregates::read(&conn, inserted_post.id).unwrap();
+ Comment::delete(conn, inserted_comment.id).unwrap();
+ Comment::delete(conn, inserted_child_comment.id).unwrap();
+ let after_comment_delete = PostAggregates::read(conn, inserted_post.id).unwrap();
assert_eq!(0, after_comment_delete.comments);
assert_eq!(0, after_comment_delete.score);
assert_eq!(1, after_comment_delete.upvotes);
assert_eq!(1, after_comment_delete.downvotes);
// Remove the first post like
- PostLike::remove(&conn, inserted_person.id, inserted_post.id).unwrap();
- let after_like_remove = PostAggregates::read(&conn, inserted_post.id).unwrap();
+ PostLike::remove(conn, inserted_person.id, inserted_post.id).unwrap();
+ let after_like_remove = PostAggregates::read(conn, inserted_post.id).unwrap();
assert_eq!(0, after_like_remove.comments);
assert_eq!(-1, after_like_remove.score);
assert_eq!(0, after_like_remove.upvotes);
assert_eq!(1, after_like_remove.downvotes);
// This should delete all the associated rows, and fire triggers
- Person::delete(&conn, another_inserted_person.id).unwrap();
- let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ Person::delete(conn, another_inserted_person.id).unwrap();
+ let person_num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, person_num_deleted);
// Delete the community
- let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
+ let community_num_deleted = Community::delete(conn, inserted_community.id).unwrap();
assert_eq!(1, community_num_deleted);
// Should be none found, since the creator was deleted
- let after_delete = PostAggregates::read(&conn, inserted_post.id);
+ let after_delete = PostAggregates::read(conn, inserted_post.id);
assert!(after_delete.is_err());
}
}
use diesel::{result::Error, *};
impl SiteAggregates {
- pub fn read(conn: &PgConnection) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection) -> Result<Self, Error> {
site_aggregates::table.first::<Self>(conn)
}
}
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy_site_agg".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let site_form = SiteForm {
name: "test_site".into(),
..Default::default()
};
- let inserted_site = Site::create(&conn, &site_form).unwrap();
+ let inserted_site = Site::create(conn, &site_form).unwrap();
let new_community = CommunityForm {
name: "TIL_site_agg".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
};
// Insert two of those posts
- let inserted_post = Post::create(&conn, &new_post).unwrap();
- let _inserted_post_again = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
+ let _inserted_post_again = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
};
// Insert two of those comments
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let child_comment_form = CommentForm {
content: "A test comment".into(),
};
let _inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
- let site_aggregates_before_delete = SiteAggregates::read(&conn).unwrap();
+ let site_aggregates_before_delete = SiteAggregates::read(conn).unwrap();
assert_eq!(1, site_aggregates_before_delete.users);
assert_eq!(1, site_aggregates_before_delete.communities);
assert_eq!(2, site_aggregates_before_delete.comments);
// Try a post delete
- Post::delete(&conn, inserted_post.id).unwrap();
- let site_aggregates_after_post_delete = SiteAggregates::read(&conn).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ let site_aggregates_after_post_delete = SiteAggregates::read(conn).unwrap();
assert_eq!(1, site_aggregates_after_post_delete.posts);
assert_eq!(0, site_aggregates_after_post_delete.comments);
// This shouuld delete all the associated rows, and fire triggers
- let person_num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let person_num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(1, person_num_deleted);
// Delete the community
- let community_num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
+ let community_num_deleted = Community::delete(conn, inserted_community.id).unwrap();
assert_eq!(1, community_num_deleted);
// Site should still exist, it can without a site creator.
- let after_delete_creator = SiteAggregates::read(&conn);
+ let after_delete_creator = SiteAggregates::read(conn);
assert!(after_delete_creator.is_ok());
- Site::delete(&conn, inserted_site.id).unwrap();
- let after_delete_site = SiteAggregates::read(&conn);
+ Site::delete(conn, inserted_site.id).unwrap();
+ let after_delete_site = SiteAggregates::read(conn);
assert!(after_delete_site.is_err());
}
}
site_aggregates,
};
-#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
+#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "comment_aggregates")]
+#[cfg_attr(feature = "full", diesel(table_name = comment_aggregates))]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
pub struct CommentAggregates {
pub id: i32,
pub comment_id: CommentId,
pub child_count: i32,
}
-#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
+#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "community_aggregates")]
+#[cfg_attr(feature = "full", diesel(table_name = community_aggregates))]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::community::Community))
+)]
pub struct CommunityAggregates {
pub id: i32,
pub community_id: CommunityId,
pub users_active_half_year: i64,
}
-#[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Default)]
+#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone, Default)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_aggregates")]
+#[cfg_attr(feature = "full", diesel(table_name = person_aggregates))]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
pub struct PersonAggregates {
pub id: i32,
pub person_id: PersonId,
pub comment_score: i64,
}
-#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
+#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "post_aggregates")]
+#[cfg_attr(feature = "full", diesel(table_name = post_aggregates))]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
pub struct PostAggregates {
pub id: i32,
pub post_id: PostId,
pub newest_comment_time: chrono::NaiveDateTime,
}
-#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
+#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "site_aggregates")]
+#[cfg_attr(feature = "full", diesel(table_name = site_aggregates))]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
pub struct SiteAggregates {
pub id: i32,
pub site_id: i32,
impl Crud for Activity {
type Form = ActivityForm;
type IdType = i32;
- fn read(conn: &PgConnection, activity_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, activity_id: i32) -> Result<Self, Error> {
use crate::schema::activity::dsl::*;
activity.find(activity_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, new_activity: &ActivityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, new_activity: &ActivityForm) -> Result<Self, Error> {
use crate::schema::activity::dsl::*;
insert_into(activity)
.values(new_activity)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
activity_id: i32,
new_activity: &ActivityForm,
) -> Result<Self, Error> {
.set(new_activity)
.get_result::<Self>(conn)
}
- fn delete(conn: &PgConnection, activity_id: i32) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, activity_id: i32) -> Result<usize, Error> {
use crate::schema::activity::dsl::*;
diesel::delete(activity.find(activity_id)).execute(conn)
}
impl Activity {
/// Returns true if the insert was successful
pub fn insert(
- conn: &PgConnection,
+ conn: &mut PgConnection,
ap_id: DbUrl,
data: Value,
local: bool,
}
}
- pub fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Activity, Error> {
+ pub fn read_from_apub_id(conn: &mut PgConnection, object_id: &DbUrl) -> Result<Activity, Error> {
use crate::schema::activity::dsl::*;
activity.filter(ap_id.eq(object_id)).first::<Self>(conn)
}
- pub fn delete_olds(conn: &PgConnection) -> Result<usize, Error> {
+ pub fn delete_olds(conn: &mut PgConnection) -> Result<usize, Error> {
use crate::schema::activity::dsl::*;
diesel::delete(activity.filter(published.lt(now - 6.months()))).execute(conn)
}
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let creator_form = PersonForm {
name: "activity_creator_pm".into(),
..PersonForm::default()
};
- let inserted_creator = Person::create(&conn, &creator_form).unwrap();
+ let inserted_creator = Person::create(conn, &creator_form).unwrap();
let ap_id: DbUrl = Url::parse(
"https://enterprise.lemmy.ml/activities/delete/f1b5d57c-80f8-4e03-a615-688d552e946c",
updated: None,
};
- let inserted_activity = Activity::create(&conn, &activity_form).unwrap();
+ let inserted_activity = Activity::create(conn, &activity_form).unwrap();
let expected_activity = Activity {
ap_id: ap_id.clone(),
updated: None,
};
- let read_activity = Activity::read(&conn, inserted_activity.id).unwrap();
- let read_activity_by_apub_id = Activity::read_from_apub_id(&conn, &ap_id).unwrap();
- Person::delete(&conn, inserted_creator.id).unwrap();
- Activity::delete(&conn, inserted_activity.id).unwrap();
+ let read_activity = Activity::read(conn, inserted_activity.id).unwrap();
+ let read_activity_by_apub_id = Activity::read_from_apub_id(conn, &ap_id).unwrap();
+ Person::delete(conn, inserted_creator.id).unwrap();
+ Activity::delete(conn, inserted_activity.id).unwrap();
assert_eq!(expected_activity, read_activity);
assert_eq!(expected_activity, read_activity_by_apub_id);
impl Comment {
pub fn update_ap_id(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_id: CommentId,
apub_id: DbUrl,
) -> Result<Self, Error> {
}
pub fn permadelete_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::comment::dsl::*;
}
pub fn update_deleted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_id: CommentId,
new_deleted: bool,
) -> Result<Self, Error> {
}
pub fn update_removed(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_id: CommentId,
new_removed: bool,
) -> Result<Self, Error> {
}
pub fn update_removed_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
new_removed: bool,
) -> Result<Vec<Self>, Error> {
}
pub fn create(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_form: &CommentForm,
parent_path: Option<&Ltree>,
) -> Result<Comment, Error> {
inserted_comment
}
}
- pub fn read_from_apub_id(conn: &PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
+ pub fn read_from_apub_id(conn: &mut PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
use crate::schema::comment::dsl::*;
let object_id: DbUrl = object_id.into();
Ok(
impl Crud for Comment {
type Form = CommentForm;
type IdType = CommentId;
- fn read(conn: &PgConnection, comment_id: CommentId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, comment_id: CommentId) -> Result<Self, Error> {
use crate::schema::comment::dsl::*;
comment.find(comment_id).first::<Self>(conn)
}
- fn delete(conn: &PgConnection, comment_id: CommentId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, comment_id: CommentId) -> Result<usize, Error> {
use crate::schema::comment::dsl::*;
diesel::delete(comment.find(comment_id)).execute(conn)
}
/// This is unimplemented, use [[Comment::create]]
- fn create(_conn: &PgConnection, _comment_form: &CommentForm) -> Result<Self, Error> {
+ fn create(_conn: &mut PgConnection, _comment_form: &CommentForm) -> Result<Self, Error> {
unimplemented!();
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_id: CommentId,
comment_form: &CommentForm,
) -> Result<Self, Error> {
impl Likeable for CommentLike {
type Form = CommentLikeForm;
type IdType = CommentId;
- fn like(conn: &PgConnection, comment_like_form: &CommentLikeForm) -> Result<Self, Error> {
+ fn like(conn: &mut PgConnection, comment_like_form: &CommentLikeForm) -> Result<Self, Error> {
use crate::schema::comment_like::dsl::*;
insert_into(comment_like)
.values(comment_like_form)
.get_result::<Self>(conn)
}
fn remove(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_id: PersonId,
comment_id: CommentId,
) -> Result<usize, Error> {
impl Saveable for CommentSaved {
type Form = CommentSavedForm;
- fn save(conn: &PgConnection, comment_saved_form: &CommentSavedForm) -> Result<Self, Error> {
+ fn save(conn: &mut PgConnection, comment_saved_form: &CommentSavedForm) -> Result<Self, Error> {
use crate::schema::comment_saved::dsl::*;
insert_into(comment_saved)
.values(comment_saved_form)
.set(comment_saved_form)
.get_result::<Self>(conn)
}
- fn unsave(conn: &PgConnection, comment_saved_form: &CommentSavedForm) -> Result<usize, Error> {
+ fn unsave(
+ conn: &mut PgConnection,
+ comment_saved_form: &CommentSavedForm,
+ ) -> Result<usize, Error> {
use crate::schema::comment_saved::dsl::*;
diesel::delete(
comment_saved
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "terry".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "test community".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let expected_comment = Comment {
id: inserted_comment.id,
};
let inserted_child_comment =
- Comment::create(&conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
+ Comment::create(conn, &child_comment_form, Some(&inserted_comment.path)).unwrap();
// Comment Like
let comment_like_form = CommentLikeForm {
score: 1,
};
- let inserted_comment_like = CommentLike::like(&conn, &comment_like_form).unwrap();
+ let inserted_comment_like = CommentLike::like(conn, &comment_like_form).unwrap();
let expected_comment_like = CommentLike {
id: inserted_comment_like.id,
person_id: inserted_person.id,
};
- let inserted_comment_saved = CommentSaved::save(&conn, &comment_saved_form).unwrap();
+ let inserted_comment_saved = CommentSaved::save(conn, &comment_saved_form).unwrap();
let expected_comment_saved = CommentSaved {
id: inserted_comment_saved.id,
published: inserted_comment_saved.published,
};
- let read_comment = Comment::read(&conn, inserted_comment.id).unwrap();
- let updated_comment = Comment::update(&conn, inserted_comment.id, &comment_form).unwrap();
- let like_removed = CommentLike::remove(&conn, inserted_person.id, inserted_comment.id).unwrap();
- let saved_removed = CommentSaved::unsave(&conn, &comment_saved_form).unwrap();
- let num_deleted = Comment::delete(&conn, inserted_comment.id).unwrap();
- Comment::delete(&conn, inserted_child_comment.id).unwrap();
- Post::delete(&conn, inserted_post.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
+ let read_comment = Comment::read(conn, inserted_comment.id).unwrap();
+ let updated_comment = Comment::update(conn, inserted_comment.id, &comment_form).unwrap();
+ let like_removed = CommentLike::remove(conn, inserted_person.id, inserted_comment.id).unwrap();
+ let saved_removed = CommentSaved::unsave(conn, &comment_saved_form).unwrap();
+ let num_deleted = Comment::delete(conn, inserted_comment.id).unwrap();
+ Comment::delete(conn, inserted_child_comment.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(expected_comment, read_comment);
assert_eq!(expected_comment, inserted_comment);
impl Crud for CommentReply {
type Form = CommentReplyForm;
type IdType = CommentReplyId;
- fn read(conn: &PgConnection, comment_reply_id: CommentReplyId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, comment_reply_id: CommentReplyId) -> Result<Self, Error> {
use crate::schema::comment_reply::dsl::*;
comment_reply.find(comment_reply_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, comment_reply_form: &CommentReplyForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, comment_reply_form: &CommentReplyForm) -> Result<Self, Error> {
use crate::schema::comment_reply::dsl::*;
// since the return here isnt utilized, we dont need to do an update
// but get_result doesnt return the existing row here
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_reply_id: CommentReplyId,
comment_reply_form: &CommentReplyForm,
) -> Result<Self, Error> {
impl CommentReply {
pub fn update_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_reply_id: CommentReplyId,
new_read: bool,
) -> Result<CommentReply, Error> {
}
pub fn mark_all_as_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_recipient_id: PersonId,
) -> Result<Vec<CommentReply>, Error> {
use crate::schema::comment_reply::dsl::*;
.get_results::<Self>(conn)
}
- pub fn read_by_comment(conn: &PgConnection, for_comment_id: CommentId) -> Result<Self, Error> {
+ pub fn read_by_comment(
+ conn: &mut PgConnection,
+ for_comment_id: CommentId,
+ ) -> Result<Self, Error> {
use crate::schema::comment_reply::dsl::*;
comment_reply
.filter(comment_id.eq(for_comment_id))
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "terrylake".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let recipient_form = PersonForm {
name: "terrylakes recipient".into(),
..PersonForm::default()
};
- let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
+ let inserted_recipient = Person::create(conn, &recipient_form).unwrap();
let new_community = CommunityForm {
name: "test community lake".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let comment_reply_form = CommentReplyForm {
recipient_id: inserted_recipient.id,
read: None,
};
- let inserted_reply = CommentReply::create(&conn, &comment_reply_form).unwrap();
+ let inserted_reply = CommentReply::create(conn, &comment_reply_form).unwrap();
let expected_reply = CommentReply {
id: inserted_reply.id,
published: inserted_reply.published,
};
- let read_reply = CommentReply::read(&conn, inserted_reply.id).unwrap();
- let updated_reply =
- CommentReply::update(&conn, inserted_reply.id, &comment_reply_form).unwrap();
- Comment::delete(&conn, inserted_comment.id).unwrap();
- Post::delete(&conn, inserted_post.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
- Person::delete(&conn, inserted_recipient.id).unwrap();
+ let read_reply = CommentReply::read(conn, inserted_reply.id).unwrap();
+ let updated_reply = CommentReply::update(conn, inserted_reply.id, &comment_reply_form).unwrap();
+ Comment::delete(conn, inserted_comment.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
+ Person::delete(conn, inserted_recipient.id).unwrap();
assert_eq!(expected_reply, read_reply);
assert_eq!(expected_reply, inserted_reply);
///
/// * `conn` - the postgres connection
/// * `comment_report_form` - the filled CommentReportForm to insert
- fn report(conn: &PgConnection, comment_report_form: &CommentReportForm) -> Result<Self, Error> {
+ fn report(
+ conn: &mut PgConnection,
+ comment_report_form: &CommentReportForm,
+ ) -> Result<Self, Error> {
use crate::schema::comment_report::dsl::*;
insert_into(comment_report)
.values(comment_report_form)
/// * `report_id` - the id of the report to resolve
/// * `by_resolver_id` - the id of the user resolving the report
fn resolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
/// * `report_id` - the id of the report to unresolve
/// * `by_resolver_id` - the id of the user unresolving the report
fn unresolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
impl Crud for Community {
type Form = CommunityForm;
type IdType = CommunityId;
- fn read(conn: &PgConnection, community_id: CommunityId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, community_id: CommunityId) -> Result<Self, Error> {
use crate::schema::community::dsl::*;
community.find(community_id).first::<Self>(conn)
}
- fn delete(conn: &PgConnection, community_id: CommunityId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, community_id: CommunityId) -> Result<usize, Error> {
use crate::schema::community::dsl::*;
diesel::delete(community.find(community_id)).execute(conn)
}
- fn create(conn: &PgConnection, new_community: &CommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, new_community: &CommunityForm) -> Result<Self, Error> {
use crate::schema::community::dsl::*;
insert_into(community)
.values(new_community)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
new_community: &CommunityForm,
) -> Result<Self, Error> {
impl Community {
pub fn update_deleted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
new_deleted: bool,
) -> Result<Community, Error> {
}
pub fn update_removed(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
new_removed: bool,
) -> Result<Community, Error> {
.get_result::<Self>(conn)
}
- pub fn distinct_federated_communities(conn: &PgConnection) -> Result<Vec<DbUrl>, Error> {
+ pub fn distinct_federated_communities(conn: &mut PgConnection) -> Result<Vec<DbUrl>, Error> {
use crate::schema::community::dsl::*;
community.select(actor_id).distinct().load::<DbUrl>(conn)
}
- pub fn upsert(conn: &PgConnection, community_form: &CommunityForm) -> Result<Community, Error> {
+ pub fn upsert(
+ conn: &mut PgConnection,
+ community_form: &CommunityForm,
+ ) -> Result<Community, Error> {
use crate::schema::community::dsl::*;
insert_into(community)
.values(community_form)
}
pub fn remove_avatar_and_banner(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
) -> Result<Self, Error> {
use crate::schema::community::dsl::*;
impl Joinable for CommunityModerator {
type Form = CommunityModeratorForm;
fn join(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_moderator_form: &CommunityModeratorForm,
) -> Result<Self, Error> {
use crate::schema::community_moderator::dsl::*;
}
fn leave(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_moderator_form: &CommunityModeratorForm,
) -> Result<usize, Error> {
use crate::schema::community_moderator::dsl::*;
impl CommunityModerator {
pub fn delete_for_community(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_community_id: CommunityId,
) -> Result<usize, Error> {
use crate::schema::community_moderator::dsl::*;
}
pub fn get_person_moderated_communities(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_person_id: PersonId,
) -> Result<Vec<CommunityId>, Error> {
use crate::schema::community_moderator::dsl::*;
impl Bannable for CommunityPersonBan {
type Form = CommunityPersonBanForm;
fn ban(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_person_ban_form: &CommunityPersonBanForm,
) -> Result<Self, Error> {
use crate::schema::community_person_ban::dsl::*;
}
fn unban(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_person_ban_form: &CommunityPersonBanForm,
) -> Result<usize, Error> {
use crate::schema::community_person_ban::dsl::*;
impl Followable for CommunityFollower {
type Form = CommunityFollowerForm;
fn follow(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_follower_form: &CommunityFollowerForm,
) -> Result<Self, Error> {
use crate::schema::community_follower::dsl::*;
.get_result::<Self>(conn)
}
fn follow_accepted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id_: CommunityId,
person_id_: PersonId,
) -> Result<Self, Error>
.get_result::<Self>(conn)
}
fn unfollow(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_follower_form: &CommunityFollowerForm,
) -> Result<usize, Error> {
use crate::schema::community_follower::dsl::*;
}
// TODO: this function name only makes sense if you call it with a remote community. for a local
// community, it will also return true if only remote followers exist
- fn has_local_followers(conn: &PgConnection, community_id_: CommunityId) -> Result<bool, Error> {
+ fn has_local_followers(
+ conn: &mut PgConnection,
+ community_id_: CommunityId,
+ ) -> Result<bool, Error> {
use crate::schema::community_follower::dsl::*;
diesel::select(exists(
community_follower.filter(community_id.eq(community_id_)),
}
impl ApubActor for Community {
- fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error> {
+ fn read_from_apub_id(conn: &mut PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error> {
use crate::schema::community::dsl::*;
Ok(
community
}
fn read_from_name(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_name: &str,
include_deleted: bool,
) -> Result<Community, Error> {
}
fn read_from_name_and_domain(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_name: &str,
protocol_domain: &str,
) -> Result<Community, Error> {
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "bobbee".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "TIL".into(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let expected_community = Community {
id: inserted_community.id,
};
let inserted_community_follower =
- CommunityFollower::follow(&conn, &community_follower_form).unwrap();
+ CommunityFollower::follow(conn, &community_follower_form).unwrap();
let expected_community_follower = CommunityFollower {
id: inserted_community_follower.id,
};
let inserted_community_moderator =
- CommunityModerator::join(&conn, &community_moderator_form).unwrap();
+ CommunityModerator::join(conn, &community_moderator_form).unwrap();
let expected_community_moderator = CommunityModerator {
id: inserted_community_moderator.id,
};
let inserted_community_person_ban =
- CommunityPersonBan::ban(&conn, &community_person_ban_form).unwrap();
+ CommunityPersonBan::ban(conn, &community_person_ban_form).unwrap();
let expected_community_person_ban = CommunityPersonBan {
id: inserted_community_person_ban.id,
expires: None,
};
- let read_community = Community::read(&conn, inserted_community.id).unwrap();
- let updated_community =
- Community::update(&conn, inserted_community.id, &new_community).unwrap();
- let ignored_community = CommunityFollower::unfollow(&conn, &community_follower_form).unwrap();
- let left_community = CommunityModerator::leave(&conn, &community_moderator_form).unwrap();
- let unban = CommunityPersonBan::unban(&conn, &community_person_ban_form).unwrap();
- let num_deleted = Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
+ let read_community = Community::read(conn, inserted_community.id).unwrap();
+ let updated_community = Community::update(conn, inserted_community.id, &new_community).unwrap();
+ let ignored_community = CommunityFollower::unfollow(conn, &community_follower_form).unwrap();
+ let left_community = CommunityModerator::leave(conn, &community_moderator_form).unwrap();
+ let unban = CommunityPersonBan::unban(conn, &community_person_ban_form).unwrap();
+ let num_deleted = Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(expected_community, read_community);
assert_eq!(expected_community, inserted_community);
impl Blockable for CommunityBlock {
type Form = CommunityBlockForm;
- fn block(conn: &PgConnection, community_block_form: &Self::Form) -> Result<Self, Error> {
+ fn block(conn: &mut PgConnection, community_block_form: &Self::Form) -> Result<Self, Error> {
use crate::schema::community_block::dsl::*;
insert_into(community_block)
.values(community_block_form)
.set(community_block_form)
.get_result::<Self>(conn)
}
- fn unblock(conn: &PgConnection, community_block_form: &Self::Form) -> Result<usize, Error> {
+ fn unblock(conn: &mut PgConnection, community_block_form: &Self::Form) -> Result<usize, Error> {
use crate::schema::community_block::dsl::*;
diesel::delete(
community_block
impl Crud for EmailVerification {
type Form = EmailVerificationForm;
type IdType = i32;
- fn create(conn: &PgConnection, form: &EmailVerificationForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &EmailVerificationForm) -> Result<Self, Error> {
use crate::schema::email_verification::dsl::*;
insert_into(email_verification)
.values(form)
.get_result::<Self>(conn)
}
- fn read(conn: &PgConnection, id_: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, id_: i32) -> Result<Self, Error> {
use crate::schema::email_verification::dsl::*;
email_verification.find(id_).first::<Self>(conn)
}
- fn update(conn: &PgConnection, id_: i32, form: &EmailVerificationForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ id_: i32,
+ form: &EmailVerificationForm,
+ ) -> Result<Self, Error> {
use crate::schema::email_verification::dsl::*;
diesel::update(email_verification.find(id_))
.set(form)
.get_result::<Self>(conn)
}
- fn delete(conn: &PgConnection, id_: i32) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, id_: i32) -> Result<usize, Error> {
use crate::schema::email_verification::dsl::*;
diesel::delete(email_verification.find(id_)).execute(conn)
}
}
impl EmailVerification {
- pub fn read_for_token(conn: &PgConnection, token: &str) -> Result<Self, Error> {
+ pub fn read_for_token(conn: &mut PgConnection, token: &str) -> Result<Self, Error> {
use crate::schema::email_verification::dsl::*;
email_verification
.filter(verification_token.eq(token))
.first::<Self>(conn)
}
pub fn delete_old_tokens_for_local_user(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id_: LocalUserId,
) -> Result<usize, Error> {
use crate::schema::email_verification::dsl::*;
use diesel::{result::Error, PgConnection, RunQueryDsl, *};
impl Language {
- pub fn read_all(conn: &PgConnection) -> Result<Vec<Language>, Error> {
+ pub fn read_all(conn: &mut PgConnection) -> Result<Vec<Language>, Error> {
use crate::schema::language::dsl::*;
language.load::<Self>(conn)
}
- pub fn read_from_id(conn: &PgConnection, id_: LanguageId) -> Result<Language, Error> {
+ pub fn read_from_id(conn: &mut PgConnection, id_: LanguageId) -> Result<Language, Error> {
use crate::schema::language::dsl::*;
language.filter(id.eq(id_)).first::<Self>(conn)
}
- pub fn read_id_from_code(conn: &PgConnection, code_: &str) -> Result<LanguageId, Error> {
+ pub fn read_id_from_code(conn: &mut PgConnection, code_: &str) -> Result<LanguageId, Error> {
use crate::schema::language::dsl::*;
Ok(language.filter(code.eq(code_)).first::<Self>(conn)?.id)
}
pub fn read_id_from_code_opt(
- conn: &PgConnection,
+ conn: &mut PgConnection,
code_: Option<&str>,
) -> Result<Option<LanguageId>, Error> {
if let Some(code_) = code_ {
}
}
- pub fn read_undetermined(conn: &PgConnection) -> Result<LanguageId, Error> {
+ pub fn read_undetermined(conn: &mut PgConnection) -> Result<LanguageId, Error> {
use crate::schema::language::dsl::*;
Ok(language.filter(code.eq("und")).first::<Self>(conn)?.id)
}
#[test]
#[serial]
fn test_languages() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
- let all = Language::read_all(&conn).unwrap();
+ let all = Language::read_all(conn).unwrap();
assert_eq!(184, all.len());
assert_eq!("ak", all[5].code);
}
impl LocalUser {
- pub fn register(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
+ pub fn register(conn: &mut PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
let mut edited_user = form.clone();
let password_hash = form
.password_encrypted
}
pub fn update_password(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id: LocalUserId,
new_password: &str,
) -> Result<Self, Error> {
.get_result::<Self>(conn)
}
- pub fn set_all_users_email_verified(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn set_all_users_email_verified(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
diesel::update(local_user)
.set(email_verified.eq(true))
.get_results::<Self>(conn)
}
pub fn set_all_users_registration_applications_accepted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
) -> Result<Vec<Self>, Error> {
diesel::update(local_user)
.set(accepted_application.eq(true))
impl Crud for LocalUser {
type Form = LocalUserForm;
type IdType = LocalUserId;
- fn read(conn: &PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
local_user.find(local_user_id).first::<Self>(conn)
}
- fn delete(conn: &PgConnection, local_user_id: LocalUserId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<usize, Error> {
diesel::delete(local_user.find(local_user_id)).execute(conn)
}
- fn create(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
let local_user_ = insert_into(local_user)
.values(form)
.get_result::<Self>(conn)?;
Ok(local_user_)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id: LocalUserId,
form: &LocalUserForm,
) -> Result<Self, Error> {
///
/// If no language_id vector is given, it will show all languages
pub fn update_user_languages(
- conn: &PgConnection,
+ conn: &mut PgConnection,
language_ids: Option<Vec<LanguageId>>,
for_local_user_id: LocalUserId,
) -> Result<(), Error> {
.collect(),
);
- conn.build_transaction().read_write().run(|| {
+ conn.build_transaction().read_write().run(|conn| {
// Clear the current user languages
delete(local_user_language.filter(local_user_id.eq(for_local_user_id))).execute(conn)?;
impl Crud for ModRemovePost {
type Form = ModRemovePostForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::*;
mod_remove_post.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModRemovePostForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModRemovePostForm) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::*;
insert_into(mod_remove_post)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModRemovePostForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ from_id: i32,
+ form: &ModRemovePostForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::*;
diesel::update(mod_remove_post.find(from_id))
.set(form)
impl Crud for ModLockPost {
type Form = ModLockPostForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::*;
mod_lock_post.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModLockPostForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModLockPostForm) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::*;
insert_into(mod_lock_post)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::*;
diesel::update(mod_lock_post.find(from_id))
.set(form)
impl Crud for ModStickyPost {
type Form = ModStickyPostForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_sticky_post::dsl::*;
mod_sticky_post.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModStickyPostForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModStickyPostForm) -> Result<Self, Error> {
use crate::schema::mod_sticky_post::dsl::*;
insert_into(mod_sticky_post)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModStickyPostForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ from_id: i32,
+ form: &ModStickyPostForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_sticky_post::dsl::*;
diesel::update(mod_sticky_post.find(from_id))
.set(form)
impl Crud for ModRemoveComment {
type Form = ModRemoveCommentForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::*;
mod_remove_comment.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModRemoveCommentForm) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::*;
insert_into(mod_remove_comment)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ from_id: i32,
+ form: &ModRemoveCommentForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::*;
diesel::update(mod_remove_comment.find(from_id))
.set(form)
impl Crud for ModRemoveCommunity {
type Form = ModRemoveCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_community::dsl::*;
mod_remove_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_remove_community::dsl::*;
insert_into(mod_remove_community)
.values(form)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_id: i32,
form: &ModRemoveCommunityForm,
) -> Result<Self, Error> {
impl Crud for ModBanFromCommunity {
type Form = ModBanFromCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_ban_from_community::dsl::*;
mod_ban_from_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_ban_from_community::dsl::*;
insert_into(mod_ban_from_community)
.values(form)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_id: i32,
form: &ModBanFromCommunityForm,
) -> Result<Self, Error> {
impl Crud for ModBan {
type Form = ModBanForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::*;
mod_ban.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModBanForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModBanForm) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::*;
insert_into(mod_ban).values(form).get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::*;
diesel::update(mod_ban.find(from_id))
.set(form)
type Form = ModHideCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::*;
mod_hide_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModHideCommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModHideCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::*;
insert_into(mod_hide_community)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModHideCommunityForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ from_id: i32,
+ form: &ModHideCommunityForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::*;
diesel::update(mod_hide_community.find(from_id))
.set(form)
impl Crud for ModAddCommunity {
type Form = ModAddCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::*;
mod_add_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModAddCommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModAddCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::*;
insert_into(mod_add_community)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModAddCommunityForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ from_id: i32,
+ form: &ModAddCommunityForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::*;
diesel::update(mod_add_community.find(from_id))
.set(form)
impl Crud for ModTransferCommunity {
type Form = ModTransferCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_transfer_community::dsl::*;
mod_transfer_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModTransferCommunityForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModTransferCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_transfer_community::dsl::*;
insert_into(mod_transfer_community)
.values(form)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_id: i32,
form: &ModTransferCommunityForm,
) -> Result<Self, Error> {
impl Crud for ModAdd {
type Form = ModAddForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::*;
mod_add.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &ModAddForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &ModAddForm) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::*;
insert_into(mod_add).values(form).get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::*;
diesel::update(mod_add.find(from_id))
.set(form)
impl Crud for AdminPurgePerson {
type Form = AdminPurgePersonForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::*;
admin_purge_person.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::*;
insert_into(admin_purge_person)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::*;
diesel::update(admin_purge_person.find(from_id))
.set(form)
impl Crud for AdminPurgeCommunity {
type Form = AdminPurgeCommunityForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::*;
admin_purge_community.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::*;
insert_into(admin_purge_community)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::*;
diesel::update(admin_purge_community.find(from_id))
.set(form)
impl Crud for AdminPurgePost {
type Form = AdminPurgePostForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::*;
admin_purge_post.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::*;
insert_into(admin_purge_post)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::*;
diesel::update(admin_purge_post.find(from_id))
.set(form)
impl Crud for AdminPurgeComment {
type Form = AdminPurgeCommentForm;
type IdType = i32;
- fn read(conn: &PgConnection, from_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::*;
admin_purge_comment.find(from_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::*;
insert_into(admin_purge_comment)
.values(form)
.get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, from_id: i32, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::*;
diesel::update(admin_purge_comment.find(from_id))
.set(form)
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_mod = PersonForm {
name: "the mod".into(),
..PersonForm::default()
};
- let inserted_mod = Person::create(&conn, &new_mod).unwrap();
+ let inserted_mod = Person::create(conn, &new_mod).unwrap();
let new_person = PersonForm {
name: "jim2".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "mod_community".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post thweep".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
// Now the actual tests
reason: None,
removed: None,
};
- let inserted_mod_remove_post = ModRemovePost::create(&conn, &mod_remove_post_form).unwrap();
- let read_mod_remove_post = ModRemovePost::read(&conn, inserted_mod_remove_post.id).unwrap();
+ let inserted_mod_remove_post = ModRemovePost::create(conn, &mod_remove_post_form).unwrap();
+ let read_mod_remove_post = ModRemovePost::read(conn, inserted_mod_remove_post.id).unwrap();
let expected_mod_remove_post = ModRemovePost {
id: inserted_mod_remove_post.id,
post_id: inserted_post.id,
post_id: inserted_post.id,
locked: None,
};
- let inserted_mod_lock_post = ModLockPost::create(&conn, &mod_lock_post_form).unwrap();
- let read_mod_lock_post = ModLockPost::read(&conn, inserted_mod_lock_post.id).unwrap();
+ let inserted_mod_lock_post = ModLockPost::create(conn, &mod_lock_post_form).unwrap();
+ let read_mod_lock_post = ModLockPost::read(conn, inserted_mod_lock_post.id).unwrap();
let expected_mod_lock_post = ModLockPost {
id: inserted_mod_lock_post.id,
post_id: inserted_post.id,
post_id: inserted_post.id,
stickied: None,
};
- let inserted_mod_sticky_post = ModStickyPost::create(&conn, &mod_sticky_post_form).unwrap();
- let read_mod_sticky_post = ModStickyPost::read(&conn, inserted_mod_sticky_post.id).unwrap();
+ let inserted_mod_sticky_post = ModStickyPost::create(conn, &mod_sticky_post_form).unwrap();
+ let read_mod_sticky_post = ModStickyPost::read(conn, inserted_mod_sticky_post.id).unwrap();
let expected_mod_sticky_post = ModStickyPost {
id: inserted_mod_sticky_post.id,
post_id: inserted_post.id,
removed: None,
};
let inserted_mod_remove_comment =
- ModRemoveComment::create(&conn, &mod_remove_comment_form).unwrap();
+ ModRemoveComment::create(conn, &mod_remove_comment_form).unwrap();
let read_mod_remove_comment =
- ModRemoveComment::read(&conn, inserted_mod_remove_comment.id).unwrap();
+ ModRemoveComment::read(conn, inserted_mod_remove_comment.id).unwrap();
let expected_mod_remove_comment = ModRemoveComment {
id: inserted_mod_remove_comment.id,
comment_id: inserted_comment.id,
expires: None,
};
let inserted_mod_remove_community =
- ModRemoveCommunity::create(&conn, &mod_remove_community_form).unwrap();
+ ModRemoveCommunity::create(conn, &mod_remove_community_form).unwrap();
let read_mod_remove_community =
- ModRemoveCommunity::read(&conn, inserted_mod_remove_community.id).unwrap();
+ ModRemoveCommunity::read(conn, inserted_mod_remove_community.id).unwrap();
let expected_mod_remove_community = ModRemoveCommunity {
id: inserted_mod_remove_community.id,
community_id: inserted_community.id,
expires: None,
};
let inserted_mod_ban_from_community =
- ModBanFromCommunity::create(&conn, &mod_ban_from_community_form).unwrap();
+ ModBanFromCommunity::create(conn, &mod_ban_from_community_form).unwrap();
let read_mod_ban_from_community =
- ModBanFromCommunity::read(&conn, inserted_mod_ban_from_community.id).unwrap();
+ ModBanFromCommunity::read(conn, inserted_mod_ban_from_community.id).unwrap();
let expected_mod_ban_from_community = ModBanFromCommunity {
id: inserted_mod_ban_from_community.id,
community_id: inserted_community.id,
banned: None,
expires: None,
};
- let inserted_mod_ban = ModBan::create(&conn, &mod_ban_form).unwrap();
- let read_mod_ban = ModBan::read(&conn, inserted_mod_ban.id).unwrap();
+ let inserted_mod_ban = ModBan::create(conn, &mod_ban_form).unwrap();
+ let read_mod_ban = ModBan::read(conn, inserted_mod_ban.id).unwrap();
let expected_mod_ban = ModBan {
id: inserted_mod_ban.id,
mod_person_id: inserted_mod.id,
removed: None,
};
let inserted_mod_add_community =
- ModAddCommunity::create(&conn, &mod_add_community_form).unwrap();
+ ModAddCommunity::create(conn, &mod_add_community_form).unwrap();
let read_mod_add_community =
- ModAddCommunity::read(&conn, inserted_mod_add_community.id).unwrap();
+ ModAddCommunity::read(conn, inserted_mod_add_community.id).unwrap();
let expected_mod_add_community = ModAddCommunity {
id: inserted_mod_add_community.id,
community_id: inserted_community.id,
other_person_id: inserted_person.id,
removed: None,
};
- let inserted_mod_add = ModAdd::create(&conn, &mod_add_form).unwrap();
- let read_mod_add = ModAdd::read(&conn, inserted_mod_add.id).unwrap();
+ let inserted_mod_add = ModAdd::create(conn, &mod_add_form).unwrap();
+ let read_mod_add = ModAdd::read(conn, inserted_mod_add.id).unwrap();
let expected_mod_add = ModAdd {
id: inserted_mod_add.id,
mod_person_id: inserted_mod.id,
when_: inserted_mod_add.when_,
};
- Comment::delete(&conn, inserted_comment.id).unwrap();
- Post::delete(&conn, inserted_post.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
- Person::delete(&conn, inserted_mod.id).unwrap();
+ Comment::delete(conn, inserted_comment.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
+ Person::delete(conn, inserted_mod.id).unwrap();
assert_eq!(expected_mod_remove_post, read_mod_remove_post);
assert_eq!(expected_mod_lock_post, read_mod_lock_post);
impl Crud for PasswordResetRequest {
type Form = PasswordResetRequestForm;
type IdType = i32;
- fn read(conn: &PgConnection, password_reset_request_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, password_reset_request_id: i32) -> Result<Self, Error> {
password_reset_request
.find(password_reset_request_id)
.first::<Self>(conn)
}
- fn create(conn: &PgConnection, form: &PasswordResetRequestForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &PasswordResetRequestForm) -> Result<Self, Error> {
insert_into(password_reset_request)
.values(form)
.get_result::<Self>(conn)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
password_reset_request_id: i32,
form: &PasswordResetRequestForm,
) -> Result<Self, Error> {
impl PasswordResetRequest {
pub fn create_token(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_local_user_id: LocalUserId,
token: &str,
) -> Result<PasswordResetRequest, Error> {
Self::create(conn, &form)
}
- pub fn read_from_token(conn: &PgConnection, token: &str) -> Result<PasswordResetRequest, Error> {
+ pub fn read_from_token(
+ conn: &mut PgConnection,
+ token: &str,
+ ) -> Result<PasswordResetRequest, Error> {
let mut hasher = Sha256::new();
hasher.update(token);
let token_hash: String = bytes_to_hex(hasher.finalize().to_vec());
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "thommy prw".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let new_local_user = LocalUserForm {
person_id: Some(inserted_person.id),
..LocalUserForm::default()
};
- let inserted_local_user = LocalUser::create(&conn, &new_local_user).unwrap();
+ let inserted_local_user = LocalUser::create(conn, &new_local_user).unwrap();
let token = "nope";
let token_encrypted_ = "ca3704aa0b06f5954c79ee837faa152d84d6b2d42838f0637a15eda8337dbdce";
let inserted_password_reset_request =
- PasswordResetRequest::create_token(&conn, inserted_local_user.id, token).unwrap();
+ PasswordResetRequest::create_token(conn, inserted_local_user.id, token).unwrap();
let expected_password_reset_request = PasswordResetRequest {
id: inserted_password_reset_request.id,
published: inserted_password_reset_request.published,
};
- let read_password_reset_request = PasswordResetRequest::read_from_token(&conn, token).unwrap();
- let num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let read_password_reset_request = PasswordResetRequest::read_from_token(conn, token).unwrap();
+ let num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(expected_password_reset_request, read_password_reset_request);
assert_eq!(
}
}
-mod safe_type_alias_1 {
- use crate::{schema::person_alias_1::columns::*, source::person::PersonAlias1, traits::ToSafe};
-
- type Columns = (
- id,
- name,
- display_name,
- avatar,
- banned,
- published,
- updated,
- actor_id,
- bio,
- local,
- banner,
- deleted,
- inbox_url,
- shared_inbox_url,
- matrix_user_id,
- admin,
- bot_account,
- ban_expires,
- );
-
- impl ToSafe for PersonAlias1 {
- type SafeColumns = Columns;
- fn safe_columns_tuple() -> Self::SafeColumns {
- (
- id,
- name,
- display_name,
- avatar,
- banned,
- published,
- updated,
- actor_id,
- bio,
- local,
- banner,
- deleted,
- inbox_url,
- shared_inbox_url,
- matrix_user_id,
- admin,
- bot_account,
- ban_expires,
- )
- }
- }
-}
-
-mod safe_type_alias_2 {
- use crate::{schema::person_alias_2::columns::*, source::person::PersonAlias2, traits::ToSafe};
-
- type Columns = (
- id,
- name,
- display_name,
- avatar,
- banned,
- published,
- updated,
- actor_id,
- bio,
- local,
- banner,
- deleted,
- inbox_url,
- shared_inbox_url,
- matrix_user_id,
- admin,
- bot_account,
- ban_expires,
- );
-
- impl ToSafe for PersonAlias2 {
- type SafeColumns = Columns;
- fn safe_columns_tuple() -> Self::SafeColumns {
- (
- id,
- name,
- display_name,
- avatar,
- banned,
- published,
- updated,
- actor_id,
- bio,
- local,
- banner,
- deleted,
- inbox_url,
- shared_inbox_url,
- matrix_user_id,
- admin,
- bot_account,
- ban_expires,
- )
- }
- }
-}
-
impl Crud for Person {
type Form = PersonForm;
type IdType = PersonId;
- fn read(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, person_id: PersonId) -> Result<Self, Error> {
person
.filter(deleted.eq(false))
.find(person_id)
.first::<Self>(conn)
}
- fn delete(conn: &PgConnection, person_id: PersonId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, person_id: PersonId) -> Result<usize, Error> {
diesel::delete(person.find(person_id)).execute(conn)
}
- fn create(conn: &PgConnection, form: &PersonForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &PersonForm) -> Result<Self, Error> {
insert_into(person).values(form).get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, person_id: PersonId, form: &PersonForm) -> Result<Self, Error> {
+ fn update(
+ conn: &mut PgConnection,
+ person_id: PersonId,
+ form: &PersonForm,
+ ) -> Result<Self, Error> {
diesel::update(person.find(person_id))
.set(form)
.get_result::<Self>(conn)
impl Person {
pub fn ban_person(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_id: PersonId,
ban: bool,
expires: Option<chrono::NaiveDateTime>,
.get_result::<Self>(conn)
}
- pub fn add_admin(conn: &PgConnection, person_id: PersonId, added: bool) -> Result<Self, Error> {
+ pub fn add_admin(
+ conn: &mut PgConnection,
+ person_id: PersonId,
+ added: bool,
+ ) -> Result<Self, Error> {
diesel::update(person.find(person_id))
.set(admin.eq(added))
.get_result::<Self>(conn)
}
- pub fn mark_as_updated(conn: &PgConnection, person_id: PersonId) -> Result<Person, Error> {
+ pub fn mark_as_updated(conn: &mut PgConnection, person_id: PersonId) -> Result<Person, Error> {
diesel::update(person.find(person_id))
.set((last_refreshed_at.eq(naive_now()),))
.get_result::<Self>(conn)
}
- pub fn delete_account(conn: &PgConnection, person_id: PersonId) -> Result<Person, Error> {
+ pub fn delete_account(conn: &mut PgConnection, person_id: PersonId) -> Result<Person, Error> {
use crate::schema::local_user;
// Set the local user info to none
.get_result::<Self>(conn)
}
- pub fn upsert(conn: &PgConnection, person_form: &PersonForm) -> Result<Person, Error> {
+ pub fn upsert(conn: &mut PgConnection, person_form: &PersonForm) -> Result<Person, Error> {
insert_into(person)
.values(person_form)
.on_conflict(actor_id)
}
pub fn update_deleted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_id: PersonId,
new_deleted: bool,
) -> Result<Person, Error> {
.get_result::<Self>(conn)
}
- pub fn leave_admin(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ pub fn leave_admin(conn: &mut PgConnection, person_id: PersonId) -> Result<Self, Error> {
diesel::update(person.find(person_id))
.set(admin.eq(false))
.get_result::<Self>(conn)
}
- pub fn remove_avatar_and_banner(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ pub fn remove_avatar_and_banner(
+ conn: &mut PgConnection,
+ person_id: PersonId,
+ ) -> Result<Self, Error> {
diesel::update(person.find(person_id))
.set((
avatar.eq::<Option<String>>(None),
}
impl ApubActor for Person {
- fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error> {
+ fn read_from_apub_id(conn: &mut PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error> {
use crate::schema::person::dsl::*;
Ok(
person
}
fn read_from_name(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_name: &str,
include_deleted: bool,
) -> Result<Person, Error> {
}
fn read_from_name_and_domain(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_name: &str,
protocol_domain: &str,
) -> Result<Person, Error> {
#[test]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "holly".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let expected_person = Person {
id: inserted_person.id,
ban_expires: None,
};
- let read_person = Person::read(&conn, inserted_person.id).unwrap();
- let updated_person = Person::update(&conn, inserted_person.id, &new_person).unwrap();
- let num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
+ let read_person = Person::read(conn, inserted_person.id).unwrap();
+ let updated_person = Person::update(conn, inserted_person.id, &new_person).unwrap();
+ let num_deleted = Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(expected_person, read_person);
assert_eq!(expected_person, inserted_person);
impl PersonBlock {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_person_id: PersonId,
for_recipient_id: PersonId,
) -> Result<Self, Error> {
impl Blockable for PersonBlock {
type Form = PersonBlockForm;
- fn block(conn: &PgConnection, person_block_form: &PersonBlockForm) -> Result<Self, Error> {
+ fn block(conn: &mut PgConnection, person_block_form: &PersonBlockForm) -> Result<Self, Error> {
use crate::schema::person_block::dsl::*;
insert_into(person_block)
.values(person_block_form)
.set(person_block_form)
.get_result::<Self>(conn)
}
- fn unblock(conn: &PgConnection, person_block_form: &Self::Form) -> Result<usize, Error> {
+ fn unblock(conn: &mut PgConnection, person_block_form: &Self::Form) -> Result<usize, Error> {
use crate::schema::person_block::dsl::*;
diesel::delete(
person_block
impl Crud for PersonMention {
type Form = PersonMentionForm;
type IdType = PersonMentionId;
- fn read(conn: &PgConnection, person_mention_id: PersonMentionId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, person_mention_id: PersonMentionId) -> Result<Self, Error> {
use crate::schema::person_mention::dsl::*;
person_mention.find(person_mention_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, person_mention_form: &PersonMentionForm) -> Result<Self, Error> {
+ fn create(
+ conn: &mut PgConnection,
+ person_mention_form: &PersonMentionForm,
+ ) -> Result<Self, Error> {
use crate::schema::person_mention::dsl::*;
// since the return here isnt utilized, we dont need to do an update
// but get_result doesnt return the existing row here
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_mention_id: PersonMentionId,
person_mention_form: &PersonMentionForm,
) -> Result<Self, Error> {
impl PersonMention {
pub fn update_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_mention_id: PersonMentionId,
new_read: bool,
) -> Result<PersonMention, Error> {
}
pub fn mark_all_as_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_recipient_id: PersonId,
) -> Result<Vec<PersonMention>, Error> {
use crate::schema::person_mention::dsl::*;
.get_results::<Self>(conn)
}
pub fn read_by_comment_and_person(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_comment_id: CommentId,
for_recipient_id: PersonId,
) -> Result<Self, Error> {
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "terrylake".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let recipient_form = PersonForm {
name: "terrylakes recipient".into(),
..PersonForm::default()
};
- let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
+ let inserted_recipient = Person::create(conn, &recipient_form).unwrap();
let new_community = CommunityForm {
name: "test community lake".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
let person_mention_form = PersonMentionForm {
recipient_id: inserted_recipient.id,
read: None,
};
- let inserted_mention = PersonMention::create(&conn, &person_mention_form).unwrap();
+ let inserted_mention = PersonMention::create(conn, &person_mention_form).unwrap();
let expected_mention = PersonMention {
id: inserted_mention.id,
published: inserted_mention.published,
};
- let read_mention = PersonMention::read(&conn, inserted_mention.id).unwrap();
+ let read_mention = PersonMention::read(conn, inserted_mention.id).unwrap();
let updated_mention =
- PersonMention::update(&conn, inserted_mention.id, &person_mention_form).unwrap();
- Comment::delete(&conn, inserted_comment.id).unwrap();
- Post::delete(&conn, inserted_post.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
- Person::delete(&conn, inserted_recipient.id).unwrap();
+ PersonMention::update(conn, inserted_mention.id, &person_mention_form).unwrap();
+ Comment::delete(conn, inserted_comment.id).unwrap();
+ Post::delete(conn, inserted_post.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
+ Person::delete(conn, inserted_recipient.id).unwrap();
assert_eq!(expected_mention, read_mention);
assert_eq!(expected_mention, inserted_mention);
impl Crud for Post {
type Form = PostForm;
type IdType = PostId;
- fn read(conn: &PgConnection, post_id: PostId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, post_id: PostId) -> Result<Self, Error> {
use crate::schema::post::dsl::*;
post.find(post_id).first::<Self>(conn)
}
- fn delete(conn: &PgConnection, post_id: PostId) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, post_id: PostId) -> Result<usize, Error> {
use crate::schema::post::dsl::*;
diesel::delete(post.find(post_id)).execute(conn)
}
- fn create(conn: &PgConnection, new_post: &PostForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, new_post: &PostForm) -> Result<Self, Error> {
use crate::schema::post::dsl::*;
insert_into(post).values(new_post).get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, post_id: PostId, new_post: &PostForm) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, post_id: PostId, new_post: &PostForm) -> Result<Self, Error> {
use crate::schema::post::dsl::*;
diesel::update(post.find(post_id))
.set(new_post)
impl Post {
pub fn list_for_community(
- conn: &PgConnection,
+ conn: &mut PgConnection,
the_community_id: CommunityId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
.load::<Self>(conn)
}
- pub fn update_ap_id(conn: &PgConnection, post_id: PostId, apub_id: DbUrl) -> Result<Self, Error> {
+ pub fn update_ap_id(
+ conn: &mut PgConnection,
+ post_id: PostId,
+ apub_id: DbUrl,
+ ) -> Result<Self, Error> {
use crate::schema::post::dsl::*;
diesel::update(post.find(post_id))
}
pub fn permadelete_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
}
pub fn update_deleted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
post_id: PostId,
new_deleted: bool,
) -> Result<Self, Error> {
}
pub fn update_removed(
- conn: &PgConnection,
+ conn: &mut PgConnection,
post_id: PostId,
new_removed: bool,
) -> Result<Self, Error> {
}
pub fn update_removed_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
for_community_id: Option<CommunityId>,
new_removed: bool,
}
pub fn update_locked(
- conn: &PgConnection,
+ conn: &mut PgConnection,
post_id: PostId,
new_locked: bool,
) -> Result<Self, Error> {
}
pub fn update_stickied(
- conn: &PgConnection,
+ conn: &mut PgConnection,
post_id: PostId,
new_stickied: bool,
) -> Result<Self, Error> {
person_id == post_creator_id
}
- pub fn upsert(conn: &PgConnection, post_form: &PostForm) -> Result<Post, Error> {
+ pub fn upsert(conn: &mut PgConnection, post_form: &PostForm) -> Result<Post, Error> {
use crate::schema::post::dsl::*;
insert_into(post)
.values(post_form)
.set(post_form)
.get_result::<Self>(conn)
}
- pub fn read_from_apub_id(conn: &PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
+ pub fn read_from_apub_id(conn: &mut PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
use crate::schema::post::dsl::*;
let object_id: DbUrl = object_id.into();
Ok(
}
pub fn fetch_pictrs_posts_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
/// Sets the url and thumbnails fields to None
pub fn remove_pictrs_post_images_and_thumbnails_for_creator(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
}
pub fn fetch_pictrs_posts_for_community(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_community_id: CommunityId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
/// Sets the url and thumbnails fields to None
pub fn remove_pictrs_post_images_and_thumbnails_for_community(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_community_id: CommunityId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
impl Likeable for PostLike {
type Form = PostLikeForm;
type IdType = PostId;
- fn like(conn: &PgConnection, post_like_form: &PostLikeForm) -> Result<Self, Error> {
+ fn like(conn: &mut PgConnection, post_like_form: &PostLikeForm) -> Result<Self, Error> {
use crate::schema::post_like::dsl::*;
insert_into(post_like)
.values(post_like_form)
.set(post_like_form)
.get_result::<Self>(conn)
}
- fn remove(conn: &PgConnection, person_id: PersonId, post_id: PostId) -> Result<usize, Error> {
+ fn remove(conn: &mut PgConnection, person_id: PersonId, post_id: PostId) -> Result<usize, Error> {
use crate::schema::post_like::dsl;
diesel::delete(
dsl::post_like
impl Saveable for PostSaved {
type Form = PostSavedForm;
- fn save(conn: &PgConnection, post_saved_form: &PostSavedForm) -> Result<Self, Error> {
+ fn save(conn: &mut PgConnection, post_saved_form: &PostSavedForm) -> Result<Self, Error> {
use crate::schema::post_saved::dsl::*;
insert_into(post_saved)
.values(post_saved_form)
.set(post_saved_form)
.get_result::<Self>(conn)
}
- fn unsave(conn: &PgConnection, post_saved_form: &PostSavedForm) -> Result<usize, Error> {
+ fn unsave(conn: &mut PgConnection, post_saved_form: &PostSavedForm) -> Result<usize, Error> {
use crate::schema::post_saved::dsl::*;
diesel::delete(
post_saved
impl Readable for PostRead {
type Form = PostReadForm;
- fn mark_as_read(conn: &PgConnection, post_read_form: &PostReadForm) -> Result<Self, Error> {
+ fn mark_as_read(conn: &mut PgConnection, post_read_form: &PostReadForm) -> Result<Self, Error> {
use crate::schema::post_read::dsl::*;
insert_into(post_read)
.values(post_read_form)
.get_result::<Self>(conn)
}
- fn mark_as_unread(conn: &PgConnection, post_read_form: &PostReadForm) -> Result<usize, Error> {
+ fn mark_as_unread(
+ conn: &mut PgConnection,
+ post_read_form: &PostReadForm,
+ ) -> Result<usize, Error> {
use crate::schema::post_read::dsl::*;
diesel::delete(
post_read
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "jim".into(),
..PersonForm::default()
};
- let inserted_person = Person::create(&conn, &new_person).unwrap();
+ let inserted_person = Person::create(conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "test community_3".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let expected_post = Post {
id: inserted_post.id,
score: 1,
};
- let inserted_post_like = PostLike::like(&conn, &post_like_form).unwrap();
+ let inserted_post_like = PostLike::like(conn, &post_like_form).unwrap();
let expected_post_like = PostLike {
id: inserted_post_like.id,
person_id: inserted_person.id,
};
- let inserted_post_saved = PostSaved::save(&conn, &post_saved_form).unwrap();
+ let inserted_post_saved = PostSaved::save(conn, &post_saved_form).unwrap();
let expected_post_saved = PostSaved {
id: inserted_post_saved.id,
person_id: inserted_person.id,
};
- let inserted_post_read = PostRead::mark_as_read(&conn, &post_read_form).unwrap();
+ let inserted_post_read = PostRead::mark_as_read(conn, &post_read_form).unwrap();
let expected_post_read = PostRead {
id: inserted_post_read.id,
published: inserted_post_read.published,
};
- let read_post = Post::read(&conn, inserted_post.id).unwrap();
- let updated_post = Post::update(&conn, inserted_post.id, &new_post).unwrap();
- let like_removed = PostLike::remove(&conn, inserted_person.id, inserted_post.id).unwrap();
- let saved_removed = PostSaved::unsave(&conn, &post_saved_form).unwrap();
- let read_removed = PostRead::mark_as_unread(&conn, &post_read_form).unwrap();
- let num_deleted = Post::delete(&conn, inserted_post.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
- Person::delete(&conn, inserted_person.id).unwrap();
+ let read_post = Post::read(conn, inserted_post.id).unwrap();
+ let updated_post = Post::update(conn, inserted_post.id, &new_post).unwrap();
+ let like_removed = PostLike::remove(conn, inserted_person.id, inserted_post.id).unwrap();
+ let saved_removed = PostSaved::unsave(conn, &post_saved_form).unwrap();
+ let read_removed = PostRead::mark_as_unread(conn, &post_read_form).unwrap();
+ let num_deleted = Post::delete(conn, inserted_post.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_person.id).unwrap();
assert_eq!(expected_post, read_post);
assert_eq!(expected_post, inserted_post);
///
/// * `conn` - the postgres connection
/// * `post_report_form` - the filled CommentReportForm to insert
- fn report(conn: &PgConnection, post_report_form: &PostReportForm) -> Result<Self, Error> {
+ fn report(conn: &mut PgConnection, post_report_form: &PostReportForm) -> Result<Self, Error> {
use crate::schema::post_report::dsl::*;
insert_into(post_report)
.values(post_report_form)
/// * `report_id` - the id of the report to resolve
/// * `by_resolver_id` - the id of the user resolving the report
fn resolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
/// * `report_id` - the id of the report to unresolve
/// * `by_resolver_id` - the id of the user unresolving the report
fn unresolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
impl Crud for PrivateMessage {
type Form = PrivateMessageForm;
type IdType = PrivateMessageId;
- fn read(conn: &PgConnection, private_message_id: PrivateMessageId) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, private_message_id: PrivateMessageId) -> Result<Self, Error> {
use crate::schema::private_message::dsl::*;
private_message.find(private_message_id).first::<Self>(conn)
}
- fn create(conn: &PgConnection, private_message_form: &PrivateMessageForm) -> Result<Self, Error> {
+ fn create(
+ conn: &mut PgConnection,
+ private_message_form: &PrivateMessageForm,
+ ) -> Result<Self, Error> {
use crate::schema::private_message::dsl::*;
insert_into(private_message)
.values(private_message_form)
}
fn update(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_id: PrivateMessageId,
private_message_form: &PrivateMessageForm,
) -> Result<Self, Error> {
.set(private_message_form)
.get_result::<Self>(conn)
}
- fn delete(conn: &PgConnection, pm_id: Self::IdType) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, pm_id: Self::IdType) -> Result<usize, Error> {
use crate::schema::private_message::dsl::*;
diesel::delete(private_message.find(pm_id)).execute(conn)
}
impl PrivateMessage {
pub fn update_ap_id(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_id: PrivateMessageId,
apub_id: DbUrl,
) -> Result<PrivateMessage, Error> {
}
pub fn update_content(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_id: PrivateMessageId,
new_content: &str,
) -> Result<PrivateMessage, Error> {
}
pub fn update_deleted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_id: PrivateMessageId,
new_deleted: bool,
) -> Result<PrivateMessage, Error> {
}
pub fn update_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_id: PrivateMessageId,
new_read: bool,
) -> Result<PrivateMessage, Error> {
}
pub fn mark_all_as_read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
for_recipient_id: PersonId,
) -> Result<Vec<PrivateMessage>, Error> {
use crate::schema::private_message::dsl::*;
}
pub fn upsert(
- conn: &PgConnection,
+ conn: &mut PgConnection,
private_message_form: &PrivateMessageForm,
) -> Result<PrivateMessage, Error> {
use crate::schema::private_message::dsl::*;
}
pub fn read_from_apub_id(
- conn: &PgConnection,
+ conn: &mut PgConnection,
object_id: Url,
) -> Result<Option<Self>, LemmyError> {
use crate::schema::private_message::dsl::*;
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let creator_form = PersonForm {
name: "creator_pm".into(),
..PersonForm::default()
};
- let inserted_creator = Person::create(&conn, &creator_form).unwrap();
+ let inserted_creator = Person::create(conn, &creator_form).unwrap();
let recipient_form = PersonForm {
name: "recipient_pm".into(),
..PersonForm::default()
};
- let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
+ let inserted_recipient = Person::create(conn, &recipient_form).unwrap();
let private_message_form = PrivateMessageForm {
content: "A test private message".into(),
..PrivateMessageForm::default()
};
- let inserted_private_message = PrivateMessage::create(&conn, &private_message_form).unwrap();
+ let inserted_private_message = PrivateMessage::create(conn, &private_message_form).unwrap();
let expected_private_message = PrivateMessage {
id: inserted_private_message.id,
local: true,
};
- let read_private_message = PrivateMessage::read(&conn, inserted_private_message.id).unwrap();
+ let read_private_message = PrivateMessage::read(conn, inserted_private_message.id).unwrap();
let updated_private_message =
- PrivateMessage::update(&conn, inserted_private_message.id, &private_message_form).unwrap();
+ PrivateMessage::update(conn, inserted_private_message.id, &private_message_form).unwrap();
let deleted_private_message =
- PrivateMessage::update_deleted(&conn, inserted_private_message.id, true).unwrap();
+ PrivateMessage::update_deleted(conn, inserted_private_message.id, true).unwrap();
let marked_read_private_message =
- PrivateMessage::update_read(&conn, inserted_private_message.id, true).unwrap();
- Person::delete(&conn, inserted_creator.id).unwrap();
- Person::delete(&conn, inserted_recipient.id).unwrap();
+ PrivateMessage::update_read(conn, inserted_private_message.id, true).unwrap();
+ Person::delete(conn, inserted_creator.id).unwrap();
+ Person::delete(conn, inserted_recipient.id).unwrap();
assert_eq!(expected_private_message, read_private_message);
assert_eq!(expected_private_message, updated_private_message);
///
/// * `conn` - the postgres connection
/// * `comment_report_form` - the filled CommentReportForm to insert
- fn report(conn: &PgConnection, pm_report_form: &PrivateMessageReportForm) -> Result<Self, Error> {
+ fn report(
+ conn: &mut PgConnection,
+ pm_report_form: &PrivateMessageReportForm,
+ ) -> Result<Self, Error> {
use crate::schema::private_message_report::dsl::*;
insert_into(private_message_report)
.values(pm_report_form)
/// * `report_id` - the id of the report to resolve
/// * `by_resolver_id` - the id of the user resolving the report
fn resolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
/// * `report_id` - the id of the report to unresolve
/// * `by_resolver_id` - the id of the user unresolving the report
fn unresolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
by_resolver_id: PersonId,
) -> Result<usize, Error> {
impl Crud for RegistrationApplication {
type Form = RegistrationApplicationForm;
type IdType = i32;
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::registration_application::dsl::*;
insert_into(registration_application)
.values(form)
.get_result::<Self>(conn)
}
- fn read(conn: &PgConnection, id_: Self::IdType) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, id_: Self::IdType) -> Result<Self, Error> {
use crate::schema::registration_application::dsl::*;
registration_application.find(id_).first::<Self>(conn)
}
- fn update(conn: &PgConnection, id_: Self::IdType, form: &Self::Form) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, id_: Self::IdType, form: &Self::Form) -> Result<Self, Error> {
use crate::schema::registration_application::dsl::*;
diesel::update(registration_application.find(id_))
.set(form)
.get_result::<Self>(conn)
}
- fn delete(conn: &PgConnection, id_: Self::IdType) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, id_: Self::IdType) -> Result<usize, Error> {
use crate::schema::registration_application::dsl::*;
diesel::delete(registration_application.find(id_)).execute(conn)
}
impl RegistrationApplication {
pub fn find_by_local_user_id(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id_: LocalUserId,
) -> Result<Self, Error> {
use crate::schema::registration_application::dsl::*;
impl Secret {
/// Initialize the Secrets from the DB.
/// Warning: You should only call this once.
- pub fn init(conn: &PgConnection) -> Result<Secret, Error> {
+ pub fn init(conn: &mut PgConnection) -> Result<Secret, Error> {
read_secrets(conn)
}
}
-fn read_secrets(conn: &PgConnection) -> Result<Secret, Error> {
+fn read_secrets(conn: &mut PgConnection) -> Result<Secret, Error> {
use crate::schema::secret::dsl::*;
secret.first::<Secret>(conn)
}
impl Crud for Site {
type Form = SiteForm;
type IdType = i32;
- fn read(conn: &PgConnection, _site_id: i32) -> Result<Self, Error> {
+ fn read(conn: &mut PgConnection, _site_id: i32) -> Result<Self, Error> {
use crate::schema::site::dsl::*;
site.first::<Self>(conn)
}
- fn create(conn: &PgConnection, new_site: &SiteForm) -> Result<Self, Error> {
+ fn create(conn: &mut PgConnection, new_site: &SiteForm) -> Result<Self, Error> {
use crate::schema::site::dsl::*;
insert_into(site).values(new_site).get_result::<Self>(conn)
}
- fn update(conn: &PgConnection, site_id: i32, new_site: &SiteForm) -> Result<Self, Error> {
+ fn update(conn: &mut PgConnection, site_id: i32, new_site: &SiteForm) -> Result<Self, Error> {
use crate::schema::site::dsl::*;
diesel::update(site.find(site_id))
.set(new_site)
.get_result::<Self>(conn)
}
- fn delete(conn: &PgConnection, site_id: i32) -> Result<usize, Error> {
+ fn delete(conn: &mut PgConnection, site_id: i32) -> Result<usize, Error> {
use crate::schema::site::dsl::*;
diesel::delete(site.find(site_id)).execute(conn)
}
}
impl Site {
- pub fn read_local_site(conn: &PgConnection) -> Result<Self, Error> {
+ pub fn read_local_site(conn: &mut PgConnection) -> Result<Self, Error> {
use crate::schema::site::dsl::*;
site.order_by(id).first::<Self>(conn)
}
- pub fn upsert(conn: &PgConnection, site_form: &SiteForm) -> Result<Site, Error> {
+ pub fn upsert(conn: &mut PgConnection, site_form: &SiteForm) -> Result<Site, Error> {
use crate::schema::site::dsl::*;
insert_into(site)
.values(site_form)
.get_result::<Self>(conn)
}
- pub fn read_from_apub_id(conn: &PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
+ pub fn read_from_apub_id(conn: &mut PgConnection, object_id: Url) -> Result<Option<Self>, Error> {
use crate::schema::site::dsl::*;
let object_id: DbUrl = object_id.into();
Ok(
)
}
- pub fn read_remote_sites(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn read_remote_sites(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
use crate::schema::site::dsl::*;
site.order_by(id).offset(1).get_results::<Self>(conn)
}
Old,
}
-#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
pub enum ListingType {
All,
Local,
Url,
}
-#[derive(EnumString, Display, Debug, PartialEq, Serialize, Deserialize, Clone, Copy)]
+#[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
pub enum SubscribedType {
Subscribed,
NotSubscribed,
Pending,
}
-#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
pub enum ModlogActionType {
All,
ModRemovePost,
pub struct CommentReplyId(i32);
#[repr(transparent)]
-#[derive(Clone, PartialEq, Serialize, Deserialize, Debug)]
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow))]
-#[cfg_attr(feature = "full", sql_type = "diesel::sql_types::Text")]
+#[cfg_attr(feature = "full", diesel(sql_type = diesel::sql_types::Text))]
pub struct DbUrl(pub(crate) Url);
#[derive(Serialize, Deserialize)]
}
}
-// These are necessary since diesel doesn't have self joins / aliases
-table! {
- person_alias_1 (id) {
- id -> Int4,
- name -> Varchar,
- display_name -> Nullable<Varchar>,
- avatar -> Nullable<Varchar>,
- banned -> Bool,
- published -> Timestamp,
- updated -> Nullable<Timestamp>,
- actor_id -> Varchar,
- bio -> Nullable<Text>,
- local -> Bool,
- private_key -> Nullable<Text>,
- public_key -> Text,
- last_refreshed_at -> Timestamp,
- banner -> Nullable<Varchar>,
- deleted -> Bool,
- inbox_url -> Varchar,
- shared_inbox_url -> Nullable<Varchar>,
- matrix_user_id -> Nullable<Text>,
- admin -> Bool,
- bot_account -> Bool,
- ban_expires -> Nullable<Timestamp>,
- }
-}
-
-table! {
- person_alias_2 (id) {
- id -> Int4,
- name -> Varchar,
- display_name -> Nullable<Varchar>,
- avatar -> Nullable<Varchar>,
- banned -> Bool,
- published -> Timestamp,
- updated -> Nullable<Timestamp>,
- actor_id -> Varchar,
- bio -> Nullable<Text>,
- local -> Bool,
- private_key -> Nullable<Text>,
- public_key -> Text,
- last_refreshed_at -> Timestamp,
- banner -> Nullable<Varchar>,
- deleted -> Bool,
- inbox_url -> Varchar,
- shared_inbox_url -> Nullable<Varchar>,
- matrix_user_id -> Nullable<Text>,
- admin -> Bool,
- bot_account -> Bool,
- ban_expires -> Nullable<Timestamp>,
- }
-}
-
table! {
secret(id) {
id -> Int4,
}
}
-joinable!(person_mention -> person_alias_1 (recipient_id));
-joinable!(comment_reply -> person_alias_1 (recipient_id));
-joinable!(post -> person_alias_1 (creator_id));
-joinable!(comment -> person_alias_1 (creator_id));
-joinable!(private_message_report -> person_alias_1 (resolver_id));
-
-joinable!(post_report -> person_alias_2 (resolver_id));
-joinable!(comment_report -> person_alias_2 (resolver_id));
-joinable!(private_message_report -> person_alias_2 (resolver_id));
-
joinable!(person_block -> person (person_id));
-joinable!(person_block -> person_alias_1 (target_id));
joinable!(comment -> person (creator_id));
joinable!(comment -> post (post_id));
private_message_report,
site,
site_aggregates,
- person_alias_1,
- person_alias_2,
admin_purge_comment,
admin_purge_community,
admin_purge_person,
use serde_json::Value;
use std::fmt::Debug;
-#[derive(PartialEq, Debug, Queryable, Identifiable)]
-#[table_name = "activity"]
+#[derive(PartialEq, Eq, Debug, Queryable, Identifiable)]
+#[diesel(table_name = activity)]
pub struct Activity {
pub id: i32,
pub data: Value,
}
#[derive(Insertable, AsChangeset)]
-#[table_name = "activity"]
+#[diesel(table_name = activity)]
pub struct ActivityForm {
pub data: Value,
pub local: Option<bool>,
#[cfg(feature = "full")]
use crate::schema::{comment, comment_like, comment_saved};
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::post::Post))]
-#[cfg_attr(feature = "full", table_name = "comment")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
+#[cfg_attr(feature = "full", diesel(table_name = comment))]
pub struct Comment {
pub id: CommentId,
pub creator_id: PersonId,
#[derive(Clone, Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "comment")]
+#[cfg_attr(feature = "full", diesel(table_name = comment))]
pub struct CommentForm {
pub creator_id: PersonId,
pub post_id: PostId,
pub language_id: Option<LanguageId>,
}
-#[derive(PartialEq, Debug, Clone)]
+#[derive(PartialEq, Eq, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Comment))]
-#[cfg_attr(feature = "full", table_name = "comment_like")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", diesel(table_name = comment_like))]
pub struct CommentLike {
pub id: i32,
pub person_id: PersonId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "comment_like")]
+#[cfg_attr(feature = "full", diesel(table_name = comment_like))]
pub struct CommentLikeForm {
pub person_id: PersonId,
pub comment_id: CommentId,
pub score: i16,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Comment))]
-#[cfg_attr(feature = "full", table_name = "comment_saved")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", diesel(table_name = comment_saved))]
pub struct CommentSaved {
pub id: i32,
pub comment_id: CommentId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "comment_saved")]
+#[cfg_attr(feature = "full", diesel(table_name = comment_saved))]
pub struct CommentSavedForm {
pub comment_id: CommentId,
pub person_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::comment_reply;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::comment::Comment))]
-#[cfg_attr(feature = "full", table_name = "comment_reply")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
/// This table keeps a list of replies to comments and posts.
pub struct CommentReply {
pub id: CommentReplyId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "comment_reply")]
+#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
pub struct CommentReplyForm {
pub recipient_id: PersonId,
pub comment_id: CommentId,
#[cfg(feature = "full")]
use crate::schema::comment_report;
-#[derive(PartialEq, Serialize, Deserialize, Debug, Clone)]
+#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::comment::Comment))]
-#[cfg_attr(feature = "full", table_name = "comment_report")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
pub struct CommentReport {
pub id: CommentReportId,
pub creator_id: PersonId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "comment_report")]
+#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
pub struct CommentReportForm {
pub creator_id: PersonId,
pub comment_id: CommentId,
#[cfg(feature = "full")]
use crate::schema::{community, community_follower, community_moderator, community_person_ban};
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "community")]
+#[cfg_attr(feature = "full", diesel(table_name = community))]
pub struct Community {
pub id: CommunityId,
pub name: String,
}
/// A safe representation of community, without the sensitive info
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "community")]
+#[cfg_attr(feature = "full", diesel(table_name = community))]
pub struct CommunitySafe {
pub id: CommunityId,
pub name: String,
#[derive(Debug, Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "community")]
+#[cfg_attr(feature = "full", diesel(table_name = community))]
pub struct CommunityForm {
pub name: String,
pub title: String,
pub posting_restricted_to_mods: Option<bool>,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Community))]
-#[cfg_attr(feature = "full", table_name = "community_moderator")]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::community::Community))
+)]
+#[cfg_attr(feature = "full", diesel(table_name = community_moderator))]
pub struct CommunityModerator {
pub id: i32,
pub community_id: CommunityId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "community_moderator")]
+#[cfg_attr(feature = "full", diesel(table_name = community_moderator))]
pub struct CommunityModeratorForm {
pub community_id: CommunityId,
pub person_id: PersonId,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Community))]
-#[cfg_attr(feature = "full", table_name = "community_person_ban")]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::community::Community))
+)]
+#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
pub struct CommunityPersonBan {
pub id: i32,
pub community_id: CommunityId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "community_person_ban")]
+#[cfg_attr(feature = "full", diesel(table_name = community_person_ban))]
pub struct CommunityPersonBanForm {
pub community_id: CommunityId,
pub person_id: PersonId,
pub expires: Option<Option<chrono::NaiveDateTime>>,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Community))]
-#[cfg_attr(feature = "full", table_name = "community_follower")]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::community::Community))
+)]
+#[cfg_attr(feature = "full", diesel(table_name = community_follower))]
pub struct CommunityFollower {
pub id: i32,
pub community_id: CommunityId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "community_follower")]
+#[cfg_attr(feature = "full", diesel(table_name = community_follower))]
pub struct CommunityFollowerForm {
pub community_id: CommunityId,
pub person_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::community_block;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::community::Community))]
-#[cfg_attr(feature = "full", table_name = "community_block")]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::community::Community))
+)]
+#[cfg_attr(feature = "full", diesel(table_name = community_block))]
pub struct CommunityBlock {
pub id: CommunityBlockId,
pub person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "community_block")]
+#[cfg_attr(feature = "full", diesel(table_name = community_block))]
pub struct CommunityBlockForm {
pub person_id: PersonId,
pub community_id: CommunityId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "email_verification")]
+#[cfg_attr(feature = "full", diesel(table_name = email_verification))]
pub struct EmailVerification {
pub id: i32,
pub local_user_id: LocalUserId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "email_verification")]
+#[cfg_attr(feature = "full", diesel(table_name = email_verification))]
pub struct EmailVerificationForm {
pub local_user_id: LocalUserId,
pub email: String,
#[cfg(feature = "full")]
use crate::schema::language;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "language")]
+#[cfg_attr(feature = "full", diesel(table_name = language))]
pub struct Language {
pub id: LanguageId,
pub code: String,
#[cfg(feature = "full")]
use crate::schema::local_user;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "local_user")]
+#[cfg_attr(feature = "full", diesel(table_name = local_user))]
pub struct LocalUser {
pub id: LocalUserId,
pub person_id: PersonId,
// TODO redo these, check table defaults
#[derive(Clone, Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "local_user")]
+#[cfg_attr(feature = "full", diesel(table_name = local_user))]
pub struct LocalUserForm {
pub person_id: Option<PersonId>,
pub password_encrypted: Option<String>,
}
/// A local user view that removes password encrypted
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "local_user")]
+#[cfg_attr(feature = "full", diesel(table_name = local_user))]
pub struct LocalUserSettings {
pub id: LocalUserId,
pub person_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::local_user_language;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "local_user_language")]
+#[cfg_attr(feature = "full", diesel(table_name = local_user_language))]
pub struct LocalUserLanguage {
#[serde(skip)]
pub id: LocalUserLanguageId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "local_user_language")]
+#[cfg_attr(feature = "full", diesel(table_name = local_user_language))]
pub struct LocalUserLanguageForm {
pub local_user_id: LocalUserId,
pub language_id: LanguageId,
mod_transfer_community,
};
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
pub struct ModRemovePost {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
pub struct ModRemovePostForm {
pub mod_person_id: PersonId,
pub post_id: PostId,
pub removed: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_lock_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
pub struct ModLockPost {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_lock_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
pub struct ModLockPostForm {
pub mod_person_id: PersonId,
pub post_id: PostId,
pub locked: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_sticky_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
pub struct ModStickyPost {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_sticky_post")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
pub struct ModStickyPostForm {
pub mod_person_id: PersonId,
pub post_id: PostId,
pub stickied: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_comment")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
pub struct ModRemoveComment {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_comment")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
pub struct ModRemoveCommentForm {
pub mod_person_id: PersonId,
pub comment_id: CommentId,
pub removed: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
pub struct ModRemoveCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_remove_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
pub struct ModRemoveCommunityForm {
pub mod_person_id: PersonId,
pub community_id: CommunityId,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_ban_from_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
pub struct ModBanFromCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_ban_from_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
pub struct ModBanFromCommunityForm {
pub mod_person_id: PersonId,
pub other_person_id: PersonId,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_ban")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
pub struct ModBan {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_hide_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
pub struct ModHideCommunityForm {
pub community_id: CommunityId,
pub mod_person_id: PersonId,
pub hidden: Option<bool>,
pub reason: Option<String>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_hide_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
pub struct ModHideCommunity {
pub id: i32,
pub community_id: CommunityId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_ban")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
pub struct ModBanForm {
pub mod_person_id: PersonId,
pub other_person_id: PersonId,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_add_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
pub struct ModAddCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_add_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
pub struct ModAddCommunityForm {
pub mod_person_id: PersonId,
pub other_person_id: PersonId,
pub removed: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_transfer_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
pub struct ModTransferCommunity {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_transfer_community")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
pub struct ModTransferCommunityForm {
pub mod_person_id: PersonId,
pub other_person_id: PersonId,
pub removed: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "mod_add")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_add))]
pub struct ModAdd {
pub id: i32,
pub mod_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "mod_add")]
+#[cfg_attr(feature = "full", diesel(table_name = mod_add))]
pub struct ModAddForm {
pub mod_person_id: PersonId,
pub other_person_id: PersonId,
pub removed: Option<bool>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_person")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
pub struct AdminPurgePerson {
pub id: i32,
pub admin_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_person")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
pub struct AdminPurgePersonForm {
pub admin_person_id: PersonId,
pub reason: Option<String>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_community")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
pub struct AdminPurgeCommunity {
pub id: i32,
pub admin_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_community")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
pub struct AdminPurgeCommunityForm {
pub admin_person_id: PersonId,
pub reason: Option<String>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_post")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
pub struct AdminPurgePost {
pub id: i32,
pub admin_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_post")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
pub struct AdminPurgePostForm {
pub admin_person_id: PersonId,
pub community_id: CommunityId,
pub reason: Option<String>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_comment")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
pub struct AdminPurgeComment {
pub id: i32,
pub admin_person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "admin_purge_comment")]
+#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
pub struct AdminPurgeCommentForm {
pub admin_person_id: PersonId,
pub post_id: PostId,
#[cfg(feature = "full")]
use crate::schema::password_reset_request;
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "password_reset_request")]
+#[cfg_attr(feature = "full", diesel(table_name = password_reset_request))]
pub struct PasswordResetRequest {
pub id: i32,
pub token_encrypted: String,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "password_reset_request")]
+#[cfg_attr(feature = "full", diesel(table_name = password_reset_request))]
pub struct PasswordResetRequestForm {
pub local_user_id: LocalUserId,
pub token_encrypted: String,
use serde::{Deserialize, Serialize};
#[cfg(feature = "full")]
-use crate::schema::{person, person_alias_1, person_alias_2};
+use crate::schema::person;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person")]
+#[cfg_attr(feature = "full", diesel(table_name = person))]
pub struct Person {
pub id: PersonId,
pub name: String,
}
/// A safe representation of person, without the sensitive info
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person")]
+#[cfg_attr(feature = "full", diesel(table_name = person))]
pub struct PersonSafe {
pub id: PersonId,
pub name: String,
pub ban_expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_alias_1")]
-pub struct PersonAlias1 {
- pub id: PersonId,
- pub name: String,
- pub display_name: Option<String>,
- pub avatar: Option<DbUrl>,
- pub banned: bool,
- pub published: chrono::NaiveDateTime,
- pub updated: Option<chrono::NaiveDateTime>,
- pub actor_id: DbUrl,
- pub bio: Option<String>,
- pub local: bool,
- pub private_key: Option<String>,
- pub public_key: String,
- pub last_refreshed_at: chrono::NaiveDateTime,
- pub banner: Option<DbUrl>,
- pub deleted: bool,
- pub inbox_url: DbUrl,
- pub shared_inbox_url: Option<DbUrl>,
- pub matrix_user_id: Option<String>,
- pub admin: bool,
- pub bot_account: bool,
- pub ban_expires: Option<chrono::NaiveDateTime>,
-}
-
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_alias_1")]
-pub struct PersonSafeAlias1 {
- pub id: PersonId,
- pub name: String,
- pub display_name: Option<String>,
- pub avatar: Option<DbUrl>,
- pub banned: bool,
- pub published: chrono::NaiveDateTime,
- pub updated: Option<chrono::NaiveDateTime>,
- pub actor_id: DbUrl,
- pub bio: Option<String>,
- pub local: bool,
- pub banner: Option<DbUrl>,
- pub deleted: bool,
- pub inbox_url: DbUrl,
- pub shared_inbox_url: Option<DbUrl>,
- pub matrix_user_id: Option<String>,
- pub admin: bool,
- pub bot_account: bool,
- pub ban_expires: Option<chrono::NaiveDateTime>,
-}
-
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_alias_2")]
-pub struct PersonAlias2 {
- pub id: PersonId,
- pub name: String,
- pub display_name: Option<String>,
- pub avatar: Option<DbUrl>,
- pub banned: bool,
- pub published: chrono::NaiveDateTime,
- pub updated: Option<chrono::NaiveDateTime>,
- pub actor_id: DbUrl,
- pub bio: Option<String>,
- pub local: bool,
- pub private_key: Option<String>,
- pub public_key: String,
- pub last_refreshed_at: chrono::NaiveDateTime,
- pub banner: Option<DbUrl>,
- pub deleted: bool,
- pub inbox_url: DbUrl,
- pub shared_inbox_url: Option<DbUrl>,
- pub matrix_user_id: Option<String>,
- pub admin: bool,
- pub bot_account: bool,
- pub ban_expires: Option<chrono::NaiveDateTime>,
-}
-
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
-#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_alias_1")]
-pub struct PersonSafeAlias2 {
- pub id: PersonId,
- pub name: String,
- pub display_name: Option<String>,
- pub avatar: Option<DbUrl>,
- pub banned: bool,
- pub published: chrono::NaiveDateTime,
- pub updated: Option<chrono::NaiveDateTime>,
- pub actor_id: DbUrl,
- pub bio: Option<String>,
- pub local: bool,
- pub banner: Option<DbUrl>,
- pub deleted: bool,
- pub inbox_url: DbUrl,
- pub shared_inbox_url: Option<DbUrl>,
- pub matrix_user_id: Option<String>,
- pub admin: bool,
- pub bot_account: bool,
- pub ban_expires: Option<chrono::NaiveDateTime>,
-}
-
#[derive(Clone, Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "person")]
+#[cfg_attr(feature = "full", diesel(table_name = person))]
pub struct PersonForm {
pub name: String,
pub display_name: Option<Option<String>>,
#[cfg(feature = "full")]
use crate::schema::person_block;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "person_block")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
+#[cfg_attr(feature = "full", diesel(table_name = person_block))]
pub struct PersonBlock {
pub id: PersonBlockId,
pub person_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "person_block")]
+#[cfg_attr(feature = "full", diesel(table_name = person_block))]
pub struct PersonBlockForm {
pub person_id: PersonId,
pub target_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::person_mention;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::comment::Comment))]
-#[cfg_attr(feature = "full", table_name = "person_mention")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
+#[cfg_attr(feature = "full", diesel(table_name = person_mention))]
pub struct PersonMention {
pub id: PersonMentionId,
pub recipient_id: PersonId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "person_mention")]
+#[cfg_attr(feature = "full", diesel(table_name = person_mention))]
pub struct PersonMentionForm {
pub recipient_id: PersonId,
pub comment_id: CommentId,
#[cfg(feature = "full")]
use crate::schema::{post, post_like, post_read, post_saved};
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "post")]
+#[cfg_attr(feature = "full", diesel(table_name = post))]
pub struct Post {
pub id: PostId,
pub name: String,
#[derive(Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "post")]
+#[cfg_attr(feature = "full", diesel(table_name = post))]
pub struct PostForm {
pub name: String,
pub creator_id: PersonId,
pub language_id: Option<LanguageId>,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Post))]
-#[cfg_attr(feature = "full", table_name = "post_like")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
+#[cfg_attr(feature = "full", diesel(table_name = post_like))]
pub struct PostLike {
pub id: i32,
pub post_id: PostId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "post_like")]
+#[cfg_attr(feature = "full", diesel(table_name = post_like))]
pub struct PostLikeForm {
pub post_id: PostId,
pub person_id: PersonId,
pub score: i16,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Post))]
-#[cfg_attr(feature = "full", table_name = "post_saved")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
+#[cfg_attr(feature = "full", diesel(table_name = post_saved))]
pub struct PostSaved {
pub id: i32,
pub post_id: PostId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "post_saved")]
+#[cfg_attr(feature = "full", diesel(table_name = post_saved))]
pub struct PostSavedForm {
pub post_id: PostId,
pub person_id: PersonId,
}
-#[derive(PartialEq, Debug)]
+#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(Post))]
-#[cfg_attr(feature = "full", table_name = "post_read")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
+#[cfg_attr(feature = "full", diesel(table_name = post_read))]
pub struct PostRead {
pub id: i32,
pub post_id: PostId,
}
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "post_read")]
+#[cfg_attr(feature = "full", diesel(table_name = post_read))]
pub struct PostReadForm {
pub post_id: PostId,
pub person_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::post_report;
-#[derive(PartialEq, Serialize, Deserialize, Debug, Clone)]
+#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
-#[cfg_attr(feature = "full", belongs_to(crate::source::post::Post))]
-#[cfg_attr(feature = "full", table_name = "post_report")]
+#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
+#[cfg_attr(feature = "full", diesel(table_name = post_report))]
pub struct PostReport {
pub id: PostReportId,
pub creator_id: PersonId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "post_report")]
+#[cfg_attr(feature = "full", diesel(table_name = post_report))]
pub struct PostReportForm {
pub creator_id: PersonId,
pub post_id: PostId,
#[cfg(feature = "full")]
use crate::schema::private_message;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "private_message")]
+#[cfg_attr(
+ feature = "full",
+ diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id)
+))] // Is this the right assoc?
+#[cfg_attr(feature = "full", diesel(table_name = private_message))]
pub struct PrivateMessage {
pub id: PrivateMessageId,
pub creator_id: PersonId,
#[derive(Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "private_message")]
+#[cfg_attr(feature = "full", diesel(table_name = private_message))]
pub struct PrivateMessageForm {
pub creator_id: PersonId,
pub recipient_id: PersonId,
#[cfg(feature = "full")]
use crate::schema::private_message_report;
-#[derive(PartialEq, Serialize, Deserialize, Debug, Clone)]
+#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
#[cfg_attr(
feature = "full",
- belongs_to(crate::source::private_message::PrivateMessage)
+ diesel(belongs_to(crate::source::private_message::PrivateMessage))
)]
-#[cfg_attr(feature = "full", table_name = "private_message_report")]
+#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
pub struct PrivateMessageReport {
pub id: PrivateMessageReportId,
pub creator_id: PersonId,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "private_message_report")]
+#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
pub struct PrivateMessageReportForm {
pub creator_id: PersonId,
pub private_message_id: PrivateMessageId,
#[cfg(feature = "full")]
use crate::schema::registration_application;
-#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "registration_application")]
+#[cfg_attr(feature = "full", diesel(table_name = registration_application))]
pub struct RegistrationApplication {
pub id: i32,
pub local_user_id: LocalUserId,
#[derive(Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "registration_application")]
+#[cfg_attr(feature = "full", diesel(table_name = registration_application))]
pub struct RegistrationApplicationForm {
pub local_user_id: Option<LocalUserId>,
pub answer: Option<String>,
#[derive(Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "secret")]
+#[cfg_attr(feature = "full", diesel(table_name = secret))]
pub struct Secret {
pub id: i32,
pub jwt_secret: String,
#[cfg(feature = "full")]
use crate::schema::site;
-#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
+#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", table_name = "site")]
+#[cfg_attr(feature = "full", diesel(table_name = site))]
pub struct Site {
pub id: i32,
pub name: String,
#[derive(Default)]
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", table_name = "site")]
+#[cfg_attr(feature = "full", diesel(table_name = site))]
pub struct SiteForm {
pub name: String,
pub sidebar: Option<Option<String>>,
pub trait Crud {
type Form;
type IdType;
- fn create(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn create(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn read(conn: &PgConnection, id: Self::IdType) -> Result<Self, Error>
+ fn read(conn: &mut PgConnection, id: Self::IdType) -> Result<Self, Error>
where
Self: Sized;
- fn update(conn: &PgConnection, id: Self::IdType, form: &Self::Form) -> Result<Self, Error>
+ fn update(conn: &mut PgConnection, id: Self::IdType, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn delete(_conn: &PgConnection, _id: Self::IdType) -> Result<usize, Error>
+ fn delete(_conn: &mut PgConnection, _id: Self::IdType) -> Result<usize, Error>
where
Self: Sized,
{
pub trait Followable {
type Form;
- fn follow(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn follow(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
fn follow_accepted(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
person_id: PersonId,
) -> Result<Self, Error>
where
Self: Sized;
- fn unfollow(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn unfollow(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
- fn has_local_followers(conn: &PgConnection, community_id: CommunityId) -> Result<bool, Error>;
+ fn has_local_followers(conn: &mut PgConnection, community_id: CommunityId)
+ -> Result<bool, Error>;
}
pub trait Joinable {
type Form;
- fn join(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn join(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn leave(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn leave(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
}
pub trait Likeable {
type Form;
type IdType;
- fn like(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn like(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
fn remove(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_id: PersonId,
item_id: Self::IdType,
) -> Result<usize, Error>
pub trait Bannable {
type Form;
- fn ban(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn ban(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn unban(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn unban(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
}
pub trait Saveable {
type Form;
- fn save(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn save(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn unsave(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn unsave(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
}
pub trait Blockable {
type Form;
- fn block(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn block(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn unblock(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn unblock(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
}
pub trait Readable {
type Form;
- fn mark_as_read(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn mark_as_read(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
- fn mark_as_unread(conn: &PgConnection, form: &Self::Form) -> Result<usize, Error>
+ fn mark_as_unread(conn: &mut PgConnection, form: &Self::Form) -> Result<usize, Error>
where
Self: Sized;
}
pub trait Reportable {
type Form;
type IdType;
- fn report(conn: &PgConnection, form: &Self::Form) -> Result<Self, Error>
+ fn report(conn: &mut PgConnection, form: &Self::Form) -> Result<Self, Error>
where
Self: Sized;
fn resolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
resolver_id: PersonId,
) -> Result<usize, Error>
where
Self: Sized;
fn unresolve(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: Self::IdType,
resolver_id: PersonId,
) -> Result<usize, Error>
pub trait ApubActor {
// TODO: this should be in a trait ApubObject (and implemented for Post, Comment, PrivateMessage as well)
- fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error>
+ fn read_from_apub_id(conn: &mut PgConnection, object_id: &DbUrl) -> Result<Option<Self>, Error>
where
Self: Sized;
/// - actor_name is the name of the community or user to read.
/// - include_deleted, if true, will return communities or users that were deleted/removed
fn read_from_name(
- conn: &PgConnection,
+ conn: &mut PgConnection,
actor_name: &str,
include_deleted: bool,
) -> Result<Self, Error>
where
Self: Sized;
fn read_from_name_and_domain(
- conn: &PgConnection,
+ conn: &mut PgConnection,
actor_name: &str,
protocol_domain: &str,
) -> Result<Self, Error>
-use crate::{newtypes::DbUrl, CommentSortType, SortType};
+use crate::{diesel_migrations::MigrationHarness, newtypes::DbUrl, CommentSortType, SortType};
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use chrono::NaiveDateTime;
use diesel::{
backend::Backend,
deserialize::FromSql,
+ pg::Pg,
result::Error::QueryBuilderError,
serialize::{Output, ToSql},
sql_types::Text,
Connection,
PgConnection,
};
+use diesel_migrations::EmbeddedMigrations;
use lemmy_utils::error::LemmyError;
use once_cell::sync::Lazy;
use regex::Regex;
-use std::{env, env::VarError, io::Write};
+use std::{env, env::VarError};
use url::Url;
const FETCH_LIMIT_DEFAULT: i64 = 10;
}
}
-embed_migrations!();
+pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
pub fn establish_unpooled_connection() -> PgConnection {
let db_url = match get_database_url_from_env() {
e
),
};
- let conn =
+ let mut conn =
PgConnection::establish(&db_url).unwrap_or_else(|_| panic!("Error connecting to {}", db_url));
- embedded_migrations::run(&conn).expect("load migrations");
+ let _ = &mut conn
+ .run_pending_migrations(MIGRATIONS)
+ .unwrap_or_else(|_| panic!("Couldn't run DB Migrations"));
conn
}
sql_function!(fn lower(x: Text) -> Text);
}
-impl<DB: Backend> ToSql<Text, DB> for DbUrl
-where
- String: ToSql<Text, DB>,
-{
- fn to_sql<W: Write>(&self, out: &mut Output<W, DB>) -> diesel::serialize::Result {
- self.0.to_string().to_sql(out)
+impl ToSql<Text, Pg> for DbUrl {
+ fn to_sql(&self, out: &mut Output<Pg>) -> diesel::serialize::Result {
+ <std::string::String as ToSql<Text, Pg>>::to_sql(&self.0.to_string(), &mut out.reborrow())
}
}
where
String: FromSql<Text, DB>,
{
- fn from_sql(bytes: Option<&DB::RawValue>) -> diesel::deserialize::Result<Self> {
- let str = String::from_sql(bytes)?;
+ fn from_sql(value: diesel::backend::RawValue<'_, DB>) -> diesel::deserialize::Result<Self> {
+ let str = String::from_sql(value)?;
Ok(DbUrl(Url::parse(&str)?))
}
}
[dependencies]
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema" }
-diesel = { version = "1.4.8", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
-serde = { version = "1.0.136", features = ["derive"] }
-tracing = { version = "0.1.32", optional = true }
-diesel_ltree = "0.2.7"
+diesel = { version = "2.0.0", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
+serde = { version = "1.0.145", features = ["derive"] }
+tracing = { version = "0.1.36", optional = true }
+diesel_ltree = "0.3.0"
typed-builder = "0.10.0"
[dev-dependencies]
-serial_test = "0.6.0"
+serial_test = "0.9.0"
community_moderator,
community_person_ban,
person,
- person_alias_1,
- person_alias_2,
post,
},
source::{
comment::Comment,
comment_report::CommentReport,
community::{Community, CommunityPersonBan, CommunitySafe},
- person::{Person, PersonAlias1, PersonAlias2, PersonSafe, PersonSafeAlias1, PersonSafeAlias2},
+ person::{Person, PersonSafe},
post::Post,
},
traits::{ToSafe, ViewToVec},
Post,
CommunitySafe,
PersonSafe,
- PersonSafeAlias1,
+ PersonSafe,
CommentAggregates,
Option<CommunityPersonBan>,
Option<i16>,
- Option<PersonSafeAlias2>,
+ Option<PersonSafe>,
);
impl CommentReportView {
///
/// * `report_id` - the report id to obtain
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: CommentReportId,
my_person_id: PersonId,
) -> Result<Self, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let (
comment_report,
comment,
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
.inner_join(person::table.on(comment_report::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(comment::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(comment::creator_id.eq(person_alias_1.field(person::id))))
.inner_join(
comment_aggregates::table.on(comment_report::comment_id.eq(comment_aggregates::comment_id)),
)
),
)
.left_join(
- person_alias_2::table.on(comment_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2
+ .on(comment_report::resolver_id.eq(person_alias_2.field(person::id).nullable())),
)
.select((
comment_report::all_columns,
post::all_columns,
Community::safe_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
comment_like::score.nullable(),
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_2
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.first::<CommentReportViewTuple>(conn)?;
/// Returns the current unresolved post report count for the communities you mod
pub fn get_report_count(
- conn: &PgConnection,
+ conn: &mut PgConnection,
my_person_id: PersonId,
admin: bool,
community_id: Option<CommunityId>,
#[builder(field_defaults(default))]
pub struct CommentReportQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
#[builder(!default)]
my_person_id: PersonId,
#[builder(!default)]
impl<'a> CommentReportQuery<'a> {
pub fn list(self) -> Result<Vec<CommentReportView>, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let mut query = comment_report::table
.inner_join(comment::table)
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
.inner_join(person::table.on(comment_report::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(comment::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(comment::creator_id.eq(person_alias_1.field(person::id))))
.inner_join(
comment_aggregates::table.on(comment_report::comment_id.eq(comment_aggregates::comment_id)),
)
),
)
.left_join(
- person_alias_2::table.on(comment_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2
+ .on(comment_report::resolver_id.eq(person_alias_2.field(person::id).nullable())),
)
.select((
comment_report::all_columns,
post::all_columns,
Community::safe_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
comment_like::score.nullable(),
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_2
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.into_boxed();
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "timmy_crv".into(),
..PersonForm::default()
};
- let inserted_timmy = Person::create(&conn, &new_person).unwrap();
+ let inserted_timmy = Person::create(conn, &new_person).unwrap();
let new_person_2 = PersonForm {
name: "sara_crv".into(),
..PersonForm::default()
};
- let inserted_sara = Person::create(&conn, &new_person_2).unwrap();
+ let inserted_sara = Person::create(conn, &new_person_2).unwrap();
// Add a third person, since new ppl can only report something once.
let new_person_3 = PersonForm {
..PersonForm::default()
};
- let inserted_jessica = Person::create(&conn, &new_person_3).unwrap();
+ let inserted_jessica = Person::create(conn, &new_person_3).unwrap();
let new_community = CommunityForm {
name: "test community crv".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
// Make timmy a mod
let timmy_moderator_form = CommunityModeratorForm {
person_id: inserted_timmy.id,
};
- let _inserted_moderator = CommunityModerator::join(&conn, &timmy_moderator_form).unwrap();
+ let _inserted_moderator = CommunityModerator::join(conn, &timmy_moderator_form).unwrap();
let new_post = PostForm {
name: "A test post crv".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
let comment_form = CommentForm {
content: "A test comment 32".into(),
..CommentForm::default()
};
- let inserted_comment = Comment::create(&conn, &comment_form, None).unwrap();
+ let inserted_comment = Comment::create(conn, &comment_form, None).unwrap();
// sara reports
let sara_report_form = CommentReportForm {
reason: "from sara".into(),
};
- let inserted_sara_report = CommentReport::report(&conn, &sara_report_form).unwrap();
+ let inserted_sara_report = CommentReport::report(conn, &sara_report_form).unwrap();
// jessica reports
let jessica_report_form = CommentReportForm {
reason: "from jessica".into(),
};
- let inserted_jessica_report = CommentReport::report(&conn, &jessica_report_form).unwrap();
+ let inserted_jessica_report = CommentReport::report(conn, &jessica_report_form).unwrap();
- let agg = CommentAggregates::read(&conn, inserted_comment.id).unwrap();
+ let agg = CommentAggregates::read(conn, inserted_comment.id).unwrap();
let read_jessica_report_view =
- CommentReportView::read(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ CommentReportView::read(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let expected_jessica_report_view = CommentReportView {
comment_report: inserted_jessica_report.to_owned(),
comment: inserted_comment.to_owned(),
matrix_user_id: None,
ban_expires: None,
},
- comment_creator: PersonSafeAlias1 {
+ comment_creator: PersonSafe {
id: inserted_timmy.id,
name: inserted_timmy.name.to_owned(),
display_name: None,
// Do a batch read of timmys reports
let reports = CommentReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.my_person_id(inserted_timmy.id)
.admin(false)
.build()
// Make sure the counts are correct
let report_count =
- CommentReportView::get_report_count(&conn, inserted_timmy.id, false, None).unwrap();
+ CommentReportView::get_report_count(conn, inserted_timmy.id, false, None).unwrap();
assert_eq!(2, report_count);
// Try to resolve the report
- CommentReport::resolve(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ CommentReport::resolve(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let read_jessica_report_view_after_resolve =
- CommentReportView::read(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ CommentReportView::read(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let mut expected_jessica_report_view_after_resolve = expected_jessica_report_view;
expected_jessica_report_view_after_resolve
.updated = read_jessica_report_view_after_resolve
.comment_report
.updated;
- expected_jessica_report_view_after_resolve.resolver = Some(PersonSafeAlias2 {
+ expected_jessica_report_view_after_resolve.resolver = Some(PersonSafe {
id: inserted_timmy.id,
name: inserted_timmy.name.to_owned(),
display_name: None,
// Do a batch read of timmys reports
// It should only show saras, which is unresolved
let reports_after_resolve = CommentReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.my_person_id(inserted_timmy.id)
.admin(false)
.build()
// Make sure the counts are correct
let report_count_after_resolved =
- CommentReportView::get_report_count(&conn, inserted_timmy.id, false, None).unwrap();
+ CommentReportView::get_report_count(conn, inserted_timmy.id, false, None).unwrap();
assert_eq!(1, report_count_after_resolved);
- Person::delete(&conn, inserted_timmy.id).unwrap();
- Person::delete(&conn, inserted_sara.id).unwrap();
- Person::delete(&conn, inserted_jessica.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_timmy.id).unwrap();
+ Person::delete(conn, inserted_sara.id).unwrap();
+ Person::delete(conn, inserted_jessica.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
}
}
impl CommentView {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_id: CommentId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
#[builder(field_defaults(default))]
pub struct CommentQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
listing_type: Option<ListingType>,
sort: Option<CommentSortType>,
community_id: Option<CommunityId>,
inserted_community: Community,
}
- fn init_data(conn: &PgConnection) -> Data {
+ fn init_data(conn: &mut PgConnection) -> Data {
let new_person = PersonForm {
name: "timmy".into(),
public_key: Some("pubkey".to_string()),
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
- let expected_comment_view_no_person = expected_comment_view(&data, &conn);
+ let expected_comment_view_no_person = expected_comment_view(&data, conn);
let mut expected_comment_view_with_person = expected_comment_view_no_person.to_owned();
expected_comment_view_with_person.my_vote = Some(1);
let read_comment_views_no_person = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.build()
.list()
);
let read_comment_views_with_person = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.local_user(Some(&data.inserted_local_user))
.build()
assert_eq!(5, read_comment_views_with_person.len());
let read_comment_from_blocked_person = CommentView::read(
- &conn,
+ conn,
data.inserted_comment_1.id,
Some(data.inserted_person.id),
)
// Make sure block set the creator blocked
assert!(read_comment_from_blocked_person.creator_blocked);
- cleanup(data, &conn);
+ cleanup(data, conn);
}
#[test]
#[serial]
fn test_comment_tree() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
let top_path = data.inserted_comment_0.path.clone();
let read_comment_views_top_path = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.parent_path(Some(top_path))
.build()
let child_path = data.inserted_comment_1.path.clone();
let read_comment_views_child_path = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.parent_path(Some(child_path))
.build()
assert!(!child_comments.contains(&data.inserted_comment_2));
let read_comment_views_top_max_depth = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.max_depth(Some(1))
.build()
// Make sure a depth limited one only has the top comment
assert_eq!(
- expected_comment_view(&data, &conn),
+ expected_comment_view(&data, conn),
read_comment_views_top_max_depth[0]
);
assert_eq!(1, read_comment_views_top_max_depth.len());
let child_path = data.inserted_comment_1.path.clone();
let read_comment_views_parent_max_depth = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.post_id(Some(data.inserted_post.id))
.parent_path(Some(child_path))
.max_depth(Some(1))
.eq("Comment 3"));
assert_eq!(3, read_comment_views_parent_max_depth.len());
- cleanup(data, &conn);
+ cleanup(data, conn);
}
#[test]
#[serial]
fn test_languages() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
// by default, user has all languages enabled and should see all comments
// (except from blocked user)
let all_languages = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.local_user(Some(&data.inserted_local_user))
.build()
.list()
assert_eq!(5, all_languages.len());
// change user lang to finnish, should only show single finnish comment
- let finnish_id = Language::read_id_from_code(&conn, "fi").unwrap();
+ let finnish_id = Language::read_id_from_code(conn, "fi").unwrap();
LocalUserLanguage::update_user_languages(
- &conn,
+ conn,
Some(vec![finnish_id]),
data.inserted_local_user.id,
)
.unwrap();
let finnish_comment = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.local_user(Some(&data.inserted_local_user))
.build()
.list()
assert_eq!(finnish_id, finnish_comment[0].comment.language_id);
// now show all comments with undetermined language (which is the default value)
- let undetermined_id = Language::read_id_from_code(&conn, "und").unwrap();
+ let undetermined_id = Language::read_id_from_code(conn, "und").unwrap();
LocalUserLanguage::update_user_languages(
- &conn,
+ conn,
Some(vec![undetermined_id]),
data.inserted_local_user.id,
)
.unwrap();
let undetermined_comment = CommentQuery::builder()
- .conn(&conn)
+ .conn(conn)
.local_user(Some(&data.inserted_local_user))
.build()
.list()
.unwrap();
assert_eq!(3, undetermined_comment.len());
- cleanup(data, &conn);
+ cleanup(data, conn);
}
- fn cleanup(data: Data, conn: &PgConnection) {
+ fn cleanup(data: Data, conn: &mut PgConnection) {
CommentLike::remove(conn, data.inserted_person.id, data.inserted_comment_0.id).unwrap();
Comment::delete(conn, data.inserted_comment_0.id).unwrap();
Comment::delete(conn, data.inserted_comment_1.id).unwrap();
Person::delete(conn, data.inserted_person_2.id).unwrap();
}
- fn expected_comment_view(data: &Data, conn: &PgConnection) -> CommentView {
+ fn expected_comment_view(data: &Data, conn: &mut PgConnection) -> CommentView {
let agg = CommentAggregates::read(conn, data.inserted_comment_0.id).unwrap();
CommentView {
creator_banned_from_community: false,
impl LocalUserDiscussionLanguageView {
pub fn read_languages(
- conn: &PgConnection,
+ conn: &mut PgConnection,
local_user_id: LocalUserId,
) -> Result<Vec<Language>, Error> {
let res = local_user_language::table
type LocalUserViewTuple = (LocalUser, Person, PersonAggregates);
impl LocalUserView {
- pub fn read(conn: &PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.find(local_user_id)
.inner_join(person::table)
})
}
- pub fn read_person(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ pub fn read_person(conn: &mut PgConnection, person_id: PersonId) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.filter(person::id.eq(person_id))
.inner_join(person::table)
}
// TODO check where this is used
- pub fn read_from_name(conn: &PgConnection, name: &str) -> Result<Self, Error> {
+ pub fn read_from_name(conn: &mut PgConnection, name: &str) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.filter(person::name.eq(name))
.inner_join(person::table)
})
}
- pub fn find_by_email_or_name(conn: &PgConnection, name_or_email: &str) -> Result<Self, Error> {
+ pub fn find_by_email_or_name(
+ conn: &mut PgConnection,
+ name_or_email: &str,
+ ) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.inner_join(person::table)
.inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id)))
})
}
- pub fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<Self, Error> {
+ pub fn find_by_email(conn: &mut PgConnection, from_email: &str) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.inner_join(person::table)
.inner_join(person_aggregates::table.on(person::id.eq(person_aggregates::person_id)))
type LocalUserSettingsViewTuple = (LocalUserSettings, PersonSafe, PersonAggregates);
impl LocalUserSettingsView {
- pub fn read(conn: &PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, local_user_id: LocalUserId) -> Result<Self, Error> {
let (local_user, person, counts) = local_user::table
.find(local_user_id)
.inner_join(person::table)
community_moderator,
community_person_ban,
person,
- person_alias_1,
- person_alias_2,
post,
post_aggregates,
post_like,
},
source::{
community::{Community, CommunityPersonBan, CommunitySafe},
- person::{Person, PersonAlias1, PersonAlias2, PersonSafe, PersonSafeAlias1, PersonSafeAlias2},
+ person::{Person, PersonSafe},
post::Post,
post_report::PostReport,
},
Post,
CommunitySafe,
PersonSafe,
- PersonSafeAlias1,
+ PersonSafe,
Option<CommunityPersonBan>,
Option<i16>,
PostAggregates,
- Option<PersonSafeAlias2>,
+ Option<PersonSafe>,
);
impl PostReportView {
///
/// * `report_id` - the report id to obtain
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
report_id: PostReportId,
my_person_id: PersonId,
) -> Result<Self, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let (
post_report,
post,
.inner_join(post::table)
.inner_join(community::table.on(post::community_id.eq(community::id)))
.inner_join(person::table.on(post_report::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
.left_join(
community_person_ban::table.on(
post::community_id
)
.inner_join(post_aggregates::table.on(post_report::post_id.eq(post_aggregates::post_id)))
.left_join(
- person_alias_2::table.on(post_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2.on(post_report::resolver_id.eq(person_alias_2.field(person::id).nullable())),
)
.select((
post_report::all_columns,
post::all_columns,
Community::safe_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
community_person_ban::all_columns.nullable(),
post_like::score.nullable(),
post_aggregates::all_columns,
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_2.fields(Person::safe_columns_tuple().nullable()),
))
.first::<PostReportViewTuple>(conn)?;
/// returns the current unresolved post report count for the communities you mod
pub fn get_report_count(
- conn: &PgConnection,
+ conn: &mut PgConnection,
my_person_id: PersonId,
admin: bool,
community_id: Option<CommunityId>,
#[builder(field_defaults(default))]
pub struct PostReportQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
#[builder(!default)]
my_person_id: PersonId,
#[builder(!default)]
impl<'a> PostReportQuery<'a> {
pub fn list(self) -> Result<Vec<PostReportView>, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let mut query = post_report::table
.inner_join(post::table)
.inner_join(community::table.on(post::community_id.eq(community::id)))
.inner_join(person::table.on(post_report::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
.left_join(
community_person_ban::table.on(
post::community_id
)
.inner_join(post_aggregates::table.on(post_report::post_id.eq(post_aggregates::post_id)))
.left_join(
- person_alias_2::table.on(post_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2.on(post_report::resolver_id.eq(person_alias_2.field(person::id).nullable())),
)
.select((
post_report::all_columns,
post::all_columns,
Community::safe_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
community_person_ban::all_columns.nullable(),
post_like::score.nullable(),
post_aggregates::all_columns,
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_2
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.into_boxed();
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person = PersonForm {
name: "timmy_prv".into(),
..PersonForm::default()
};
- let inserted_timmy = Person::create(&conn, &new_person).unwrap();
+ let inserted_timmy = Person::create(conn, &new_person).unwrap();
let new_person_2 = PersonForm {
name: "sara_prv".into(),
..PersonForm::default()
};
- let inserted_sara = Person::create(&conn, &new_person_2).unwrap();
+ let inserted_sara = Person::create(conn, &new_person_2).unwrap();
// Add a third person, since new ppl can only report something once.
let new_person_3 = PersonForm {
..PersonForm::default()
};
- let inserted_jessica = Person::create(&conn, &new_person_3).unwrap();
+ let inserted_jessica = Person::create(conn, &new_person_3).unwrap();
let new_community = CommunityForm {
name: "test community prv".to_string(),
..CommunityForm::default()
};
- let inserted_community = Community::create(&conn, &new_community).unwrap();
+ let inserted_community = Community::create(conn, &new_community).unwrap();
// Make timmy a mod
let timmy_moderator_form = CommunityModeratorForm {
person_id: inserted_timmy.id,
};
- let _inserted_moderator = CommunityModerator::join(&conn, &timmy_moderator_form).unwrap();
+ let _inserted_moderator = CommunityModerator::join(conn, &timmy_moderator_form).unwrap();
let new_post = PostForm {
name: "A test post crv".into(),
..PostForm::default()
};
- let inserted_post = Post::create(&conn, &new_post).unwrap();
+ let inserted_post = Post::create(conn, &new_post).unwrap();
// sara reports
let sara_report_form = PostReportForm {
reason: "from sara".into(),
};
- let inserted_sara_report = PostReport::report(&conn, &sara_report_form).unwrap();
+ let inserted_sara_report = PostReport::report(conn, &sara_report_form).unwrap();
// jessica reports
let jessica_report_form = PostReportForm {
reason: "from jessica".into(),
};
- let inserted_jessica_report = PostReport::report(&conn, &jessica_report_form).unwrap();
+ let inserted_jessica_report = PostReport::report(conn, &jessica_report_form).unwrap();
- let agg = PostAggregates::read(&conn, inserted_post.id).unwrap();
+ let agg = PostAggregates::read(conn, inserted_post.id).unwrap();
let read_jessica_report_view =
- PostReportView::read(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ PostReportView::read(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let expected_jessica_report_view = PostReportView {
post_report: inserted_jessica_report.to_owned(),
post: inserted_post.to_owned(),
matrix_user_id: None,
ban_expires: None,
},
- post_creator: PersonSafeAlias1 {
+ post_creator: PersonSafe {
id: inserted_timmy.id,
name: inserted_timmy.name.to_owned(),
display_name: None,
// Do a batch read of timmys reports
let reports = PostReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.my_person_id(inserted_timmy.id)
.admin(false)
.build()
// Make sure the counts are correct
let report_count =
- PostReportView::get_report_count(&conn, inserted_timmy.id, false, None).unwrap();
+ PostReportView::get_report_count(conn, inserted_timmy.id, false, None).unwrap();
assert_eq!(2, report_count);
// Try to resolve the report
- PostReport::resolve(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ PostReport::resolve(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let read_jessica_report_view_after_resolve =
- PostReportView::read(&conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
+ PostReportView::read(conn, inserted_jessica_report.id, inserted_timmy.id).unwrap();
let mut expected_jessica_report_view_after_resolve = expected_jessica_report_view;
expected_jessica_report_view_after_resolve
expected_jessica_report_view_after_resolve
.post_report
.updated = read_jessica_report_view_after_resolve.post_report.updated;
- expected_jessica_report_view_after_resolve.resolver = Some(PersonSafeAlias2 {
+ expected_jessica_report_view_after_resolve.resolver = Some(PersonSafe {
id: inserted_timmy.id,
name: inserted_timmy.name.to_owned(),
display_name: None,
// Do a batch read of timmys reports
// It should only show saras, which is unresolved
let reports_after_resolve = PostReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.my_person_id(inserted_timmy.id)
.admin(false)
.build()
// Make sure the counts are correct
let report_count_after_resolved =
- PostReportView::get_report_count(&conn, inserted_timmy.id, false, None).unwrap();
+ PostReportView::get_report_count(conn, inserted_timmy.id, false, None).unwrap();
assert_eq!(1, report_count_after_resolved);
- Person::delete(&conn, inserted_timmy.id).unwrap();
- Person::delete(&conn, inserted_sara.id).unwrap();
- Person::delete(&conn, inserted_jessica.id).unwrap();
- Community::delete(&conn, inserted_community.id).unwrap();
+ Person::delete(conn, inserted_timmy.id).unwrap();
+ Person::delete(conn, inserted_sara.id).unwrap();
+ Person::delete(conn, inserted_jessica.id).unwrap();
+ Community::delete(conn, inserted_community.id).unwrap();
}
}
impl PostView {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
post_id: PostId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
#[builder(field_defaults(default))]
pub struct PostQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
listing_type: Option<ListingType>,
sort: Option<SortType>,
creator_id: Option<PersonId>,
inserted_post: Post,
}
- fn init_data(conn: &PgConnection) -> Data {
+ fn init_data(conn: &mut PgConnection) -> Data {
let person_name = "tegan".to_string();
let new_person = PersonForm {
#[test]
#[serial]
fn post_listing_with_person() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
let local_user_form = LocalUserForm {
show_bot_accounts: Some(false),
..Default::default()
};
let inserted_local_user =
- LocalUser::update(&conn, data.inserted_local_user.id, &local_user_form).unwrap();
+ LocalUser::update(conn, data.inserted_local_user.id, &local_user_form).unwrap();
let read_post_listing = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
.unwrap();
let post_listing_single_with_person =
- PostView::read(&conn, data.inserted_post.id, Some(data.inserted_person.id)).unwrap();
+ PostView::read(conn, data.inserted_post.id, Some(data.inserted_person.id)).unwrap();
- let mut expected_post_listing_with_user = expected_post_view(&data, &conn);
+ let mut expected_post_listing_with_user = expected_post_view(&data, conn);
// Should be only one person, IE the bot post, and blocked should be missing
assert_eq!(1, read_post_listing.len());
..Default::default()
};
let inserted_local_user =
- LocalUser::update(&conn, data.inserted_local_user.id, &local_user_form).unwrap();
+ LocalUser::update(conn, data.inserted_local_user.id, &local_user_form).unwrap();
let post_listings_with_bots = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&inserted_local_user))
// should include bot post which has "undetermined" language
assert_eq!(2, post_listings_with_bots.len());
- cleanup(data, &conn);
+ cleanup(data, conn);
}
#[test]
#[serial]
fn post_listing_no_person() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
let read_post_listing_multiple_no_person = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.build()
.unwrap();
let read_post_listing_single_no_person =
- PostView::read(&conn, data.inserted_post.id, None).unwrap();
+ PostView::read(conn, data.inserted_post.id, None).unwrap();
- let expected_post_listing_no_person = expected_post_view(&data, &conn);
+ let expected_post_listing_no_person = expected_post_view(&data, conn);
// Should be 2 posts, with the bot post, and the blocked
assert_eq!(3, read_post_listing_multiple_no_person.len());
read_post_listing_single_no_person
);
- cleanup(data, &conn);
+ cleanup(data, conn);
}
#[test]
#[serial]
fn post_listing_block_community() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
let community_block = CommunityBlockForm {
person_id: data.inserted_person.id,
community_id: data.inserted_community.id,
};
- CommunityBlock::block(&conn, &community_block).unwrap();
+ CommunityBlock::block(conn, &community_block).unwrap();
let read_post_listings_with_person_after_block = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.community_id(Some(data.inserted_community.id))
.local_user(Some(&data.inserted_local_user))
// Should be 0 posts after the community block
assert_eq!(0, read_post_listings_with_person_after_block.len());
- CommunityBlock::unblock(&conn, &community_block).unwrap();
- cleanup(data, &conn);
+ CommunityBlock::unblock(conn, &community_block).unwrap();
+ cleanup(data, conn);
}
#[test]
#[serial]
fn post_listing_like() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
let post_like_form = PostLikeForm {
post_id: data.inserted_post.id,
score: 1,
};
- let inserted_post_like = PostLike::like(&conn, &post_like_form).unwrap();
+ let inserted_post_like = PostLike::like(conn, &post_like_form).unwrap();
let expected_post_like = PostLike {
id: inserted_post_like.id,
assert_eq!(expected_post_like, inserted_post_like);
let like_removed =
- PostLike::remove(&conn, data.inserted_person.id, data.inserted_post.id).unwrap();
+ PostLike::remove(conn, data.inserted_person.id, data.inserted_post.id).unwrap();
assert_eq!(1, like_removed);
- cleanup(data, &conn);
+ cleanup(data, conn);
}
#[test]
#[serial]
fn post_listing_person_language() {
- let conn = establish_unpooled_connection();
- let data = init_data(&conn);
+ let conn = &mut establish_unpooled_connection();
+ let data = init_data(conn);
- let spanish_id = Language::read_id_from_code(&conn, "es").unwrap();
+ let spanish_id = Language::read_id_from_code(conn, "es").unwrap();
let post_spanish = PostForm {
name: "asffgdsc".to_string(),
creator_id: data.inserted_person.id,
..PostForm::default()
};
- Post::create(&conn, &post_spanish).unwrap();
+ Post::create(conn, &post_spanish).unwrap();
let post_listings_all = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.local_user(Some(&data.inserted_local_user))
.build()
// no language filters specified, all posts should be returned
assert_eq!(3, post_listings_all.len());
- let french_id = Language::read_id_from_code(&conn, "fr").unwrap();
+ let french_id = Language::read_id_from_code(conn, "fr").unwrap();
LocalUserLanguage::update_user_languages(
- &conn,
+ conn,
Some(vec![french_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listing_french = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.local_user(Some(&data.inserted_local_user))
.build()
assert_eq!(1, post_listing_french.len());
assert_eq!(french_id, post_listing_french[0].post.language_id);
- let undetermined_id = Language::read_id_from_code(&conn, "und").unwrap();
+ let undetermined_id = Language::read_id_from_code(conn, "und").unwrap();
LocalUserLanguage::update_user_languages(
- &conn,
+ conn,
Some(vec![french_id, undetermined_id]),
data.inserted_local_user.id,
)
.unwrap();
let post_listings_french_und = PostQuery::builder()
- .conn(&conn)
+ .conn(conn)
.sort(Some(SortType::New))
.local_user(Some(&data.inserted_local_user))
.build()
);
assert_eq!(french_id, post_listings_french_und[1].post.language_id);
- cleanup(data, &conn);
+ cleanup(data, conn);
}
- fn cleanup(data: Data, conn: &PgConnection) {
+ fn cleanup(data: Data, conn: &mut PgConnection) {
let num_deleted = Post::delete(conn, data.inserted_post.id).unwrap();
Community::delete(conn, data.inserted_community.id).unwrap();
Person::delete(conn, data.inserted_person.id).unwrap();
assert_eq!(1, num_deleted);
}
- fn expected_post_view(data: &Data, conn: &PgConnection) -> PostView {
+ fn expected_post_view(data: &Data, conn: &mut PgConnection) -> PostView {
let (inserted_person, inserted_community, inserted_post) = (
&data.inserted_person,
&data.inserted_community,
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PrivateMessageReportId,
- schema::{person, person_alias_1, person_alias_2, private_message, private_message_report},
+ schema::{person, private_message, private_message_report},
source::{
- person::{Person, PersonAlias1, PersonAlias2, PersonSafe, PersonSafeAlias1, PersonSafeAlias2},
+ person::{Person, PersonSafe},
private_message::PrivateMessage,
private_message_report::PrivateMessageReport,
},
PrivateMessageReport,
PrivateMessage,
PersonSafe,
- PersonSafeAlias1,
- Option<PersonSafeAlias2>,
+ PersonSafe,
+ Option<PersonSafe>,
);
impl PrivateMessageReportView {
/// returns the PrivateMessageReportView for the provided report_id
///
/// * `report_id` - the report id to obtain
- pub fn read(conn: &PgConnection, report_id: PrivateMessageReportId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, report_id: PrivateMessageReportId) -> Result<Self, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let (private_message_report, private_message, private_message_creator, creator, resolver) =
private_message_report::table
.find(report_id)
.inner_join(private_message::table)
.inner_join(person::table.on(private_message::creator_id.eq(person::id)))
.inner_join(
- person_alias_1::table.on(private_message_report::creator_id.eq(person_alias_1::id)),
+ person_alias_1
+ .on(private_message_report::creator_id.eq(person_alias_1.field(person::id))),
)
.left_join(
- person_alias_2::table
- .on(private_message_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2.on(
+ private_message_report::resolver_id.eq(person_alias_2.field(person::id).nullable()),
+ ),
)
.select((
private_message_report::all_columns,
private_message::all_columns,
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
+ person_alias_2
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.first::<PrivateMessageReportViewTuple>(conn)?;
}
/// Returns the current unresolved post report count for the communities you mod
- pub fn get_report_count(conn: &PgConnection) -> Result<i64, Error> {
+ pub fn get_report_count(conn: &mut PgConnection) -> Result<i64, Error> {
use diesel::dsl::*;
private_message_report::table
#[builder(field_defaults(default))]
pub struct PrivateMessageReportQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
page: Option<i64>,
limit: Option<i64>,
unresolved_only: Option<bool>,
impl<'a> PrivateMessageReportQuery<'a> {
pub fn list(self) -> Result<Vec<PrivateMessageReportView>, Error> {
+ let (person_alias_1, person_alias_2) = diesel::alias!(person as person1, person as person2);
+
let mut query = private_message_report::table
.inner_join(private_message::table)
.inner_join(person::table.on(private_message::creator_id.eq(person::id)))
.inner_join(
- person_alias_1::table.on(private_message_report::creator_id.eq(person_alias_1::id)),
+ person_alias_1.on(private_message_report::creator_id.eq(person_alias_1.field(person::id))),
)
.left_join(
- person_alias_2::table
- .on(private_message_report::resolver_id.eq(person_alias_2::id.nullable())),
+ person_alias_2
+ .on(private_message_report::resolver_id.eq(person_alias_2.field(person::id).nullable())),
)
.select((
private_message_report::all_columns,
private_message::all_columns,
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
- PersonAlias2::safe_columns_tuple().nullable(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
+ person_alias_2
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.into_boxed();
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let new_person_1 = PersonForm {
name: "timmy_mrv".into(),
public_key: Some("pubkey".to_string()),
..PersonForm::default()
};
- let inserted_timmy = Person::create(&conn, &new_person_1).unwrap();
+ let inserted_timmy = Person::create(conn, &new_person_1).unwrap();
let new_person_2 = PersonForm {
name: "jessica_mrv".into(),
public_key: Some("pubkey".to_string()),
..PersonForm::default()
};
- let inserted_jessica = Person::create(&conn, &new_person_2).unwrap();
+ let inserted_jessica = Person::create(conn, &new_person_2).unwrap();
// timmy sends private message to jessica
let pm_form = PrivateMessageForm {
content: "something offensive".to_string(),
..Default::default()
};
- let pm = PrivateMessage::create(&conn, &pm_form).unwrap();
+ let pm = PrivateMessage::create(conn, &pm_form).unwrap();
// jessica reports private message
let pm_report_form = PrivateMessageReportForm {
private_message_id: pm.id,
reason: "its offensive".to_string(),
};
- let pm_report = PrivateMessageReport::report(&conn, &pm_report_form).unwrap();
+ let pm_report = PrivateMessageReport::report(conn, &pm_report_form).unwrap();
let reports = PrivateMessageReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.build()
.list()
.unwrap();
public_key: Some("pubkey".to_string()),
..PersonForm::default()
};
- let inserted_admin = Person::create(&conn, &new_person_3).unwrap();
+ let inserted_admin = Person::create(conn, &new_person_3).unwrap();
// admin resolves the report (after taking appropriate action)
- PrivateMessageReport::resolve(&conn, pm_report.id, inserted_admin.id).unwrap();
+ PrivateMessageReport::resolve(conn, pm_report.id, inserted_admin.id).unwrap();
let reports = PrivateMessageReportQuery::builder()
- .conn(&conn)
+ .conn(conn)
.unresolved_only(Some(false))
.build()
.list()
use diesel::{pg::Pg, result::Error, *};
use lemmy_db_schema::{
newtypes::{PersonId, PrivateMessageId},
- schema::{person, person_alias_1, private_message},
+ schema::{person, private_message},
source::{
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
private_message::PrivateMessage,
},
traits::{ToSafe, ViewToVec},
use tracing::debug;
use typed_builder::TypedBuilder;
-type PrivateMessageViewTuple = (PrivateMessage, PersonSafe, PersonSafeAlias1);
+type PrivateMessageViewTuple = (PrivateMessage, PersonSafe, PersonSafe);
impl PrivateMessageView {
- pub fn read(conn: &PgConnection, private_message_id: PrivateMessageId) -> Result<Self, Error> {
+ pub fn read(
+ conn: &mut PgConnection,
+ private_message_id: PrivateMessageId,
+ ) -> Result<Self, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let (private_message, creator, recipient) = private_message::table
.find(private_message_id)
.inner_join(person::table.on(private_message::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(private_message::recipient_id.eq(person_alias_1::id)))
+ .inner_join(
+ person_alias_1.on(private_message::recipient_id.eq(person_alias_1.field(person::id))),
+ )
.order_by(private_message::published.desc())
.select((
private_message::all_columns,
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.first::<PrivateMessageViewTuple>(conn)?;
}
/// Gets the number of unread messages
- pub fn get_unread_messages(conn: &PgConnection, my_person_id: PersonId) -> Result<i64, Error> {
+ pub fn get_unread_messages(
+ conn: &mut PgConnection,
+ my_person_id: PersonId,
+ ) -> Result<i64, Error> {
use diesel::dsl::*;
private_message::table
.filter(private_message::read.eq(false))
#[builder(field_defaults(default))]
pub struct PrivateMessageQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
#[builder(!default)]
recipient_id: PersonId,
unread_only: Option<bool>,
impl<'a> PrivateMessageQuery<'a> {
pub fn list(self) -> Result<Vec<PrivateMessageView>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let mut query = private_message::table
.inner_join(person::table.on(private_message::creator_id.eq(person::id)))
- .inner_join(person_alias_1::table.on(private_message::recipient_id.eq(person_alias_1::id)))
+ .inner_join(
+ person_alias_1.on(private_message::recipient_id.eq(person_alias_1.field(person::id))),
+ )
.select((
private_message::all_columns,
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
use crate::structs::RegistrationApplicationView;
use diesel::{dsl::count, result::Error, *};
use lemmy_db_schema::{
- schema::{local_user, person, person_alias_1, registration_application},
+ schema::{local_user, person, registration_application},
source::{
local_user::{LocalUser, LocalUserSettings},
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
registration_application::RegistrationApplication,
},
traits::{ToSafe, ToSafeSettings, ViewToVec},
RegistrationApplication,
LocalUserSettings,
PersonSafe,
- Option<PersonSafeAlias1>,
+ Option<PersonSafe>,
);
impl RegistrationApplicationView {
- pub fn read(conn: &PgConnection, registration_application_id: i32) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, registration_application_id: i32) -> Result<Self, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let (registration_application, creator_local_user, creator, admin) =
registration_application::table
.find(registration_application_id)
)
.inner_join(person::table.on(local_user::person_id.eq(person::id)))
.left_join(
- person_alias_1::table
- .on(registration_application::admin_id.eq(person_alias_1::id.nullable())),
+ person_alias_1
+ .on(registration_application::admin_id.eq(person_alias_1.field(person::id).nullable())),
)
.order_by(registration_application::published.desc())
.select((
registration_application::all_columns,
LocalUser::safe_settings_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple().nullable(),
+ person_alias_1
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.first::<RegistrationApplicationViewTuple>(conn)?;
}
/// Returns the current unread registration_application count
- pub fn get_unread_count(conn: &PgConnection, verified_email_only: bool) -> Result<i64, Error> {
+ pub fn get_unread_count(
+ conn: &mut PgConnection,
+ verified_email_only: bool,
+ ) -> Result<i64, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let mut query = registration_application::table
.inner_join(local_user::table.on(registration_application::local_user_id.eq(local_user::id)))
.inner_join(person::table.on(local_user::person_id.eq(person::id)))
.left_join(
- person_alias_1::table
- .on(registration_application::admin_id.eq(person_alias_1::id.nullable())),
+ person_alias_1
+ .on(registration_application::admin_id.eq(person_alias_1.field(person::id).nullable())),
)
.filter(registration_application::admin_id.is_null())
.into_boxed();
#[builder(field_defaults(default))]
pub struct RegistrationApplicationQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
unread_only: Option<bool>,
verified_email_only: Option<bool>,
page: Option<i64>,
impl<'a> RegistrationApplicationQuery<'a> {
pub fn list(self) -> Result<Vec<RegistrationApplicationView>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let mut query = registration_application::table
.inner_join(local_user::table.on(registration_application::local_user_id.eq(local_user::id)))
.inner_join(person::table.on(local_user::person_id.eq(person::id)))
.left_join(
- person_alias_1::table
- .on(registration_application::admin_id.eq(person_alias_1::id.nullable())),
+ person_alias_1
+ .on(registration_application::admin_id.eq(person_alias_1.field(person::id).nullable())),
)
.order_by(registration_application::published.desc())
.select((
registration_application::all_columns,
LocalUser::safe_settings_columns_tuple(),
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple().nullable(),
+ person_alias_1
+ .fields(Person::safe_columns_tuple())
+ .nullable(),
))
.into_boxed();
#[test]
#[serial]
fn test_crud() {
- let conn = establish_unpooled_connection();
+ let conn = &mut establish_unpooled_connection();
let timmy_person_form = PersonForm {
name: "timmy_rav".into(),
..PersonForm::default()
};
- let inserted_timmy_person = Person::create(&conn, &timmy_person_form).unwrap();
+ let inserted_timmy_person = Person::create(conn, &timmy_person_form).unwrap();
let timmy_local_user_form = LocalUserForm {
person_id: Some(inserted_timmy_person.id),
..LocalUserForm::default()
};
- let _inserted_timmy_local_user = LocalUser::create(&conn, &timmy_local_user_form).unwrap();
+ let _inserted_timmy_local_user = LocalUser::create(conn, &timmy_local_user_form).unwrap();
let sara_person_form = PersonForm {
name: "sara_rav".into(),
..PersonForm::default()
};
- let inserted_sara_person = Person::create(&conn, &sara_person_form).unwrap();
+ let inserted_sara_person = Person::create(conn, &sara_person_form).unwrap();
let sara_local_user_form = LocalUserForm {
person_id: Some(inserted_sara_person.id),
..LocalUserForm::default()
};
- let inserted_sara_local_user = LocalUser::create(&conn, &sara_local_user_form).unwrap();
+ let inserted_sara_local_user = LocalUser::create(conn, &sara_local_user_form).unwrap();
// Sara creates an application
let sara_app_form = RegistrationApplicationForm {
..RegistrationApplicationForm::default()
};
- let sara_app = RegistrationApplication::create(&conn, &sara_app_form).unwrap();
+ let sara_app = RegistrationApplication::create(conn, &sara_app_form).unwrap();
- let read_sara_app_view = RegistrationApplicationView::read(&conn, sara_app.id).unwrap();
+ let read_sara_app_view = RegistrationApplicationView::read(conn, sara_app.id).unwrap();
let jess_person_form = PersonForm {
name: "jess_rav".into(),
..PersonForm::default()
};
- let inserted_jess_person = Person::create(&conn, &jess_person_form).unwrap();
+ let inserted_jess_person = Person::create(conn, &jess_person_form).unwrap();
let jess_local_user_form = LocalUserForm {
person_id: Some(inserted_jess_person.id),
..LocalUserForm::default()
};
- let inserted_jess_local_user = LocalUser::create(&conn, &jess_local_user_form).unwrap();
+ let inserted_jess_local_user = LocalUser::create(conn, &jess_local_user_form).unwrap();
// Sara creates an application
let jess_app_form = RegistrationApplicationForm {
..RegistrationApplicationForm::default()
};
- let jess_app = RegistrationApplication::create(&conn, &jess_app_form).unwrap();
+ let jess_app = RegistrationApplication::create(conn, &jess_app_form).unwrap();
- let read_jess_app_view = RegistrationApplicationView::read(&conn, jess_app.id).unwrap();
+ let read_jess_app_view = RegistrationApplicationView::read(conn, jess_app.id).unwrap();
let mut expected_sara_app_view = RegistrationApplicationView {
registration_application: sara_app.to_owned(),
// Do a batch read of the applications
let apps = RegistrationApplicationQuery::builder()
- .conn(&conn)
+ .conn(conn)
.unread_only(Some(true))
.build()
.list()
);
// Make sure the counts are correct
- let unread_count = RegistrationApplicationView::get_unread_count(&conn, false).unwrap();
+ let unread_count = RegistrationApplicationView::get_unread_count(conn, false).unwrap();
assert_eq!(unread_count, 2);
// Approve the application
..RegistrationApplicationForm::default()
};
- RegistrationApplication::update(&conn, sara_app.id, &approve_form).unwrap();
+ RegistrationApplication::update(conn, sara_app.id, &approve_form).unwrap();
// Update the local_user row
let approve_local_user_form = LocalUserForm {
..LocalUserForm::default()
};
- LocalUser::update(&conn, inserted_sara_local_user.id, &approve_local_user_form).unwrap();
+ LocalUser::update(conn, inserted_sara_local_user.id, &approve_local_user_form).unwrap();
let read_sara_app_view_after_approve =
- RegistrationApplicationView::read(&conn, sara_app.id).unwrap();
+ RegistrationApplicationView::read(conn, sara_app.id).unwrap();
// Make sure the columns changed
expected_sara_app_view
.accepted_application = true;
expected_sara_app_view.registration_application.admin_id = Some(inserted_timmy_person.id);
- expected_sara_app_view.admin = Some(PersonSafeAlias1 {
+ expected_sara_app_view.admin = Some(PersonSafe {
id: inserted_timmy_person.id,
name: inserted_timmy_person.name.to_owned(),
display_name: None,
// Do a batch read of apps again
// It should show only jessicas which is unresolved
let apps_after_resolve = RegistrationApplicationQuery::builder()
- .conn(&conn)
+ .conn(conn)
.unread_only(Some(true))
.build()
.list()
// Make sure the counts are correct
let unread_count_after_approve =
- RegistrationApplicationView::get_unread_count(&conn, false).unwrap();
+ RegistrationApplicationView::get_unread_count(conn, false).unwrap();
assert_eq!(unread_count_after_approve, 1);
// Make sure the not undenied_only has all the apps
let all_apps = RegistrationApplicationQuery::builder()
- .conn(&conn)
+ .conn(conn)
.build()
.list()
.unwrap();
assert_eq!(all_apps.len(), 2);
- Person::delete(&conn, inserted_timmy_person.id).unwrap();
- Person::delete(&conn, inserted_sara_person.id).unwrap();
- Person::delete(&conn, inserted_jess_person.id).unwrap();
+ Person::delete(conn, inserted_timmy_person.id).unwrap();
+ Person::delete(conn, inserted_sara_person.id).unwrap();
+ Person::delete(conn, inserted_jess_person.id).unwrap();
}
}
};
impl SiteView {
- pub fn read_local(conn: &PgConnection) -> Result<Self, Error> {
+ pub fn read_local(conn: &mut PgConnection) -> Result<Self, Error> {
let (mut site, counts) = site::table
.inner_join(site_aggregates::table)
.select((site::all_columns, site_aggregates::all_columns))
community::CommunitySafe,
language::Language,
local_user::{LocalUser, LocalUserSettings},
- person::{Person, PersonSafe, PersonSafeAlias1, PersonSafeAlias2},
+ person::{Person, PersonSafe},
post::Post,
post_report::PostReport,
private_message::PrivateMessage,
};
use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct CommentReportView {
pub comment_report: CommentReport,
pub comment: Comment,
pub post: Post,
pub community: CommunitySafe,
pub creator: PersonSafe,
- pub comment_creator: PersonSafeAlias1,
+ pub comment_creator: PersonSafe,
pub counts: CommentAggregates,
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
pub my_vote: Option<i16>, // Left join to CommentLike
- pub resolver: Option<PersonSafeAlias2>,
+ pub resolver: Option<PersonSafe>,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct CommentView {
pub comment: Comment,
pub creator: PersonSafe,
pub counts: PersonAggregates,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct PostReportView {
pub post_report: PostReport,
pub post: Post,
pub community: CommunitySafe,
pub creator: PersonSafe,
- pub post_creator: PersonSafeAlias1,
+ pub post_creator: PersonSafe,
pub creator_banned_from_community: bool,
pub my_vote: Option<i16>,
pub counts: PostAggregates,
- pub resolver: Option<PersonSafeAlias2>,
+ pub resolver: Option<PersonSafe>,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct PostView {
pub post: Post,
pub creator: PersonSafe,
pub language: Language,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct PrivateMessageView {
pub private_message: PrivateMessage,
pub creator: PersonSafe,
- pub recipient: PersonSafeAlias1,
+ pub recipient: PersonSafe,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct PrivateMessageReportView {
pub private_message_report: PrivateMessageReport,
pub private_message: PrivateMessage,
pub private_message_creator: PersonSafe,
- pub creator: PersonSafeAlias1,
- pub resolver: Option<PersonSafeAlias2>,
+ pub creator: PersonSafe,
+ pub resolver: Option<PersonSafe>,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct RegistrationApplicationView {
pub registration_application: RegistrationApplication,
pub creator_local_user: LocalUserSettings,
pub creator: PersonSafe,
- pub admin: Option<PersonSafeAlias1>,
+ pub admin: Option<PersonSafe>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
[dependencies]
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema" }
-diesel = { version = "1.4.8", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
-serde = { version = "1.0.136", features = ["derive"] }
+diesel = { version = "2.0.0", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
+serde = { version = "1.0.145", features = ["derive"] }
typed-builder = "0.10.0"
community_follower,
community_person_ban,
person,
- person_alias_1,
person_block,
post,
},
comment::{Comment, CommentSaved},
comment_reply::CommentReply,
community::{Community, CommunityFollower, CommunityPersonBan, CommunitySafe},
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
person_block::PersonBlock,
post::Post,
},
PersonSafe,
Post,
CommunitySafe,
- PersonSafeAlias1,
+ PersonSafe,
CommentAggregates,
Option<CommunityPersonBan>,
Option<CommunityFollower>,
impl CommentReplyView {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
comment_reply_id: CommentReplyId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
// The left join below will return None in this case
let person_id_join = my_person_id.unwrap_or(PersonId(-1));
.inner_join(person::table.on(comment::creator_id.eq(person::id)))
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table)
+ .inner_join(person_alias_1)
.inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
.left_join(
community_person_ban::table.on(
Person::safe_columns_tuple(),
post::all_columns,
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(),
}
/// Gets the number of unread replies
- pub fn get_unread_replies(conn: &PgConnection, my_person_id: PersonId) -> Result<i64, Error> {
+ pub fn get_unread_replies(conn: &mut PgConnection, my_person_id: PersonId) -> Result<i64, Error> {
use diesel::dsl::*;
comment_reply::table
#[builder(field_defaults(default))]
pub struct CommentReplyQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
my_person_id: Option<PersonId>,
recipient_id: Option<PersonId>,
sort: Option<CommentSortType>,
pub fn list(self) -> Result<Vec<CommentReplyView>, Error> {
use diesel::dsl::*;
+ let person_alias_1 = diesel::alias!(person as person1);
+
// The left join below will return None in this case
let person_id_join = self.my_person_id.unwrap_or(PersonId(-1));
.inner_join(person::table.on(comment::creator_id.eq(person::id)))
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table)
+ .inner_join(person_alias_1)
.inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
.left_join(
community_person_ban::table.on(
Person::safe_columns_tuple(),
post::all_columns,
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(),
type CommunityBlockViewTuple = (PersonSafe, CommunitySafe);
impl CommunityBlockView {
- pub fn for_person(conn: &PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
+ pub fn for_person(conn: &mut PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
let res = community_block::table
.inner_join(person::table)
.inner_join(community::table)
type CommunityFollowerViewTuple = (CommunitySafe, PersonSafe);
impl CommunityFollowerView {
- pub fn for_community(conn: &PgConnection, community_id: CommunityId) -> Result<Vec<Self>, Error> {
+ pub fn for_community(
+ conn: &mut PgConnection,
+ community_id: CommunityId,
+ ) -> Result<Vec<Self>, Error> {
let res = community_follower::table
.inner_join(community::table)
.inner_join(person::table)
Ok(Self::from_tuple_to_vec(res))
}
- pub fn for_person(conn: &PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
+ pub fn for_person(conn: &mut PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
let res = community_follower::table
.inner_join(community::table)
.inner_join(person::table)
type CommunityModeratorViewTuple = (CommunitySafe, PersonSafe);
impl CommunityModeratorView {
- pub fn for_community(conn: &PgConnection, community_id: CommunityId) -> Result<Vec<Self>, Error> {
+ pub fn for_community(
+ conn: &mut PgConnection,
+ community_id: CommunityId,
+ ) -> Result<Vec<Self>, Error> {
let res = community_moderator::table
.inner_join(community::table)
.inner_join(person::table)
Ok(Self::from_tuple_to_vec(res))
}
- pub fn for_person(conn: &PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
+ pub fn for_person(conn: &mut PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
let res = community_moderator::table
.inner_join(community::table)
.inner_join(person::table)
/// Finds all communities first mods / creators
/// Ideally this should be a group by, but diesel doesn't support it yet
- pub fn get_community_first_mods(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn get_community_first_mods(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
let res = community_moderator::table
.inner_join(community::table)
.inner_join(person::table)
impl CommunityPersonBanView {
pub fn get(
- conn: &PgConnection,
+ conn: &mut PgConnection,
from_person_id: PersonId,
from_community_id: CommunityId,
) -> Result<Self, Error> {
impl CommunityView {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
community_id: CommunityId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
}
pub fn is_mod_or_admin(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_id: PersonId,
community_id: CommunityId,
) -> bool {
#[builder(field_defaults(default))]
pub struct CommunityQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
listing_type: Option<ListingType>,
sort: Option<SortType>,
local_user: Option<&'a LocalUser>,
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{person, person_alias_1, person_block},
- source::person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ schema::{person, person_block},
+ source::person::{Person, PersonSafe},
traits::{ToSafe, ViewToVec},
};
-type PersonBlockViewTuple = (PersonSafe, PersonSafeAlias1);
+type PersonBlockViewTuple = (PersonSafe, PersonSafe);
impl PersonBlockView {
- pub fn for_person(conn: &PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
+ pub fn for_person(conn: &mut PgConnection, person_id: PersonId) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
let res = person_block::table
.inner_join(person::table)
- .inner_join(person_alias_1::table) // TODO I dont know if this will be smart abt the column
+ .inner_join(person_alias_1)
.select((
Person::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.filter(person_block::person_id.eq(person_id))
.order_by(person_block::published)
community_follower,
community_person_ban,
person,
- person_alias_1,
person_block,
person_mention,
post,
source::{
comment::{Comment, CommentSaved},
community::{Community, CommunityFollower, CommunityPersonBan, CommunitySafe},
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
person_block::PersonBlock,
person_mention::PersonMention,
post::Post,
PersonSafe,
Post,
CommunitySafe,
- PersonSafeAlias1,
+ PersonSafe,
CommentAggregates,
Option<CommunityPersonBan>,
Option<CommunityFollower>,
impl PersonMentionView {
pub fn read(
- conn: &PgConnection,
+ conn: &mut PgConnection,
person_mention_id: PersonMentionId,
my_person_id: Option<PersonId>,
) -> Result<Self, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
+
// The left join below will return None in this case
let person_id_join = my_person_id.unwrap_or(PersonId(-1));
.inner_join(person::table.on(comment::creator_id.eq(person::id)))
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table)
+ .inner_join(person_alias_1)
.inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
.left_join(
community_person_ban::table.on(
Person::safe_columns_tuple(),
post::all_columns,
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(),
}
/// Gets the number of unread mentions
- pub fn get_unread_mentions(conn: &PgConnection, my_person_id: PersonId) -> Result<i64, Error> {
+ pub fn get_unread_mentions(
+ conn: &mut PgConnection,
+ my_person_id: PersonId,
+ ) -> Result<i64, Error> {
use diesel::dsl::*;
person_mention::table
#[builder(field_defaults(default))]
pub struct PersonMentionQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
my_person_id: Option<PersonId>,
recipient_id: Option<PersonId>,
sort: Option<CommentSortType>,
pub fn list(self) -> Result<Vec<PersonMentionView>, Error> {
use diesel::dsl::*;
+ let person_alias_1 = diesel::alias!(person as person1);
+
// The left join below will return None in this case
let person_id_join = self.my_person_id.unwrap_or(PersonId(-1));
.inner_join(person::table.on(comment::creator_id.eq(person::id)))
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table)
+ .inner_join(person_alias_1)
.inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
.left_join(
community_person_ban::table.on(
Person::safe_columns_tuple(),
post::all_columns,
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
comment_aggregates::all_columns,
community_person_ban::all_columns.nullable(),
community_follower::all_columns.nullable(),
type PersonViewSafeTuple = (PersonSafe, PersonAggregates);
impl PersonViewSafe {
- pub fn read(conn: &PgConnection, person_id: PersonId) -> Result<Self, Error> {
+ pub fn read(conn: &mut PgConnection, person_id: PersonId) -> Result<Self, Error> {
let (person, counts) = person::table
.find(person_id)
.inner_join(person_aggregates::table)
Ok(Self { person, counts })
}
- pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn admins(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
let admins = person::table
.inner_join(person_aggregates::table)
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
Ok(Self::from_tuple_to_vec(admins))
}
- pub fn banned(conn: &PgConnection) -> Result<Vec<Self>, Error> {
+ pub fn banned(conn: &mut PgConnection) -> Result<Vec<Self>, Error> {
let banned = person::table
.inner_join(person_aggregates::table)
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
#[builder(field_defaults(default))]
pub struct PersonQuery<'a> {
#[builder(!default)]
- conn: &'a PgConnection,
+ conn: &'a mut PgConnection,
sort: Option<SortType>,
search_term: Option<String>,
page: Option<i64>,
comment::Comment,
comment_reply::CommentReply,
community::CommunitySafe,
- person::{PersonSafe, PersonSafeAlias1},
+ person::PersonSafe,
person_mention::PersonMention,
post::Post,
},
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PersonBlockView {
pub person: PersonSafe,
- pub target: PersonSafeAlias1,
+ pub target: PersonSafe,
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct PersonMentionView {
pub person_mention: PersonMention,
pub comment: Comment,
pub creator: PersonSafe,
pub post: Post,
pub community: CommunitySafe,
- pub recipient: PersonSafeAlias1,
+ pub recipient: PersonSafe,
pub counts: CommentAggregates,
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
pub subscribed: SubscribedType, // Left join to CommunityFollower
pub my_vote: Option<i16>, // Left join to CommentLike
}
-#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct CommentReplyView {
pub comment_reply: CommentReply,
pub comment: Comment,
pub creator: PersonSafe,
pub post: Post,
pub community: CommunitySafe,
- pub recipient: PersonSafeAlias1,
+ pub recipient: PersonSafe,
pub counts: CommentAggregates,
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
pub subscribed: SubscribedType, // Left join to CommunityFollower
[dependencies]
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema" }
-diesel = { version = "1.4.8", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
-serde = { version = "1.0.136", features = ["derive"] }
+diesel = { version = "2.0.0", features = ["postgres","chrono","r2d2","serde_json"], optional = true }
+serde = { version = "1.0.145", features = ["derive"] }
type AdminPurgeCommentViewTuple = (AdminPurgeComment, Option<PersonSafe>, Post);
impl AdminPurgeCommentView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
type AdminPurgeCommunityViewTuple = (AdminPurgeCommunity, Option<PersonSafe>);
impl AdminPurgeCommunityView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
type AdminPurgePersonViewTuple = (AdminPurgePerson, Option<PersonSafe>);
impl AdminPurgePersonView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
type AdminPurgePostViewTuple = (AdminPurgePost, Option<PersonSafe>, CommunitySafe);
impl AdminPurgePostView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_add_community, person, person_alias_1},
+ schema::{community, mod_add_community, person},
source::{
community::{Community, CommunitySafe},
moderator::ModAddCommunity,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
},
traits::{ToSafe, ViewToVec},
utils::limit_and_offset,
ModAddCommunity,
Option<PersonSafe>,
CommunitySafe,
- PersonSafeAlias1,
+ PersonSafe,
);
impl ModAddCommunityView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.left_join(person::table.on(admin_names_join))
.inner_join(community::table)
.inner_join(
- person_alias_1::table.on(mod_add_community::other_person_id.eq(person_alias_1::id)),
+ person_alias_1.on(mod_add_community::other_person_id.eq(person_alias_1.field(person::id))),
)
.select((
mod_add_community::all_columns,
Person::safe_columns_tuple().nullable(),
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{mod_add, person, person_alias_1},
+ schema::{mod_add, person},
source::{
moderator::ModAdd,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
},
traits::{ToSafe, ViewToVec},
utils::limit_and_offset,
};
-type ModAddViewTuple = (ModAdd, Option<PersonSafe>, PersonSafeAlias1);
+type ModAddViewTuple = (ModAdd, Option<PersonSafe>, PersonSafe);
impl ModAddView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
let mut query = mod_add::table
.left_join(person::table.on(admin_names_join))
- .inner_join(person_alias_1::table.on(mod_add::other_person_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(mod_add::other_person_id.eq(person_alias_1.field(person::id))))
.select((
mod_add::all_columns,
Person::safe_columns_tuple().nullable(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_ban_from_community, person, person_alias_1},
+ schema::{community, mod_ban_from_community, person},
source::{
community::{Community, CommunitySafe},
moderator::ModBanFromCommunity,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
},
traits::{ToSafe, ViewToVec},
utils::limit_and_offset,
ModBanFromCommunity,
Option<PersonSafe>,
CommunitySafe,
- PersonSafeAlias1,
+ PersonSafe,
);
impl ModBanFromCommunityView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.left_join(person::table.on(admin_names_join))
.inner_join(community::table)
.inner_join(
- person_alias_1::table.on(mod_ban_from_community::other_person_id.eq(person_alias_1::id)),
+ person_alias_1
+ .on(mod_ban_from_community::other_person_id.eq(person_alias_1.field(person::id))),
)
.select((
mod_ban_from_community::all_columns,
Person::safe_columns_tuple().nullable(),
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{mod_ban, person, person_alias_1},
+ schema::{mod_ban, person},
source::{
moderator::ModBan,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
},
traits::{ToSafe, ViewToVec},
utils::limit_and_offset,
};
-type ModBanViewTuple = (ModBan, Option<PersonSafe>, PersonSafeAlias1);
+type ModBanViewTuple = (ModBan, Option<PersonSafe>, PersonSafe);
impl ModBanView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
let mut query = mod_ban::table
.left_join(person::table.on(admin_names_join))
- .inner_join(person_alias_1::table.on(mod_ban::other_person_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(mod_ban::other_person_id.eq(person_alias_1.field(person::id))))
.select((
mod_ban::all_columns,
Person::safe_columns_tuple().nullable(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
impl ModHideCommunityView {
// Pass in mod_id as admin_id because only admins can do this action
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_lock_post, person, person_alias_1, post},
+ schema::{community, mod_lock_post, person, post},
source::{
community::{Community, CommunitySafe},
moderator::ModLockPost,
type ModLockPostViewTuple = (ModLockPost, Option<PersonSafe>, Post, CommunitySafe);
impl ModLockPostView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.left_join(person::table.on(admin_names_join))
.inner_join(post::table)
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
.select((
mod_lock_post::all_columns,
Person::safe_columns_tuple().nullable(),
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{comment, community, mod_remove_comment, person, person_alias_1, post},
+ schema::{comment, community, mod_remove_comment, person, post},
source::{
comment::Comment,
community::{Community, CommunitySafe},
moderator::ModRemoveComment,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
post::Post,
},
traits::{ToSafe, ViewToVec},
ModRemoveComment,
Option<PersonSafe>,
Comment,
- PersonSafeAlias1,
+ PersonSafe,
Post,
CommunitySafe,
);
impl ModRemoveCommentView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(lemmy_db_schema::schema::person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
let mut query = mod_remove_comment::table
.left_join(person::table.on(admin_names_join))
.inner_join(comment::table)
- .inner_join(person_alias_1::table.on(comment::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(comment::creator_id.eq(person_alias_1.field(person::id))))
.inner_join(post::table.on(comment::post_id.eq(post::id)))
.inner_join(community::table.on(post::community_id.eq(community::id)))
.select((
mod_remove_comment::all_columns,
Person::safe_columns_tuple().nullable(),
comment::all_columns,
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
post::all_columns,
Community::safe_columns_tuple(),
))
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
type ModRemoveCommunityTuple = (ModRemoveCommunity, Option<PersonSafe>, CommunitySafe);
impl ModRemoveCommunityView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_remove_post, person, person_alias_1, post},
+ schema::{community, mod_remove_post, person, post},
source::{
community::{Community, CommunitySafe},
moderator::ModRemovePost,
type ModRemovePostViewTuple = (ModRemovePost, Option<PersonSafe>, Post, CommunitySafe);
impl ModRemovePostView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.left_join(person::table.on(admin_names_join))
.inner_join(post::table)
.inner_join(community::table.on(post::community_id.eq(community::id)))
- .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
.select((
mod_remove_post::all_columns,
Person::safe_columns_tuple().nullable(),
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_sticky_post, person, person_alias_1, post},
+ schema::{community, mod_sticky_post, person, post},
source::{
community::{Community, CommunitySafe},
moderator::ModStickyPost,
type ModStickyPostViewTuple = (ModStickyPost, Option<PersonSafe>, Post, CommunitySafe);
impl ModStickyPostView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
let mut query = mod_sticky_post::table
.left_join(person::table.on(admin_names_join))
.inner_join(post::table)
- .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
+ .inner_join(person_alias_1.on(post::creator_id.eq(person_alias_1.field(person::id))))
.inner_join(community::table.on(post::community_id.eq(community::id)))
.select((
mod_sticky_post::all_columns,
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
use diesel::{result::Error, *};
use lemmy_db_schema::{
newtypes::PersonId,
- schema::{community, mod_transfer_community, person, person_alias_1},
+ schema::{community, mod_transfer_community, person},
source::{
community::{Community, CommunitySafe},
moderator::ModTransferCommunity,
- person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
+ person::{Person, PersonSafe},
},
traits::{ToSafe, ViewToVec},
utils::limit_and_offset,
ModTransferCommunity,
Option<PersonSafe>,
CommunitySafe,
- PersonSafeAlias1,
+ PersonSafe,
);
impl ModTransferCommunityView {
- pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ let person_alias_1 = diesel::alias!(person as person1);
let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1));
let show_mod_names = !params.hide_modlog_names;
let show_mod_names_expr = show_mod_names.as_sql::<diesel::sql_types::Bool>();
.left_join(person::table.on(admin_names_join))
.inner_join(community::table)
.inner_join(
- person_alias_1::table.on(mod_transfer_community::other_person_id.eq(person_alias_1::id)),
+ person_alias_1
+ .on(mod_transfer_community::other_person_id.eq(person_alias_1.field(person::id))),
)
.select((
mod_transfer_community::all_columns,
Person::safe_columns_tuple().nullable(),
Community::safe_columns_tuple(),
- PersonAlias1::safe_columns_tuple(),
+ person_alias_1.fields(Person::safe_columns_tuple()),
))
.into_boxed();
};
if let Some(other_person_id) = params.other_person_id {
- query = query.filter(person_alias_1::id.eq(other_person_id));
+ query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
};
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
ModStickyPost,
ModTransferCommunity,
},
- person::{PersonSafe, PersonSafeAlias1},
+ person::PersonSafe,
post::Post,
},
};
pub mod_add_community: ModAddCommunity,
pub moderator: Option<PersonSafe>,
pub community: CommunitySafe,
- pub modded_person: PersonSafeAlias1,
+ pub modded_person: PersonSafe,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModAddView {
pub mod_add: ModAdd,
pub moderator: Option<PersonSafe>,
- pub modded_person: PersonSafeAlias1,
+ pub modded_person: PersonSafe,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub mod_ban_from_community: ModBanFromCommunity,
pub moderator: Option<PersonSafe>,
pub community: CommunitySafe,
- pub banned_person: PersonSafeAlias1,
+ pub banned_person: PersonSafe,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModBanView {
pub mod_ban: ModBan,
pub moderator: Option<PersonSafe>,
- pub banned_person: PersonSafeAlias1,
+ pub banned_person: PersonSafe,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub mod_remove_comment: ModRemoveComment,
pub moderator: Option<PersonSafe>,
pub comment: Comment,
- pub commenter: PersonSafeAlias1,
+ pub commenter: PersonSafe,
pub post: Post,
pub community: CommunitySafe,
}
pub mod_transfer_community: ModTransferCommunity,
pub moderator: Option<PersonSafe>,
pub community: CommunitySafe,
- pub modded_person: PersonSafeAlias1,
+ pub modded_person: PersonSafe,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema" }
lemmy_api_common = { version = "=0.16.5", path = "../api_common" }
lemmy_apub = { version = "=0.16.5", path = "../apub" }
-diesel = "1.4.8"
-actix-web = { version = "4.0.1", default-features = false, features = ["rustls"] }
-anyhow = "1.0.56"
-chrono = { version = "0.4.19", features = ["serde"], default-features = false }
-futures = "0.3.21"
-reqwest = { version = "0.11.10", features = ["stream"] }
-reqwest-middleware = "0.1.5"
-rss = "2.0.0"
-serde = { version = "1.0.136", features = ["derive"] }
-url = { version = "2.2.2", features = ["serde"] }
-strum = "0.24.0"
-once_cell = "1.10.0"
-tracing = "0.1.32"
-tokio = { version = "1.17.0", features = ["sync"] }
+diesel = "2.0.0"
+actix-web = { version = "4.2.1", default-features = false, features = ["rustls"] }
+anyhow = "1.0.65"
+chrono = { version = "0.4.22", features = ["serde"], default-features = false }
+futures = "0.3.24"
+reqwest = { version = "0.11.12", features = ["stream"] }
+reqwest-middleware = "0.1.6"
+rss = "2.0.1"
+serde = { version = "1.0.145", features = ["derive"] }
+url = { version = "2.3.1", features = ["serde"] }
+strum = "0.24.1"
+once_cell = "1.15.0"
+tracing = "0.1.36"
+tokio = { version = "1.21.1", features = ["sync"] }
#[tracing::instrument(skip_all)]
fn get_feed_user(
- conn: &PgConnection,
+ conn: &mut PgConnection,
sort_type: &SortType,
user_name: &str,
protocol_and_hostname: &str,
#[tracing::instrument(skip_all)]
fn get_feed_community(
- conn: &PgConnection,
+ conn: &mut PgConnection,
sort_type: &SortType,
community_name: &str,
protocol_and_hostname: &str,
#[tracing::instrument(skip_all)]
fn get_feed_front(
- conn: &PgConnection,
+ conn: &mut PgConnection,
jwt_secret: &str,
sort_type: &SortType,
jwt: &str,
#[tracing::instrument(skip_all)]
fn get_feed_inbox(
- conn: &PgConnection,
+ conn: &mut PgConnection,
jwt_secret: &str,
jwt: &str,
protocol_and_hostname: &str,
doctest = false
[dependencies]
-regex = "1.5.5"
-chrono = { version = "0.4.19", features = ["serde", "clock"], default-features = false }
-lettre = "0.10.0-rc.7"
-tracing = "0.1.32"
+regex = "1.6.0"
+chrono = { version = "0.4.22", features = ["serde", "clock"], default-features = false }
+lettre = "0.10.1"
+tracing = "0.1.36"
tracing-error = "0.2.0"
-itertools = "0.10.3"
+itertools = "0.10.5"
rand = "0.8.5"
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
-comrak = { version = "0.12.1", default-features = false }
-once_cell = "1.10.0"
-openssl = "0.10.38"
-url = { version = "2.2.2", features = ["serde"] }
-actix-web = { version = "4.0.1", default-features = false, features = ["rustls"] }
-anyhow = "1.0.56"
-reqwest-middleware = "0.1.5"
-strum = "0.24.0"
-strum_macros = "0.24.0"
-futures = "0.3.21"
-diesel = "1.4.8"
-http = "0.2.6"
+serde = { version = "1.0.145", features = ["derive"] }
+serde_json = { version = "1.0.85", features = ["preserve_order"] }
+comrak = { version = "0.14.0", default-features = false }
+once_cell = "1.15.0"
+openssl = "0.10.41"
+url = { version = "2.3.1", features = ["serde"] }
+actix-web = { version = "4.2.1", default-features = false, features = ["rustls"] }
+anyhow = "1.0.65"
+reqwest-middleware = "0.1.6"
+strum = "0.24.1"
+strum_macros = "0.24.3"
+futures = "0.3.24"
+diesel = { version = "2.0.0", features = ["chrono"] }
+http = "0.2.8"
deser-hjson = "1.0.2"
smart-default = "0.6.0"
-jsonwebtoken = "8.0.1"
+jsonwebtoken = "8.1.1"
doku = { version = "0.12.0", features = ["url-2"] }
-uuid = { version = "0.8.2", features = ["serde", "v4"] }
-html2text = "0.3.1"
+uuid = { version = "1.1.2", features = ["serde", "v4"] }
+html2text = "0.4.2"
rosetta-i18n = "0.1.2"
-parking_lot = "0.12.0"
+parking_lot = "0.12.1"
[build-dependencies]
rosetta-build = "0.1.2"
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", features = ["full"] }
lemmy_db_views = { version = "=0.16.5", path = "../db_views", features = ["full"] }
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor", features = ["full"] }
-reqwest-middleware = "0.1.5"
-tracing = "0.1.32"
+reqwest-middleware = "0.1.6"
+tracing = "0.1.36"
rand = "0.8.5"
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
+serde = { version = "1.0.145", features = ["derive"] }
+serde_json = { version = "1.0.85", features = ["preserve_order"] }
actix = "0.13.0"
-anyhow = "1.0.56"
-diesel = "1.4.8"
+anyhow = "1.0.65"
+diesel = "2.0.0"
background-jobs = "0.12.0"
-tokio = "1.17.0"
-strum = "0.24.0"
-strum_macros = "0.24.0"
-chrono = { version = "0.4.19", features = ["serde"], default-features = false }
-actix-web = { version = "4.0.1", default-features = false, features = ["rustls"] }
+tokio = "1.21.1"
+strum = "0.24.1"
+strum_macros = "0.24.3"
+chrono = { version = "0.4.22", features = ["serde"], default-features = false }
+actix-web = { version = "4.2.1", default-features = false, features = ["rustls"] }
actix-web-actors = { version = "4.1.0", default-features = false }
opentelemetry = "0.17.0"
tracing-opentelemetry = "0.17.2"
--- /dev/null
+create view person_alias_1 as select * from person;
+create view person_alias_2 as select * from person;
--- /dev/null
+-- Drop the alias views
+drop view person_alias_1, person_alias_2;
use url::Url;
pub fn run_advanced_migrations(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
user_updates_2020_04_02(conn, protocol_and_hostname)?;
}
fn user_updates_2020_04_02(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::person::dsl::*;
}
fn community_updates_2020_04_02(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::community::dsl::*;
}
fn post_updates_2020_04_03(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::post::dsl::*;
}
fn comment_updates_2020_04_03(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::comment::dsl::*;
}
fn private_message_updates_2020_05_05(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::private_message::dsl::*;
}
fn post_thumbnail_url_updates_2020_07_27(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
use lemmy_db_schema::schema::post::dsl::*;
/// We are setting inbox and follower URLs for local and remote actors alike, because for now
/// all federated instances are also Lemmy and use the same URL scheme.
-fn apub_columns_2021_02_02(conn: &PgConnection) -> Result<(), LemmyError> {
+fn apub_columns_2021_02_02(conn: &mut PgConnection) -> Result<(), LemmyError> {
info!("Running apub_columns_2021_02_02");
{
use lemmy_db_schema::schema::person::dsl::*;
/// Before this point, there is only a single value in the site table which refers to the local
/// Lemmy instance, so thats all we need to update.
fn instance_actor_2022_01_28(
- conn: &PgConnection,
+ conn: &mut PgConnection,
protocol_and_hostname: &str,
) -> Result<(), LemmyError> {
info!("Running instance_actor_2021_09_29");
/// key field is empty, generate a new keypair. It would be possible to regenerate only the pubkey,
/// but thats more complicated and has no benefit, as federation is already broken for these actors.
/// https://github.com/LemmyNet/lemmy/issues/2347
-fn regenerate_public_keys_2022_07_05(conn: &PgConnection) -> Result<(), LemmyError> {
+fn regenerate_public_keys_2022_07_05(conn: &mut PgConnection) -> Result<(), LemmyError> {
info!("Running regenerate_public_keys_2022_07_05");
{
#[macro_use]
extern crate diesel_migrations;
+use crate::diesel_migrations::MigrationHarness;
use actix::prelude::*;
use actix_web::{web::Data, *};
use diesel::{
r2d2::{ConnectionManager, Pool},
PgConnection,
};
+use diesel_migrations::EmbeddedMigrations;
use doku::json::{AutoComments, Formatting};
use lemmy_api::match_websocket_operation;
use lemmy_api_common::{
};
use tracing_actix_web::TracingLogger;
-embed_migrations!();
+pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
/// Max timeout for http requests
pub const REQWEST_TIMEOUT: Duration = Duration::from_secs(10);
// Run the migrations from code
let protocol_and_hostname = settings.get_protocol_and_hostname();
blocking(&pool, move |conn| {
- embedded_migrations::run(conn)?;
+ let _ = conn
+ .run_pending_migrations(MIGRATIONS)
+ .map_err(|_| LemmyError::from_message("Couldn't run migrations"))?;
run_advanced_migrations(conn, &protocol_and_hostname)?;
Ok(()) as Result<(), LemmyError>
})
};
// Initialize the secrets
- let conn = pool.get()?;
- let secret = Secret::init(&conn).expect("Couldn't initialize secrets.");
+ let conn = &mut pool.get()?;
+ let secret = Secret::init(conn).expect("Couldn't initialize secrets.");
println!(
"Starting http server at {}:{}",
};
let client = ClientBuilder::new(reqwest_client.clone())
- .with(TracingMiddleware)
+ .with(TracingMiddleware::default())
.with(RetryTransientMiddleware::new_with_policy(retry_policy))
.build();
// Pictrs cannot use the retry middleware
let pictrs_client = ClientBuilder::new(reqwest_client.clone())
- .with(TracingMiddleware)
+ .with(TracingMiddleware::default())
.build();
check_private_instance_and_federation_enabled(&pool, &settings).await?;
pub fn setup(pool: DbPool) -> Result<(), LemmyError> {
let mut scheduler = Scheduler::new();
- let conn = pool.get()?;
- active_counts(&conn);
- update_banned_when_expired(&conn);
+ let mut conn = pool.get()?;
+ active_counts(&mut conn);
+ update_banned_when_expired(&mut conn);
// On startup, reindex the tables non-concurrently
// TODO remove this for now, since it slows down startup a lot on lemmy.ml
- reindex_aggregates_tables(&conn, true);
+ reindex_aggregates_tables(&mut conn, true);
scheduler.every(1.hour()).run(move || {
- active_counts(&conn);
- update_banned_when_expired(&conn);
- reindex_aggregates_tables(&conn, true);
- drop_ccnew_indexes(&conn);
+ active_counts(&mut conn);
+ update_banned_when_expired(&mut conn);
+ reindex_aggregates_tables(&mut conn, true);
+ drop_ccnew_indexes(&mut conn);
});
- let conn = pool.get()?;
- clear_old_activities(&conn);
+ let mut conn = pool.get()?;
+ clear_old_activities(&mut conn);
scheduler.every(1.weeks()).run(move || {
- clear_old_activities(&conn);
+ clear_old_activities(&mut conn);
});
// Manually run the scheduler in an event loop
/// Reindex the aggregates tables every one hour
/// This is necessary because hot_rank is actually a mutable function:
/// https://dba.stackexchange.com/questions/284052/how-to-create-an-index-based-on-a-time-based-function-in-postgres?noredirect=1#comment555727_284052
-fn reindex_aggregates_tables(conn: &PgConnection, concurrently: bool) {
+fn reindex_aggregates_tables(conn: &mut PgConnection, concurrently: bool) {
for table_name in &[
"post_aggregates",
"comment_aggregates",
}
}
-fn reindex_table(conn: &PgConnection, table_name: &str, concurrently: bool) {
+fn reindex_table(conn: &mut PgConnection, table_name: &str, concurrently: bool) {
let concurrently_str = if concurrently { "concurrently" } else { "" };
info!("Reindexing table {} {} ...", concurrently_str, table_name);
let query = format!("reindex table {} {}", concurrently_str, table_name);
}
/// Clear old activities (this table gets very large)
-fn clear_old_activities(conn: &PgConnection) {
+fn clear_old_activities(conn: &mut PgConnection) {
info!("Clearing old activities...");
Activity::delete_olds(conn).expect("clear old activities");
info!("Done.");
}
/// Re-calculate the site and community active counts every 12 hours
-fn active_counts(conn: &PgConnection) {
+fn active_counts(conn: &mut PgConnection) {
info!("Updating active site and community aggregates ...");
let intervals = vec![
}
/// Set banned to false after ban expires
-fn update_banned_when_expired(conn: &PgConnection) {
+fn update_banned_when_expired(conn: &mut PgConnection) {
info!("Updating banned column if it expires ...");
let update_ban_expires_stmt =
"update person set banned = false where banned = true and ban_expires < now()";
/// Drops the phantom CCNEW indexes created by postgres
/// https://github.com/LemmyNet/lemmy/issues/2431
-fn drop_ccnew_indexes(conn: &PgConnection) {
+fn drop_ccnew_indexes(conn: &mut PgConnection) {
info!("Dropping phantom ccnew indexes...");
let drop_stmt = "select drop_ccnew_indexes()";
sql_query(drop_stmt)