Delete from DB already deleted users from Mastodon
This commit is contained in:
parent
294f8d5709
commit
10414f9dd4
1 changed files with 5 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timezone, timedelta
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
|
@ -226,9 +226,11 @@ while i < len(inactive_users_id):
|
|||
email_datetime = email_datetime.replace(tzinfo=None)
|
||||
|
||||
if seen != None:
|
||||
reactivated = email_datetime < seen
|
||||
|
||||
if reactivated == True or seen == None: #if inactive user reactivated its account or deleted it we must delete related row from 'mailing_db_table'
|
||||
reactivated = email_datetime < seen
|
||||
last_year = datetime.today() - timedelta(days=365)
|
||||
|
||||
if reactivated == True or seen == None or seen > last_year: #if inactive user had reactivated its account or had deleted it we must delete related row from 'mailing_db_table'
|
||||
|
||||
cur.execute("DELETE FROM " + mailing_db_table + " where account_id=(%s)", (inactive_users_id[i],))
|
||||
print("Deleting user " + str(inactive_users_id[i]))
|
||||
|
|
Loading…
Reference in a new issue