From 3bfe24979d98f8955b1cb9f0ee5359aacab4e98a Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 25 Dec 2019 22:23:08 +0000 Subject: [PATCH] Relocate delete_account menu function Move the action logic for the delete_account state from its corresponding facet to the menu module, hiding it behind a consistently-named entry point. --- mudpy/menu.py | 5 +++++ share/menu.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mudpy/menu.py b/mudpy/menu.py index 75dc542..39a5ad2 100644 --- a/mudpy/menu.py +++ b/mudpy/menu.py @@ -76,3 +76,8 @@ def choose_name_create_6(user): def choose_name_create_7(user): """Provide a randomly-generated name as choice 7.""" return mudpy.misc.random_name() + + +def delete_account_action_y(user): + """Permanently delete the account and all avatars, as requested.""" + return user.destroy() diff --git a/share/menu.yaml b/share/menu.yaml index 87176eb..b66074e 100644 --- a/share/menu.yaml +++ b/share/menu.yaml @@ -67,7 +67,7 @@ menu.choose_name.description: Your new avatar needs a name. This will be the unremarkable name forever. menu.choose_name.prompt: "Choose a name for $(tpop):" -menu.delete_account.action_y: user.destroy() +menu.delete_account.action_y: mudpy.menu.delete_account_action_y(user) menu.delete_account.branch_n: main_utility menu.delete_account.branch_y: disconnecting menu.delete_account.choice_n: no, don't delete my account -- 2.11.0