Commit d953cef3 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'changeblocktodeactivate' into 'master'

Change block users for inactivity to deactivate users instead: documentation

See merge request gitlab-org/gitlab!46006
parents 2f431619 55617479
......@@ -492,10 +492,22 @@ users.each do |user|
end
```
### Deactivate Users that have no recent activity
```ruby
days_inactive = 90
inactive_users = User.active.where("last_activity_on <= ?", days_inactive.days.ago)
inactive_users.each do |user|
puts "user '#{user.username}': #{user.last_activity_on}"
user.deactivate!
end
```
### Block Users that have no recent activity
```ruby
days_inactive = 60
days_inactive = 90
inactive_users = User.active.where("last_activity_on <= ?", days_inactive.days.ago)
inactive_users.each do |user|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment