Skip to content

Commit 16efe0d

Browse files
authored
Merge pull request #321 from LemmyNet/main
[pull] master from LemmyNet:main
2 parents 71bf6b0 + 86382b9 commit 16efe0d

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

Cargo.lock

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "1.0.0-alpha.3"
2+
version = "1.0.0-alpha.4"
33
edition = "2021"
44
description = "A link aggregator for the fediverse"
55
license = "AGPL-3.0"
@@ -79,15 +79,15 @@ map_err_ignore = "deny"
7979
expect_used = "deny"
8080

8181
[workspace.dependencies]
82-
lemmy_api = { version = "=1.0.0-alpha.3", path = "./crates/api" }
83-
lemmy_api_crud = { version = "=1.0.0-alpha.3", path = "./crates/api_crud" }
84-
lemmy_apub = { version = "=1.0.0-alpha.3", path = "./crates/apub" }
85-
lemmy_utils = { version = "=1.0.0-alpha.3", path = "./crates/utils", default-features = false }
86-
lemmy_db_schema = { version = "=1.0.0-alpha.3", path = "./crates/db_schema" }
87-
lemmy_api_common = { version = "=1.0.0-alpha.3", path = "./crates/api_common" }
88-
lemmy_routes = { version = "=1.0.0-alpha.3", path = "./crates/routes" }
89-
lemmy_db_views = { version = "=1.0.0-alpha.3", path = "./crates/db_views" }
90-
lemmy_federate = { version = "=1.0.0-alpha.3", path = "./crates/federate" }
82+
lemmy_api = { version = "=1.0.0-alpha.4", path = "./crates/api" }
83+
lemmy_api_crud = { version = "=1.0.0-alpha.4", path = "./crates/api_crud" }
84+
lemmy_apub = { version = "=1.0.0-alpha.4", path = "./crates/apub" }
85+
lemmy_utils = { version = "=1.0.0-alpha.4", path = "./crates/utils", default-features = false }
86+
lemmy_db_schema = { version = "=1.0.0-alpha.4", path = "./crates/db_schema" }
87+
lemmy_api_common = { version = "=1.0.0-alpha.4", path = "./crates/api_common" }
88+
lemmy_routes = { version = "=1.0.0-alpha.4", path = "./crates/routes" }
89+
lemmy_db_views = { version = "=1.0.0-alpha.4", path = "./crates/db_views" }
90+
lemmy_federate = { version = "=1.0.0-alpha.4", path = "./crates/federate" }
9191
activitypub_federation = { version = "0.6.3", default-features = false, features = [
9292
"actix-web",
9393
] }

crates/db_schema/src/impls/comment.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
diesel::{DecoratableTarget, OptionalExtension},
33
newtypes::{CommentId, DbUrl, InstanceId, PersonId},
4-
schema::{comment, comment_actions, post},
4+
schema::{comment, comment_actions, community, post},
55
source::comment::{
66
Comment,
77
CommentActions,
@@ -26,6 +26,7 @@ use diesel::{
2626
result::Error,
2727
update,
2828
ExpressionMethods,
29+
JoinOnDsl,
2930
QueryDsl,
3031
};
3132
use diesel_async::RunQueryDsl;
@@ -78,8 +79,9 @@ impl Comment {
7879
// Diesel can't update from join unfortunately, so you'll need to loop over these
7980
let comment_ids = comment::table
8081
.inner_join(post::table)
82+
.inner_join(community::table.on(post::community_id.eq(community::id)))
8183
.filter(comment::creator_id.eq(creator_id))
82-
.filter(post::instance_id.eq(instance_id))
84+
.filter(community::instance_id.eq(instance_id))
8385
.select(comment::id)
8486
.load::<CommentId>(conn)
8587
.await?;

crates/db_schema/src/impls/post.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ impl Post {
162162
}
163163

164164
if let Some(for_instance_id) = for_instance_id {
165-
update = update.filter(post::instance_id.eq(for_instance_id));
165+
// Diesel can't update from join unfortunately, so you'll need to loop over these
166+
let post_ids = post::table
167+
.inner_join(community::table)
168+
.filter(post::creator_id.eq(for_creator_id))
169+
.filter(community::instance_id.eq(for_instance_id))
170+
.select(post::id)
171+
.load::<PostId>(conn)
172+
.await?;
173+
update = update.filter(post::id.eq_any(post_ids));
166174
}
167175

168176
update

0 commit comments

Comments
 (0)