fix: question request deletion
This commit is contained in:
parent
687766f5ee
commit
797231946a
2 changed files with 12 additions and 4 deletions
|
@ -425,8 +425,16 @@ pub async fn requests_request(
|
||||||
|
|
||||||
q.push(match data.0.get_question_by_id(req.linked_asset).await {
|
q.push(match data.0.get_question_by_id(req.linked_asset).await {
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
Err(e) => {
|
Err(_) => {
|
||||||
return Err(Html(render_error(e, &jar, &data, &Some(user)).await));
|
if let Err(e) = data
|
||||||
|
.0
|
||||||
|
.delete_request(req.id, req.linked_asset, &user, true)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
return Err(Html(render_error(e, &jar, &data, &Some(user)).await));
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,13 +441,13 @@ impl DataManager {
|
||||||
// delete request (if it exists and question isn't global)
|
// delete request (if it exists and question isn't global)
|
||||||
if !y.is_global
|
if !y.is_global
|
||||||
&& self
|
&& self
|
||||||
.get_request_by_id_linked_asset(y.owner, y.id)
|
.get_request_by_id_linked_asset(y.id, y.id)
|
||||||
.await
|
.await
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
// requests are also deleted when a post is created answering the given question
|
// requests are also deleted when a post is created answering the given question
|
||||||
// (unless the question is global)
|
// (unless the question is global)
|
||||||
self.delete_request(y.owner, y.id, user, false).await?;
|
self.delete_request(y.id, y.id, user, false).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete all posts answering question
|
// delete all posts answering question
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue