Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: CleanInactiveUsersJob fails on Active Record validation fail #40

Merged
merged 7 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop_rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@ Rails/SkipsModelValidations:
Rails/Validation:
Include:
- decidim-*/app/models/**/*.rb

FactoryBot/FactoryAssociationWithStrategy:
Enabled: false
2 changes: 2 additions & 0 deletions .rubocop_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ Style/GuardClause:
MinBodyLength: 6

Style/HashSyntax:
Exclude:
- app/jobs/decidim/cleaner/clean_inactive_users_job.rb
EnforcedStyle: ruby19
SupportedStyles:
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ gem "puma", ">= 4.3"

group :development, :test do
gem "byebug", "~> 11.0", platform: :mri

gem "decidim-dev", git: "https://github.com/decidim/decidim"
gem "rubocop-rails", "~> 2.19.0"
end

group :development do
Expand Down
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ GEM
nio4r (2.5.9)
nokogiri (1.14.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.5-x86_64-linux)
racc (~> 1.4)
oauth (1.1.0)
oauth-tty (~> 1.0, >= 1.0.1)
snaky_hash (~> 2.0)
Expand Down Expand Up @@ -652,7 +654,7 @@ GEM
rubocop-faker (1.1.0)
faker (>= 2.12.0)
rubocop (>= 0.82.0)
rubocop-rails (2.22.1)
rubocop-rails (2.19.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down Expand Up @@ -762,6 +764,7 @@ GEM

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
bootsnap (~> 1.4)
Expand All @@ -773,6 +776,7 @@ DEPENDENCIES
letter_opener_web (~> 2.0)
listen (~> 3.1)
puma (>= 4.3)
rubocop-rails (~> 2.19.0)
spring (~> 2.0)
spring-watcher-listen (~> 2.0)
web-console (~> 4.2)
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/decidim/cleaner/clean_inactive_users_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def perform
Decidim::Organization.find_each do |organization|
next unless organization.delete_inactive_users?

send_warning(Decidim::User.unscoped.where(organization:)
send_warning(Decidim::User.unscoped.where(organization: organization)
.not_deleted
.where.not(email: "")
.where("current_sign_in_at < ?", email_inactive_before_date(organization)))
delete_user_and_send_email(Decidim::User.unscoped.where(organization:)
delete_user_and_send_email(Decidim::User.unscoped.where(organization: organization)
.not_deleted
.where.not(email: "")
.where("warning_date < ?", delete_inactive_before_date(organization)))
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module Decidim::Cleaner::Admin
expect { command.call }.to broadcast(:ok)
end

it "traces the update", versioning: true do
it "traces the update", :versioning do
expect(Decidim.traceability)
.to receive(:update!)
.with(organization, user, a_kind_of(Hash))
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/decidim/destroy_account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ module Decidim
end
end
end
end
end
4 changes: 0 additions & 4 deletions yarn.lock

This file was deleted.

Loading