ensure indexing is only done when permissioned
This commit is contained in:
parent
84553899f6
commit
ed548a0de2
1 changed files with 11 additions and 5 deletions
|
@ -2939,7 +2939,7 @@ impl InlineAssistant {
|
||||||
assistant
|
assistant
|
||||||
}
|
}
|
||||||
|
|
||||||
fn semantic_permissioned(&mut self, cx: &mut ViewContext<Self>) -> Task<Result<bool>> {
|
fn semantic_permissioned(&self, cx: &mut ViewContext<Self>) -> Task<Result<bool>> {
|
||||||
if let Some(value) = self.semantic_permissioned {
|
if let Some(value) = self.semantic_permissioned {
|
||||||
return Task::ready(Ok(value));
|
return Task::ready(Ok(value));
|
||||||
}
|
}
|
||||||
|
@ -2949,7 +2949,7 @@ impl InlineAssistant {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.semantic_index
|
self.semantic_index
|
||||||
.as_mut()
|
.as_ref()
|
||||||
.map(|semantic| {
|
.map(|semantic| {
|
||||||
semantic.update(cx, |this, cx| this.project_previously_indexed(&project, cx))
|
semantic.update(cx, |this, cx| this.project_previously_indexed(&project, cx))
|
||||||
})
|
})
|
||||||
|
@ -3118,11 +3118,17 @@ impl InlineAssistant {
|
||||||
return Err(anyhow!("project was dropped!"));
|
return Err(anyhow!("project was dropped!"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let semantic_permissioned = self.semantic_permissioned(cx);
|
||||||
if let Some(semantic_index) = SemanticIndex::global(cx) {
|
if let Some(semantic_index) = SemanticIndex::global(cx) {
|
||||||
cx.spawn(|_, mut cx| async move {
|
cx.spawn(|_, mut cx| async move {
|
||||||
semantic_index
|
// This has to be updated to accomodate for semantic_permissions
|
||||||
.update(&mut cx, |index, cx| index.index_project(project, cx))
|
if semantic_permissioned.await.unwrap_or(false) {
|
||||||
.await
|
semantic_index
|
||||||
|
.update(&mut cx, |index, cx| index.index_project(project, cx))
|
||||||
|
.await
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("project is not permissioned for semantic indexing"))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.detach_and_log_err(cx);
|
.detach_and_log_err(cx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue