- // TODO: this function is only used by is_mod_or_admin() below, can probably be merged
- fn community_mods_and_admins(
- conn: &PgConnection,
- community_id: CommunityId,
- ) -> Result<Vec<PersonId>, Error> {
- let mut mods_and_admins: Vec<PersonId> = Vec::new();
- mods_and_admins.append(
- &mut CommunityModeratorView::for_community(conn, community_id)
- .map(|v| v.into_iter().map(|m| m.moderator.id).collect())?,
- );
- mods_and_admins.append(
- &mut PersonViewSafe::admins(conn).map(|v| v.into_iter().map(|a| a.person.id).collect())?,
- );
- Ok(mods_and_admins)
- }
-