~vpzom/lotide

0f6a95883de01c409bc737463f99f977fc000c0b — Colin Reeder 11 months ago 8797de5
Disallow listing moderators for non-local communities

This was never useful, since the list isn't federated
3 files changed, 13 insertions(+), 2 deletions(-)

M res/lang/en.ftl
M res/lang/eo.ftl
M src/routes/api/communities.rs
M res/lang/en.ftl => res/lang/en.ftl +1 -0
@@ 2,6 2,7 @@ comment_content_conflict = Exactly one of content_markdown and content_text must
comment_empty = Comment may not be empty
comment_not_yours = That's not your comment
community_edit_denied = You are not authorized to modify this community
community_moderators_not_local = Community moderators can only be listed for local communities
community_name_disallowed_chars = Community name contains disallowed characters
email_content_forgot_password = Hi { $username }, if you requested a password reset from lotide, use this code: { $key }
email_not_configured = Email is not configured on this server

M res/lang/eo.ftl => res/lang/eo.ftl +1 -0
@@ 2,6 2,7 @@ comment_content_conflict = Precize unu el content_markdown kaj content_text deva
comment_empty = Komento ne rajtas malpleni
comment_not_yours = Tio ne estas via komento
community_edit_denied = Vi ne rajtas ŝanĝi ĉi tiun komunumo
community_moderators_not_local = Nur povas listigi kontrolantojn de loka komunumoj
community_name_disallowed_chars = Nomo enhavas malpermesitajn signojn
email_content_forgot_password = Saluton { $username }, se vi petis rekomencigo de pasvorto de lotide, uzu ĉi tiun kodon: { $key }
email_not_configured = Retpoŝto ne estas ŝaltita en ĉi tiu servilo

M src/routes/api/communities.rs => src/routes/api/communities.rs +11 -2
@@ 341,7 341,7 @@ async fn route_unstable_communities_moderators_list(

    ({
        let row = db
            .query_opt("SELECT 1 FROM community WHERE id=$1", &[&community_id])
            .query_opt("SELECT local FROM community WHERE id=$1", &[&community_id])
            .await?;

        match row {


@@ 349,7 349,16 @@ async fn route_unstable_communities_moderators_list(
                hyper::StatusCode::NOT_FOUND,
                lang.tr("no_such_community", None).into_owned(),
            ))),
            Some(_) => Ok(()),
            Some(row) => {
                if row.get(0) {
                    Ok(())
                } else {
                    Err(crate::Error::UserError(crate::simple_response(
                        hyper::StatusCode::NOT_FOUND,
                        lang.tr("community_moderators_not_local", None).into_owned(),
                    )))
                }
            }
        }
    })?;