cargo fixes
This commit is contained in:
+10
-15
@@ -1,22 +1,21 @@
|
||||
use url::Url;
|
||||
use crate::cli::Issue2Work;
|
||||
use crate::config::Config;
|
||||
use crate::error::GeneralError;
|
||||
use crate::gitea::issue::{issue_html_url_to_api, Issue};
|
||||
use crate::gitea::client::has_client_for_url;
|
||||
use crate::gitea::issue::{issue_html_url_to_api, Issue};
|
||||
use crate::openproject::user::{GetMe, User};
|
||||
use crate::openproject::work::{WorkPackage, WorkPackageWriter, WorkPackageWriterAssignee};
|
||||
use crate::openproject::work::WorkPackageWriter;
|
||||
use crate::planning::Issue2WorkActionTrait;
|
||||
use url::Url;
|
||||
|
||||
pub(crate) struct GiteaAction {}
|
||||
|
||||
impl Issue2WorkActionTrait for GiteaAction {
|
||||
async fn run(&self, url: &Url, config: &Config, args: &Issue2Work) -> Result<(), GeneralError> {
|
||||
let gitea_client = crate::gitea::client::Client::from_config(config.gitea.first().unwrap());
|
||||
let issue: Issue = gitea_client
|
||||
.get(issue_html_url_to_api(url)?)
|
||||
.await?;
|
||||
let open_project_client = crate::openproject::client::Client::from_config(&config.openproject);
|
||||
let issue: Issue = gitea_client.get(issue_html_url_to_api(url)?).await?;
|
||||
let open_project_client =
|
||||
crate::openproject::client::Client::from_config(&config.openproject);
|
||||
|
||||
let work_package = create_work_package_from_issue(
|
||||
&issue,
|
||||
@@ -26,7 +25,7 @@ impl Issue2WorkActionTrait for GiteaAction {
|
||||
Some(u)
|
||||
}
|
||||
false => None,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
let work_package = open_project_client
|
||||
@@ -48,16 +47,12 @@ impl Issue2WorkActionTrait for GiteaAction {
|
||||
|
||||
fn create_work_package_from_issue(issue: &Issue, assignee: Option<User>) -> WorkPackageWriter {
|
||||
WorkPackageWriter {
|
||||
subject: format!(
|
||||
"{} ({})",
|
||||
issue.title,
|
||||
issue.repository.full_name
|
||||
),
|
||||
subject: format!("{} ({})", issue.title, issue.repository.full_name),
|
||||
work_type: "TASK".into(),
|
||||
description: crate::openproject::work::DescriptionWriter {
|
||||
format: "markdown".into(),
|
||||
raw: format!("From Gitea issue: {} \n\n{}", issue.html_url, issue.body),
|
||||
},
|
||||
assignee: assignee.into()
|
||||
assignee: assignee.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user