Skip to content

Commit c5967cd

Browse files
authored
Merge pull request #9942 from gitbutlerapp/refactor/get-author-info-params
refactor(api): accept params struct in get_author_info
2 parents 580a5ac + 520ad3e commit c5967cd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

crates/but-api/src/commands/config.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,14 @@ impl From<but_rebase::commit::AuthorInfo> for AuthorInfo {
7474
}
7575
}
7676

77-
pub fn get_author_info(_app: &App, project_id: ProjectId) -> Result<AuthorInfo, Error> {
78-
let repo = but_core::open_repo(gitbutler_project::get(project_id)?.path)?;
77+
#[derive(Deserialize)]
78+
#[serde(rename_all = "camelCase")]
79+
pub struct GetAuthorInfoParams {
80+
pub project_id: ProjectId,
81+
}
82+
83+
pub fn get_author_info(_app: &App, params: GetAuthorInfoParams) -> Result<AuthorInfo, Error> {
84+
let repo = but_core::open_repo(gitbutler_project::get(params.project_id)?.path)?;
7985
let author = but_rebase::commit::get_author_info(&repo)?;
8086
Ok(author.into())
8187
}

crates/gitbutler-tauri/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use but_api::commands::config::StoreAuthorGloballyParams;
1+
use but_api::commands::config::{GetAuthorInfoParams, StoreAuthorGloballyParams};
22
use but_api::error::Error;
33
use but_api::{commands::config, App};
44
use but_core::settings::git::ui::GitConfigSettings;
@@ -46,5 +46,5 @@ pub fn get_author_info(
4646
app: State<App>,
4747
project_id: ProjectId,
4848
) -> Result<config::AuthorInfo, Error> {
49-
config::get_author_info(&app, project_id)
49+
config::get_author_info(&app, GetAuthorInfoParams { project_id })
5050
}

0 commit comments

Comments
 (0)