features, cleanup and bug fixes #26

Merged
ben merged 30 commits from ben/Jobboerse:main into main 2022-06-09 17:36:55 +02:00
Showing only changes of commit 82abb63c83 - Show all commits

fix unnecessary qualification warning

Bennet Bleßmann 2022-05-30 15:18:04 +02:00 committed by Bennet Bleßmann
Signed by: ben
GPG key ID: 3BE1A1A3CBC3CF99

View file

@ -50,7 +50,7 @@ pub(crate) async fn index(
hb: web::Data<Handlebars<'_>>, hb: web::Data<Handlebars<'_>>,
offers: web::Data<JobOffers>, offers: web::Data<JobOffers>,
) -> Result<HttpResponse, PresentationError> { ) -> Result<HttpResponse, PresentationError> {
let user = auth::User::current(&session).ok(); let user = User::current(&session).ok();
let job_offers = { let job_offers = {
let guard = offers.get_offers().await; let guard = offers.get_offers().await;
@ -67,7 +67,7 @@ pub(crate) async fn index(
let rendered = hb.render(template::JOBOFFEL_OVERVIEW, &data)?; let rendered = hb.render(template::JOBOFFEL_OVERVIEW, &data)?;
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
.insert_header((http::header::CONTENT_TYPE, HTML_CONTENT.clone())) .insert_header((CONTENT_TYPE, HTML_CONTENT.clone()))
.body(rendered)) .body(rendered))
} }
@ -132,7 +132,7 @@ pub(crate) async fn preview_attachment(
session: Session, session: Session,
hb: web::Data<Handlebars<'_>>, hb: web::Data<Handlebars<'_>>,
) -> Result<HttpResponse, PresentationError> { ) -> Result<HttpResponse, PresentationError> {
let user = auth::User::current(&session).ok(); let user = User::current(&session).ok();
let data = json!({ let data = json!({
"base": super::base(&req,&config, "Joboffers")?, "base": super::base(&req,&config, "Joboffers")?,
@ -142,7 +142,7 @@ pub(crate) async fn preview_attachment(
let body = hb.render(template::JOBOFFER_ATTACHMENT_PREVIEW, &data)?; let body = hb.render(template::JOBOFFER_ATTACHMENT_PREVIEW, &data)?;
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
.insert_header((http::header::CONTENT_TYPE, HTML_CONTENT.clone())) .insert_header((CONTENT_TYPE, HTML_CONTENT.clone()))
.body(body)) .body(body))
} }
@ -154,7 +154,7 @@ pub(crate) async fn summary(
session: Session, session: Session,
offers: web::Data<JobOffers>, offers: web::Data<JobOffers>,
) -> Result<HttpResponse, actix_web::Error> { ) -> Result<HttpResponse, actix_web::Error> {
let user = auth::User::current(&session).ok(); let user = User::current(&session).ok();
let previews = { let previews = {
let guard = offers.get_offers().await; let guard = offers.get_offers().await;
crate::job_offers::job_data(&req, guard, user.as_ref()) crate::job_offers::job_data(&req, guard, user.as_ref())
@ -176,7 +176,7 @@ pub(crate) async fn sync(
) -> Result<HttpResponse, SyncError> { ) -> Result<HttpResponse, SyncError> {
// TODO return the user to a page where they are asked to confirm syncing // TODO return the user to a page where they are asked to confirm syncing
// aka. the get variant of this route // aka. the get variant of this route
auth::User::current(&session)?; User::current(&session)?;
offers.sync(&config).await?; offers.sync(&config).await?;
let dest = req let dest = req
.url_for_static(JOBOFFER_OVERVIEW_ROUTE) .url_for_static(JOBOFFER_OVERVIEW_ROUTE)