hosna
(hosna)
July 3, 2020, 5:17am
1
I realized that many of my inactive users has not been cleaned yet. So I checked those users and the code.
Those users dont have any time for last_seen_at. So I think in the following line:
class CleanUpInactiveUsers < ::Jobs::Scheduled
every 1.day
def execute(args)
return if SiteSetting.clean_up_inactive_users_after_days <= 0
User
.where(
last_posted_at: nil,
trust_level: TrustLevel.levels[:newuser],
admin: false,
moderator: false,
)
.where("users.created_at < ?", SiteSetting.clean_up_inactive_users_after_days.days.ago)
.where(
"users.last_seen_at < ? OR users.last_seen_at IS NULL",
SiteSetting.clean_up_inactive_users_after_days.days.ago,
)
.where
.missing(:posts, :topics)
.limit(1000)
they are not detected and cleaned. Am I right? And what can I do?
How did those users get created?
hosna
(hosna)
July 3, 2020, 2:36pm
3
I think they are created via api and never actually see the forum.
sam
(Sam Saffron)
July 6, 2020, 8:09am
4
Yes this job is certainly not going to touch these outlier records, I guess maybe update them to have last_seen_at
hosna
(hosna)
July 7, 2020, 11:39am
5
Is there a console command to add a default last_seen_at value?