decidim-cleaner 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fd7ca69fb2308fa690ba9d4a562f5848c402c7ee78ace1470c5a7e72153640f
4
- data.tar.gz: c8faf28fa9b534707f2f1e2941714f42bb37f96569b6b3c938e8149d82ed3e5a
3
+ metadata.gz: c1e9caaddab424c8f9e7f90ae9b768821eb59a2c4084920087b753d23113bb78
4
+ data.tar.gz: 357866aea4f46dbc6cce35b2a2824f2ace75f9488704ae982e1a9855132c1a87
5
5
  SHA512:
6
- metadata.gz: f44afb8c026e6ab4a10ab3441011fdbfc26e44a657ee4674c354be1c3cc2a4ede4793206fb9aa92985573b5bf602c4b7050c8668ca00a8d7b64703caabd56e8a
7
- data.tar.gz: 101f0cc2503b9a7d0b1420cd9981e13101cb47513e204e3d922ac2de9a48f0bc18beb98073e319fd2cf8c76903ccbf8494df5c29883348e1af8fa7e628f0a463
6
+ metadata.gz: b19b452a1070f8d826a5dd71989cad8eee27cfac1c90c58bced93c916e10553d5a5694c24728291d00f0c1017e049db0227cfc2168ac7e6f56b319c41342f0ee
7
+ data.tar.gz: 717d7ad9eed4605e7700bdf7e4175042c01812296f2bc1ff2ad3ab95cdc204e85cec95ac0a23eceb8db60bc86c93847aa71e90f3499db2771d696a26e3da48e1
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic for updating the current
7
7
  # organization cleaner.
8
- class UpdateOrganizationCleaner < Rectify::Command
8
+ class UpdateOrganizationCleaner < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # organization - The Organization that will be updated.
@@ -9,7 +9,7 @@ module Decidim
9
9
  Decidim::Organization.find_each do |organization|
10
10
  next unless organization.delete_admin_logs?
11
11
 
12
- Decidim::ActionLog.where(organization: organization).where("created_at < ?", Time.zone.now - (organization.delete_admin_logs_after || 365).days).delete_all
12
+ Decidim::ActionLog.where(organization:).where("created_at < ?", Time.zone.now - (organization.delete_admin_logs_after || 365).days).delete_all
13
13
  end
14
14
  end
15
15
  end
@@ -9,12 +9,10 @@ module Decidim
9
9
  Decidim::Organization.find_each do |organization|
10
10
  next unless organization.delete_inactive_users?
11
11
 
12
- send_warning(Decidim::User.where(organization: organization)
12
+ send_warning(Decidim::User.where(organization:)
13
13
  .where("last_sign_in_at < ?", Time.zone.now - (organization.delete_inactive_users_email_after || 365).days)
14
14
  .where("last_sign_in_at > ?", Time.zone.now - (organization.delete_inactive_users_email_after || 365).days - 1.day))
15
- delete_user_and_send_email(Decidim::User
16
- .where(organization: organization)
17
- .where("last_sign_in_at < ?", Time.zone.now - (organization.delete_inactive_users_after || 390).days))
15
+ delete_user_and_send_email(Decidim::User.where(organization:).where("last_sign_in_at < ?", Time.zone.now - (organization.delete_inactive_users_after || 390).days))
18
16
  end
19
17
  end
20
18
 
@@ -13,7 +13,7 @@ module Decidim
13
13
  "decidim.cleaner.inactive_users_mailer.warning_inactive.subject",
14
14
  organization_name: @organization.name
15
15
  )
16
- mail(to: user.email, subject: subject)
16
+ mail(to: user.email, subject:)
17
17
  end
18
18
  end
19
19
 
@@ -25,7 +25,7 @@ module Decidim
25
25
  "decidim.cleaner.inactive_users_mailer.warning_deletion.subject",
26
26
  organization_name: @organization.name
27
27
  )
28
- mail(to: user.email, subject: subject)
28
+ mail(to: user.email, subject:)
29
29
  end
30
30
  end
31
31
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddDeleteAdminLogsToOrganization < ActiveRecord::Migration[6.0]
3
+ class AddDeleteAdminLogsToOrganization < ActiveRecord::Migration[6.1]
4
4
  def change
5
5
  add_column :decidim_organizations, :delete_admin_logs, :boolean, default: false, null: false
6
6
  add_column :decidim_organizations, :delete_admin_logs_after, :integer
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddDeleteInactiveUsersToOrganization < ActiveRecord::Migration[6.0]
3
+ class AddDeleteInactiveUsersToOrganization < ActiveRecord::Migration[6.1]
4
4
  def change
5
5
  add_column :decidim_organizations, :delete_inactive_users, :boolean, default: false, null: false
6
6
  add_column :decidim_organizations, :delete_inactive_users_email_after, :integer
@@ -5,7 +5,7 @@ require "decidim/core/test/factories"
5
5
  FactoryBot.define do
6
6
  factory :cleaner_component, parent: :component do
7
7
  name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :cleaner).i18n_name }
8
- manifest_name { :cleaner }
8
+ manifest_name :cleaner
9
9
  participatory_space { create(:participatory_process, :with_steps) }
10
10
  end
11
11
  end
@@ -4,11 +4,11 @@ module Decidim
4
4
  # This holds the decidim-meetings version.
5
5
  module Cleaner
6
6
  def self.version
7
- "0.0.1"
7
+ "0.1.0"
8
8
  end
9
9
 
10
10
  def self.decidim_version
11
- "0.26"
11
+ "0.28.0.dev"
12
12
  end
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Quentinchampenois
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-02-13 00:00:00.000000000 Z
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.26'
19
+ version: 0.28.0.dev
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.26'
26
+ version: 0.28.0.dev
27
27
  description: Clean outdated data in Decidim's database.
28
28
  email:
29
29
  - 26109239+Quentinchampenois@users.noreply.github.com
@@ -76,7 +76,7 @@ metadata:
76
76
  funding_uri: https://opencollective.com/decidim
77
77
  homepage_uri: https://decidim.org
78
78
  source_code_uri: https://github.com/decidim/decidim
79
- post_install_message:
79
+ post_install_message:
80
80
  rdoc_options: []
81
81
  require_paths:
82
82
  - lib
@@ -84,15 +84,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - ">="
86
86
  - !ruby/object:Gem::Version
87
- version: 2.7.5
87
+ version: '3.1'
88
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.3.7
95
- signing_key:
94
+ rubygems_version: 3.3.5
95
+ signing_key:
96
96
  specification_version: 4
97
97
  summary: A decidim cleaner module
98
98
  test_files: []