New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Be more explicit about returning deleted actors or not #2335
Conversation
q.filter(deleted.eq(false)) | ||
.filter(removed.eq(false)) | ||
.first::<Self>(conn) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little awkward, not sure if theres a better way to write the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do .into_boxed()
Then you can do:
`if .... {
q = q.filter(...)
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this? Gives me error "overflow evaluating the requirement _: Sized
".
let mut q = community
.filter(local.eq(true))
.filter(lower(name).eq(lower(community_name))).into_boxed();
if !include_deleted {
q = q.filter(deleted.eq(false))
.filter(removed.eq(false)).into_boxed();
}
q.first::<Self>(conn)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do the into_boxed before filters I think.
@@ -58,7 +58,7 @@ where | |||
let identifier = identifier.to_string(); | |||
Ok( | |||
blocking(context.pool(), move |conn| { | |||
DbActor::read_from_name(conn, &identifier) | |||
DbActor::read_from_name(conn, &identifier, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search should probably not list deleted users or communities.
Works as expected. |
q.filter(deleted.eq(false)) | ||
.filter(removed.eq(false)) | ||
.first::<Self>(conn) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do .into_boxed()
Then you can do:
`if .... {
q = q.filter(...)
;
q.first::<Self>(conn) | ||
} else { | ||
q.filter(deleted.eq(false)).first::<Self>(conn) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this one here.
1133991
to
3425e9e
Compare
updated |
* Be more explicit about returning deleted actors or not * simplify db queries
Still have to test this.