1e96c92c9526655a8d23711f83d230611b4b46d0 — Thomas Letan 1 year, 3 months ago a0bbde7
refactor: Clean-up some warnings
2 files changed, 7 insertions(+), 20 deletions(-)

M src/main.rs
M src/routes/document.rs
M src/main.rs => src/main.rs +1 -3
@@ 28,7 28,6 @@ use std::path::{PathBuf, Path};
 
 use diesel::prelude::*;
 
-use rocket::State;
 use rocket::request::FlashMessage;
 use rocket::response::{NamedFile, Content};
 use rocket::http::{ContentType, MediaType};


@@ 40,13 39,12 @@ pub mod models;
 pub mod schema;
 pub mod routes;
 
-use db::{PgPool, PgConn, establish_connection};
+use db::{PgConn, establish_connection};
 
 use ::schema::users;
 use ::errors::{Error, ResultExt};
 use ::routes::shared;
 use ::models::user::User;
-use ::models::sheet::Sheet;
 use ::models::image::{ImageId, Image};
 
 #[get("/", rank=1)]

M src/routes/document.rs => src/routes/document.rs +6 -17
@@ 5,7 5,6 @@ use ::db::PgConn;
 use ::models::image::Image;
 use ::models::user::User;
 use ::models::character::Character;
-use ::models::sheet::Sheet;
 use ::models::document::{Lang, Document};
 use ::models::sheet::Content;
 use ::errors::Error;


@@ 16,9 15,6 @@ pub fn submit_document(
     conn: PgConn,
     user: User,
 ) -> Result<Template, Error> {
-
-    let sheets = Sheet::get_current_sheets_of(user.id, &conn)?;
-
     shared::render_auth_template(
         user,
         None,


@@ 42,7 38,7 @@ pub struct RenderRequest {
 
 #[post("/document", data="<submission>")]
 pub fn render_document<'a>(
-    mut user: User,
+    user: User,
     submission: Form<RenderRequest>,
     conn: PgConn,
 ) -> Result<Template, Error> {


@@ 72,18 68,11 @@ pub fn render_document<'a>(
         )
     })?;
 
-    let sheets = Sheet::get_current_sheets_of(user.id, &conn)?;
-
-    Ok(
-        Template::render(
+    shared::render_auth_template(
+        user,
+        None,
         "render_document",
-        json!({
-            "hash": env!("GIT_HASH"),
-            "user": json!({
-                "default": user.default_character,
-                "characters": sheets,
-                "nickname": user.nickname
-            }),
-        }))
+        json!({}),
+        &conn
     )
 }