Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webserver): /resolve/all should read from RepositoryService #1796

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/repositories/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@
}

async fn resolve(State(rs): State<Arc<ResolveState>>) -> Result<Response, StatusCode> {
rs.resolve_all().map_err(|_| StatusCode::NOT_FOUND)
rs.resolve_all().await.map_err(|_| StatusCode::NOT_FOUND)

Check warning on line 90 in ee/tabby-webserver/src/repositories/mod.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/repositories/mod.rs#L90

Added line #L90 was not covered by tests
}
16 changes: 9 additions & 7 deletions ee/tabby-webserver/src/repositories/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,17 @@
None
}

pub fn resolve_all(&self) -> Result<Response> {
let entries: Vec<_> = self
.repository_lookup
.read()
.unwrap()
.keys()
pub async fn resolve_all(&self) -> Result<Response> {
let repositories = self
.service
.list_repositories(None, None, None, None)
.await?;

Check warning on line 271 in ee/tabby-webserver/src/repositories/resolve.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/repositories/resolve.rs#L267-L271

Added lines #L267 - L271 were not covered by tests

let entries = repositories
.into_iter()

Check warning on line 274 in ee/tabby-webserver/src/repositories/resolve.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/repositories/resolve.rs#L273-L274

Added lines #L273 - L274 were not covered by tests
.map(|repo| DirEntry {
kind: DirEntryKind::Dir,
basename: repo.repo_name.clone(),
basename: repo.name.clone(),

Check warning on line 277 in ee/tabby-webserver/src/repositories/resolve.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/repositories/resolve.rs#L277

Added line #L277 was not covered by tests
})
.collect();

Expand Down
Loading