fix: don't show owner twice in community member list
This commit is contained in:
parent
f14f84773e
commit
c0a4bb3159
2 changed files with 4 additions and 2 deletions
|
@ -454,7 +454,7 @@ pub async fn members_request(
|
|||
// ...
|
||||
let list = match data
|
||||
.0
|
||||
.get_memberships_by_community(community.id, 12, props.page)
|
||||
.get_memberships_by_community(community.id, community.owner, 12, props.page)
|
||||
.await
|
||||
{
|
||||
Ok(p) => match data.0.fill_users(p).await {
|
||||
|
|
|
@ -107,6 +107,7 @@ impl DataManager {
|
|||
pub async fn get_memberships_by_community(
|
||||
&self,
|
||||
community: usize,
|
||||
community_owner: usize, // the owner is always shown at the top of the first page
|
||||
batch: usize,
|
||||
page: usize,
|
||||
) -> Result<Vec<CommunityMembership>> {
|
||||
|
@ -118,9 +119,10 @@ impl DataManager {
|
|||
let res = query_rows!(
|
||||
&conn,
|
||||
// 33 = banned, 65 = pending membership
|
||||
"SELECT * FROM memberships WHERE community = $1 AND NOT role = 33 AND NOT role = 65 ORDER BY created DESC LIMIT $2 OFFSET $3",
|
||||
"SELECT * FROM memberships WHERE community = $1 AND NOT owner = $2 AND NOT role = 33 AND NOT role = 65 ORDER BY created DESC LIMIT $3 OFFSET $4",
|
||||
&[
|
||||
&(community as i64),
|
||||
&(community_owner as i64),
|
||||
&(batch as i64),
|
||||
&((page * batch) as i64)
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue