Skip to content
Snippets Groups Projects

Add feature to delete inactive projects

Merged Huzaifa Iftikhar requested to merge 357376_add_inactive_projects_deletion_feature into master
5 files
+ 46
12
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -16,6 +16,8 @@ def perform
admin_user = User.admins.humans.active.first
return unless admin_user
notified_inactive_projects = deletion_warning_notified_projects
Project.inactive.without_deleted.find_each(batch_size: 100).with_index do |project, index| # rubocop: disable CodeReuse/ActiveRecord
@@ -27,7 +29,7 @@ def perform
deletion_warning_email_sent_on = notified_inactive_projects["project:#{project.id}"]
if send_deletion_warning_email?(deletion_warning_email_sent_on, project)
::Projects::InactiveProjectsDeletionNotificationWorker.perform_in(delay, project.id, deletion_date)
send_notification(delay, project, admin_user)
elsif deletion_warning_email_sent_on && delete_due_to_inactivity?(deletion_warning_email_sent_on)
delete_redis_entry(project)
delete_project(project, admin_user)
@@ -76,6 +78,10 @@ def delete_redis_entry(project)
redis.hdel('inactive_projects_deletion_warning_email_notified', "project:#{project.id}")
end
end
def send_notification(delay, project, user)
::Projects::InactiveProjectsDeletionNotificationWorker.perform_in(delay, project.id, deletion_date)
end
end
end
Loading