Merge branch 'shandley/char-deletion-fix' into 'master'

Ensure that the player uuid and character id both match in a character deletion query

See merge request veloren/veloren!1027
This commit is contained in:
Imbris 2020-05-31 22:09:51 +00:00
commit df5f09de14

View File

@ -144,7 +144,12 @@ pub fn create_character(
pub fn delete_character(uuid: &str, character_id: i32, db_dir: &str) -> CharacterListResult {
use schema::character::dsl::*;
diesel::delete(character.filter(id.eq(character_id))).execute(&establish_connection(db_dir))?;
diesel::delete(
character
.filter(id.eq(character_id))
.filter(player_uuid.eq(uuid)),
)
.execute(&establish_connection(db_dir))?;
load_character_list(uuid, db_dir)
}