Merge branch 'fixing-character-deletion' into 'master'

Server: Fix character deletion mentioned in #1327

See merge request veloren/veloren!2818
This commit is contained in:
Ben Wallis 2021-09-06 13:40:01 +00:00
commit a19f1dfc14

View File

@ -544,6 +544,14 @@ pub fn delete_character(
stmt.execute(&[&char_id])?;
drop(stmt);
let pet_ids = get_pet_ids(char_id, transaction)?
.iter()
.map(|x| Value::from(*x))
.collect::<Vec<Value>>();
if !pet_ids.is_empty() {
delete_pets(transaction, char_id, Rc::new(pet_ids))?;
}
// Delete character
let mut stmt = transaction.prepare_cached(
"
@ -598,14 +606,6 @@ pub fn delete_character(
)));
}
let pet_ids = get_pet_ids(char_id, transaction)?
.iter()
.map(|x| Value::from(*x))
.collect::<Vec<Value>>();
if !pet_ids.is_empty() {
delete_pets(transaction, char_id, Rc::new(pet_ids))?;
}
load_character_list(requesting_player_uuid, transaction)
}