add: town square forum config
This commit is contained in:
parent
d4ff681310
commit
548a6dcf4e
8 changed files with 73 additions and 5 deletions
|
@ -119,7 +119,7 @@ pub async fn update_context_request(
|
|||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
Path(id): Path<usize>,
|
||||
Json(req): Json<UpdateCommunityContext>,
|
||||
Json(mut req): Json<UpdateCommunityContext>,
|
||||
) -> impl IntoResponse {
|
||||
let data = &(data.read().await).0;
|
||||
let user = match get_user_from_token!(jar, data, oauth::AppScope::CommunityManage) {
|
||||
|
@ -127,6 +127,16 @@ pub async fn update_context_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
let community = match data.get_community_by_id_no_void(id).await {
|
||||
Ok(x) => x,
|
||||
Err(e) => return Json(e.into()),
|
||||
};
|
||||
|
||||
if community.is_forge || community.is_forum {
|
||||
req.context.enable_titles = true;
|
||||
req.context.require_titles = true;
|
||||
}
|
||||
|
||||
// check lengths
|
||||
if req.context.display_name.len() > 32 {
|
||||
return Json(Error::DataTooLong("display name".to_string()).into());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue