diff --git a/components/Banner.html b/components/Banner.html
index 7154e15..9b4866b 100644
--- a/components/Banner.html
+++ b/components/Banner.html
@@ -130,7 +130,11 @@ export default {
methods: {
toggle(policy_enabled){
policy_enabled = !policy_enabled;
- this.set({policy_enabled});
+ let obj = {policy_enabled}
+ if(policy_enabled){
+ obj.next_delete = null;
+ }
+ this.set(obj);
this.fire('toggle', policy_enabled);
}
},
diff --git a/model.py b/model.py
index bc1e0d2..de10b5c 100644
--- a/model.py
+++ b/model.py
@@ -135,6 +135,14 @@ class Account(TimestampMixin, RemoteIDMixin):
return 0
return value
+ @db.validates('policy_enabled')
+ def reset_next_delete(self, key, enable):
+ if not self.policy_enabled and enable:
+ self.next_delete = (
+ datetime.now(timezone.utc) + self.policy_delete_every)
+ return enable
+
+
# backref: tokens
# backref: twitter_archives
# backref: posts
diff --git a/routes.py b/routes.py
index b5867aa..cb480bd 100644
--- a/routes.py
+++ b/routes.py
@@ -211,11 +211,6 @@ def enable():
miss them.
""")
- if not g.viewer.account.policy_enabled:
- g.viewer.account.next_delete = (
- datetime.now(timezone.utc)
- + g.viewer.account.policy_delete_every)
-
g.viewer.account.policy_enabled = True
db.session.commit()