add: "ask about this" from neospring
This commit is contained in:
parent
f94570f74c
commit
2c83ed3d9d
9 changed files with 122 additions and 31 deletions
|
@ -96,6 +96,13 @@ pub async fn create_request(
|
|||
props.context.mask_owner = true;
|
||||
}
|
||||
|
||||
if !req.asking_about.is_empty() && !req.is_global {
|
||||
props.context.asking_about = match req.asking_about.parse::<usize>() {
|
||||
Ok(x) => Some(x),
|
||||
Err(e) => return Json(Error::MiscError(e.to_string()).into()),
|
||||
}
|
||||
}
|
||||
|
||||
match data
|
||||
.create_question(props, drawings.iter().map(|x| x.to_vec()).collect())
|
||||
.await
|
||||
|
|
|
@ -865,6 +865,8 @@ pub struct CreateQuestion {
|
|||
pub community: String,
|
||||
#[serde(default)]
|
||||
pub mask_owner: bool,
|
||||
#[serde(default)]
|
||||
pub asking_about: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use super::{render_error, PaginatedQuery, RepostsQuery, SearchedQuery};
|
||||
use crate::{
|
||||
assets::initial_context, check_user_blocked_or_private, get_lang, get_user_from_token, State,
|
||||
|
@ -798,7 +800,11 @@ pub async fn post_request(
|
|||
let (_, reposting) = data.0.get_post_reposting(&post, &ignore_users, &user).await;
|
||||
|
||||
// check question
|
||||
let question = match data.0.get_post_question(&post, &ignore_users).await {
|
||||
let question = match data
|
||||
.0
|
||||
.get_post_question(&post, &ignore_users, &mut HashMap::new())
|
||||
.await
|
||||
{
|
||||
Ok(q) => q,
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
|
||||
};
|
||||
|
@ -918,7 +924,11 @@ pub async fn reposts_request(
|
|||
let reposting = data.0.get_post_reposting(&post, &ignore_users, &user).await;
|
||||
|
||||
// check question
|
||||
let question = match data.0.get_post_question(&post, &ignore_users).await {
|
||||
let question = match data
|
||||
.0
|
||||
.get_post_question(&post, &ignore_users, &mut HashMap::new())
|
||||
.await
|
||||
{
|
||||
Ok(q) => q,
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
|
||||
};
|
||||
|
@ -1069,7 +1079,11 @@ pub async fn likes_request(
|
|||
.await;
|
||||
|
||||
// check question
|
||||
let question = match data.0.get_post_question(&post, &ignore_users).await {
|
||||
let question = match data
|
||||
.0
|
||||
.get_post_question(&post, &ignore_users, &mut HashMap::new())
|
||||
.await
|
||||
{
|
||||
Ok(q) => q,
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue