add: forges ui
TODO: forges tickets feed, posts open/closed state
This commit is contained in:
parent
5b1db42c51
commit
a6140f7c8c
40 changed files with 1664 additions and 1270 deletions
|
@ -49,10 +49,15 @@ pub async fn create_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
match data
|
||||
.create_community(Community::new(req.title, user.id))
|
||||
.await
|
||||
{
|
||||
let mut c = Community::new(req.title, user.id);
|
||||
|
||||
if req.forge {
|
||||
c.is_forge = true;
|
||||
c.context.enable_titles = true;
|
||||
c.context.require_titles = true;
|
||||
}
|
||||
|
||||
match data.create_community(c).await {
|
||||
Ok(id) => Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Community created".to_string(),
|
||||
|
@ -117,6 +122,16 @@ pub async fn update_context_request(
|
|||
None => return Json(Error::NotAllowed.into()),
|
||||
};
|
||||
|
||||
// check lengths
|
||||
if req.context.display_name.len() > 32 {
|
||||
return Json(Error::DataTooLong("display name".to_string()).into());
|
||||
}
|
||||
|
||||
if req.context.description.len() > 2_usize.pow(14) {
|
||||
return Json(Error::DataTooLong("description".to_string()).into());
|
||||
}
|
||||
|
||||
// ...
|
||||
match data.update_community_context(id, &user, req.context).await {
|
||||
Ok(_) => Json(ApiReturn {
|
||||
ok: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue