mirror of
https://github.com/freedit-org/freedit.git
synced 2026-01-08 20:18:07 -05:00
commit early
This commit is contained in:
@@ -233,7 +233,6 @@ pub(crate) async fn upload_post(
|
|||||||
let claim = Claim::get(&DB, &cookie, &site_config).ok_or(AppError::NonLogin)?;
|
let claim = Claim::get(&DB, &cookie, &site_config).ok_or(AppError::NonLogin)?;
|
||||||
|
|
||||||
let mut imgs = Vec::with_capacity(10);
|
let mut imgs = Vec::with_capacity(10);
|
||||||
let mut batch = DB.inner().batch();
|
|
||||||
let user_uploads = DB
|
let user_uploads = DB
|
||||||
.inner()
|
.inner()
|
||||||
.open_partition("user_uploads", Default::default())?;
|
.open_partition("user_uploads", Default::default())?;
|
||||||
@@ -306,13 +305,11 @@ pub(crate) async fn upload_post(
|
|||||||
fs::write(location, &img_data).await.unwrap();
|
fs::write(location, &img_data).await.unwrap();
|
||||||
let img_id = incr_id(&DB, "imgs_count")?;
|
let img_id = incr_id(&DB, "imgs_count")?;
|
||||||
let k = [u32_to_ivec(claim.uid), u32_to_ivec(img_id)].concat();
|
let k = [u32_to_ivec(claim.uid), u32_to_ivec(img_id)].concat();
|
||||||
batch.insert(&user_uploads, k, fname.as_bytes());
|
user_uploads.insert(k, fname.as_bytes())?;
|
||||||
|
|
||||||
imgs.push(fname);
|
imgs.push(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.commit()?;
|
|
||||||
|
|
||||||
let has_unread = User::has_unread(&DB, claim.uid)?;
|
let has_unread = User::has_unread(&DB, claim.uid)?;
|
||||||
let uid = claim.uid;
|
let uid = claim.uid;
|
||||||
let page_data = PageData::new("upload images", &site_config, Some(claim), has_unread);
|
let page_data = PageData::new("upload images", &site_config, Some(claim), has_unread);
|
||||||
|
|||||||
Reference in New Issue
Block a user