fix: don't show owner twice in community member list

This commit is contained in:
trisua 2025-04-09 21:17:42 -04:00
parent f14f84773e
commit c0a4bb3159
2 changed files with 4 additions and 2 deletions

View file

@ -454,7 +454,7 @@ pub async fn members_request(
// ... // ...
let list = match data let list = match data
.0 .0
.get_memberships_by_community(community.id, 12, props.page) .get_memberships_by_community(community.id, community.owner, 12, props.page)
.await .await
{ {
Ok(p) => match data.0.fill_users(p).await { Ok(p) => match data.0.fill_users(p).await {

View file

@ -107,6 +107,7 @@ impl DataManager {
pub async fn get_memberships_by_community( pub async fn get_memberships_by_community(
&self, &self,
community: usize, community: usize,
community_owner: usize, // the owner is always shown at the top of the first page
batch: usize, batch: usize,
page: usize, page: usize,
) -> Result<Vec<CommunityMembership>> { ) -> Result<Vec<CommunityMembership>> {
@ -118,9 +119,10 @@ impl DataManager {
let res = query_rows!( let res = query_rows!(
&conn, &conn,
// 33 = banned, 65 = pending membership // 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 as i64),
&(community_owner as i64),
&(batch as i64), &(batch as i64),
&((page * batch) as i64) &((page * batch) as i64)
], ],