Skip to content
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

Merged
merged 2 commits into from Jul 5, 2022

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Jun 27, 2022

Still have to test this.

q.filter(deleted.eq(false))
.filter(removed.eq(false))
.first::<Self>(conn)
}
Copy link
Member Author

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.

Copy link
Member

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(...)
;

Copy link
Member Author

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)

Copy link
Member

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)
Copy link
Member Author

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.

@Nutomic Nutomic marked this pull request as ready for review June 28, 2022 10:54
@Nutomic Nutomic requested a review from dessalines as a code owner June 28, 2022 10:54
@Nutomic
Copy link
Member Author

Nutomic commented Jun 28, 2022

Works as expected.

q.filter(deleted.eq(false))
.filter(removed.eq(false))
.first::<Self>(conn)
}
Copy link
Member

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)
}
Copy link
Member

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.

@Nutomic Nutomic force-pushed the handle-better-deleted-actors branch from 1133991 to 3425e9e Compare June 29, 2022 09:27
@Nutomic
Copy link
Member Author

Nutomic commented Jun 29, 2022

updated

@dessalines dessalines merged commit b7a2677 into main Jul 5, 2022
Nutomic added a commit that referenced this pull request Jul 18, 2022
* Be more explicit about returning deleted actors or not

* simplify db queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants