diff options
author | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-28 19:11:47 -0600 |
---|---|---|
committer | Colin Reeder <vpzomtrrfrt@gmail.com> | 2020-10-28 19:11:47 -0600 |
commit | 0f6a95883de01c409bc737463f99f977fc000c0b (patch) | |
tree | f282633c2fadb634c56028fbf499f1885c16622a | |
parent | 8797de5e2981bc73780515959a46c946da8f2c6f (diff) |
Disallow listing moderators for non-local communities
This was never useful, since the list isn't federated
-rw-r--r-- | res/lang/en.ftl | 1 | ||||
-rw-r--r-- | res/lang/eo.ftl | 1 | ||||
-rw-r--r-- | src/routes/api/communities.rs | 13 |
3 files changed, 13 insertions, 2 deletions
diff --git a/res/lang/en.ftl b/res/lang/en.ftl index 27483af..4c17d07 100644 --- a/res/lang/en.ftl +++ b/res/lang/en.ftl @@ -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 diff --git a/res/lang/eo.ftl b/res/lang/eo.ftl index ebba8b8..c63b545 100644 --- a/res/lang/eo.ftl +++ b/res/lang/eo.ftl @@ -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 diff --git a/src/routes/api/communities.rs b/src/routes/api/communities.rs index 89215b0..f4d919d 100644 --- a/src/routes/api/communities.rs +++ b/src/routes/api/communities.rs @@ -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(), + ))) + } + } } })?; |