diff options
author | bnewbold <bnewbold@archive.org> | 2022-10-06 01:56:45 +0000 |
---|---|---|
committer | bnewbold <bnewbold@archive.org> | 2022-10-06 01:56:45 +0000 |
commit | b38f113b6afca9190c950748183e0ea7c1f4954b (patch) | |
tree | 9b228849ae428a93dbb47fcc99656afdcac5e020 /rust/src | |
parent | e5ee112a13cc331a488d395c4da1f80a9dd61930 (diff) | |
parent | 97f6417a58c0ec3c897f9634d21e705b4e37d7b6 (diff) | |
download | fatcat-b38f113b6afca9190c950748183e0ea7c1f4954b.tar.gz fatcat-b38f113b6afca9190c950748183e0ea7c1f4954b.zip |
Merge branch 'bnewbold-fix-editing-4xx' into 'master'
small fixes to editing process (python and rust)
See merge request webgroup/fatcat!139
Diffstat (limited to 'rust/src')
-rw-r--r-- | rust/src/entity_crud.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs index 51c89108..6dc9ff18 100644 --- a/rust/src/entity_crud.rs +++ b/rust/src/entity_crud.rs @@ -410,10 +410,11 @@ macro_rules! generic_db_update { fn db_update(&self, conn: &DbConn, edit_context: &EditContext, ident: FatcatId) -> Result<Self::EditRow> { let current: Self::IdentRow = $ident_table::table.find(ident.to_uuid()).first(conn)?; let no_redirect: Option<Uuid> = None; - // Don't set prev_rev if current status is redirect - let prev_rev = match current.redirect_id { - Some(_) => None, - None => current.rev_id, + + // Don't set prev_rev if current state is 'redirect' or 'wip' + let prev_rev = match (current.redirect_id, current.is_live) { + (Some(_), _) | (_, false) => None, + (None, true) => current.rev_id, }; if self.state.is_none() { |