diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-06-14 10:48:37 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-06-14 10:48:37 -0700 |
commit | 0158e2edc964f8151f91c17454fa160426343475 (patch) | |
tree | 65447232bd0c38ebeb5b5d480e351371717abfdb | |
parent | e630bdbda05507ceac205bdd1dad84d0dd881d75 (diff) | |
download | fatcat-0158e2edc964f8151f91c17454fa160426343475.tar.gz fatcat-0158e2edc964f8151f91c17454fa160426343475.zip |
allow editing of WIP entities
-rw-r--r-- | python/fatcat_web/templates/entity_base.html | 2 | ||||
-rw-r--r-- | rust/src/entity_crud.rs | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html index 6f250e7e..932696b3 100644 --- a/python/fatcat_web/templates/entity_base.html +++ b/python/fatcat_web/templates/entity_base.html @@ -68,7 +68,7 @@ </div> {% if entity.ident %} <div class="ui small tabular compact menu floated right"> - {% if not editgroup or not (editgroup.changelog_index or editgroup.submitted ) %} + {% if (not editgroup and entity.state != 'wip') or not (editgroup.changelog_index or editgroup.submitted ) %} {{ entity_tab("edit", "Edit", "/edit") }} {% endif %} {% if not editgroup %} diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs index 240a7d92..3a1597ec 100644 --- a/rust/src/entity_crud.rs +++ b/rust/src/entity_crud.rs @@ -408,11 +408,6 @@ 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; - // TODO: is this actually true? or should we allow updates in the same editgroup? - if current.is_live != true { - return Err(FatcatError::InvalidEntityStateTransform( - "can't update an entity that doesn't exist yet".to_string()).into()); - } // Don't set prev_rev if current status is redirect let prev_rev = match current.redirect_id { Some(_) => None, @@ -503,7 +498,7 @@ macro_rules! generic_db_delete { let current: Self::IdentRow = $ident_table::table.find(ident.to_uuid()).first(conn)?; if current.is_live != true { return Err(FatcatError::InvalidEntityStateTransform( - "can't update an entity that doesn't exist yet; delete edit object instead" + "can't delete an entity that doesn't exist yet; delete edit object instead" .to_string(), ) .into()); |