make sure to reset delete timer when enabling
This commit is contained in:
parent
e6ddf2f120
commit
cd13094bad
|
@ -130,7 +130,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
toggle(policy_enabled){
|
toggle(policy_enabled){
|
||||||
policy_enabled = !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);
|
this.fire('toggle', policy_enabled);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
8
model.py
8
model.py
|
@ -135,6 +135,14 @@ class Account(TimestampMixin, RemoteIDMixin):
|
||||||
return 0
|
return 0
|
||||||
return value
|
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: tokens
|
||||||
# backref: twitter_archives
|
# backref: twitter_archives
|
||||||
# backref: posts
|
# backref: posts
|
||||||
|
|
|
@ -211,11 +211,6 @@ def enable():
|
||||||
miss them.
|
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
|
g.viewer.account.policy_enabled = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue