From 6fbce9522129132554b6db15efdc47c5d9ae34ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Bol=C3=ADvar?= Date: Mon, 10 Apr 2023 12:37:29 +0200 Subject: [PATCH 1/4] Fix sync group with space without private users functionality (#29) --- .../decidim/civicrm/join_contact_to_participatory_spaces_job.rb | 1 + .../decidim/civicrm/participatory_space_group_membership_job.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/jobs/decidim/civicrm/join_contact_to_participatory_spaces_job.rb b/app/jobs/decidim/civicrm/join_contact_to_participatory_spaces_job.rb index 49bd693..75053f1 100644 --- a/app/jobs/decidim/civicrm/join_contact_to_participatory_spaces_job.rb +++ b/app/jobs/decidim/civicrm/join_contact_to_participatory_spaces_job.rb @@ -16,6 +16,7 @@ def perform(contact_id) @contact.groups.each do |group| group.group_participatory_spaces.each do |item| next unless (space = item.participatory_space) + next unless space.respond_to?(:participatory_space_private_users) # TODO: use CreateParticipatorySpacePrivateUser to notify users if enabled by config var Decidim::ParticipatorySpacePrivateUser.find_or_create_by(decidim_user_id: @contact.decidim_user_id, privatable_to: space) diff --git a/app/jobs/decidim/civicrm/participatory_space_group_membership_job.rb b/app/jobs/decidim/civicrm/participatory_space_group_membership_job.rb index 8aa70d1..4c1d291 100644 --- a/app/jobs/decidim/civicrm/participatory_space_group_membership_job.rb +++ b/app/jobs/decidim/civicrm/participatory_space_group_membership_job.rb @@ -23,6 +23,7 @@ def clean_private_memberships valid_memberships = @group.group_memberships.filter_map { |u| u&.contact&.decidim_user_id } @group.group_participatory_spaces.each do |item| next unless (space = item.participatory_space) + next unless space.respond_to?(:participatory_space_private_users) # remove non existing members space.participatory_space_private_users.each do |prv_user| From d890b38b41f5f4e79df02401775ece4cfb5bdd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Bol=C3=ADvar?= Date: Tue, 16 May 2023 12:58:27 +0200 Subject: [PATCH 2/4] Fix AuthorizeUser call by passing missing argument (#30) * Fix AuthorizeUser call by passing missing argument * Update minimum required version to 0.26 --- app/jobs/decidim/civicrm/auto_verification_job.rb | 2 +- lib/decidim/civicrm/version.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/jobs/decidim/civicrm/auto_verification_job.rb b/app/jobs/decidim/civicrm/auto_verification_job.rb index 5961cf2..6bfed1f 100644 --- a/app/jobs/decidim/civicrm/auto_verification_job.rb +++ b/app/jobs/decidim/civicrm/auto_verification_job.rb @@ -29,7 +29,7 @@ def perform_auth(name) handler = Decidim::AuthorizationHandler.handler_for(name, user: @contact.user) return unless handler - Decidim::Verifications::AuthorizeUser.call(handler) do + Decidim::Verifications::AuthorizeUser.call(handler, @contact.organization) do on(:ok) do Rails.logger.info "AutoVerificationJob: Success: created for user #{handler.user.id}" notify_user(handler.user, :ok, handler) diff --git a/lib/decidim/civicrm/version.rb b/lib/decidim/civicrm/version.rb index 4129293..964f63a 100644 --- a/lib/decidim/civicrm/version.rb +++ b/lib/decidim/civicrm/version.rb @@ -4,7 +4,7 @@ module Decidim # This holds the decidim-civicrm version. module Civicrm DECIDIM_VERSION = "0.26.1" - COMPAT_DECIDIM_VERSION = ">= 0.25.0, < 0.27" - VERSION = "0.4" + COMPAT_DECIDIM_VERSION = ">= 0.26.1, < 0.27" + VERSION = "0.5" end end From 81b091723bf7c2afebb1beb9f9239cbd18324ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Bol=C3=ADvar?= Date: Fri, 28 Jul 2023 08:41:20 +0200 Subject: [PATCH 3/4] Upgrade to Decidim 0.27 (#31) * Upgrade to decidim 0.27 * Lint files * Fix params for Base::Request.get method * Fix redirected admin path * Fix overrides spec * Fix test taking into account there is a mail of new badge earned for attending to the first meeting --- .github/workflows/lint.yml | 4 +- .github/workflows/test.yml | 4 +- .gitignore | 1 + .rubocop.yml | 4 +- .rubocop_rails.yml | 87 - .rubocop_ruby.yml | 1754 ----------------- Gemfile.lock | 599 +++--- Rakefile | 16 + .../civicrm/admin/create_event_meeting.rb | 2 +- .../civicrm/admin/update_event_meeting.rb | 2 +- app/commands/decidim/civicrm/sync_contact.rb | 2 +- app/models/decidim/civicrm/group.rb | 4 +- babel.config.json | 25 + ...8095920_create_decidim_civicrm_contacts.rb | 4 +- ...908095921_create_decidim_civicrm_groups.rb | 5 +- ...reate_decidim_civicrm_group_memberships.rb | 5 +- ...create_decidim_civicrm_membership_types.rb | 2 + ...idim_civicrm_group_participatory_spaces.rb | 6 +- ...2_create_decidim_civicrm_event_meetings.rb | 2 + ...ate_decidim_civicrm_event_registrations.rb | 2 + ...132120_add_membership_types_to_contacts.rb | 2 + db/seeds.rb | 2 +- decidim-civicrm.gemspec | 2 +- lib/decidim/civicrm/api/find_contact.rb | 8 +- lib/decidim/civicrm/api/find_event.rb | 8 +- lib/decidim/civicrm/api/find_group.rb | 8 +- lib/decidim/civicrm/api/find_participant.rb | 8 +- lib/decidim/civicrm/api/find_user.rb | 8 +- .../civicrm/api/list_contact_groups.rb | 8 +- .../civicrm/api/list_contact_memberships.rb | 8 +- .../civicrm/api/list_contacts_in_group.rb | 8 +- lib/decidim/civicrm/api/list_groups.rb | 8 +- .../civicrm/api/list_membership_types.rb | 6 +- .../civicrm/api/participants_in_event.rb | 8 +- .../event_registration_parser.rb | 4 +- .../verifications/groups_action_authorizer.rb | 2 +- .../membership_types_action_authorizer.rb | 2 +- lib/decidim/civicrm/version.rb | 6 +- .../templates/development_civicrm_config.rb | 12 +- package-lock.json | 10 +- package.json | 3 +- spec/commands/join_meeting_spec.rb | 10 +- .../admin/meetings_controller_spec.rb | 8 +- spec/lib/civicrm_spec.rb | 6 +- .../event_parsers/event_base_parser_spec.rb | 2 +- .../event_meeting_parser_spec.rb | 2 +- .../event_registration_parser_spec.rb | 4 +- spec/lib/overrides_spec.rb | 6 +- 48 files changed, 492 insertions(+), 2207 deletions(-) delete mode 100644 .rubocop_rails.yml delete mode 100644 .rubocop_ruby.yml create mode 100644 babel.config.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5af9b4b..48d12f9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,11 +7,11 @@ on: pull_request: env: - RUBY_VERSION: 2.7.5 + RUBY_VERSION: 3.0.2 jobs: lint-report: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8c2a9f..94362bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,11 +7,11 @@ on: pull_request: env: - RUBY_VERSION: 2.7.5 + RUBY_VERSION: 3.0.2 jobs: test-report: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 services: postgres: diff --git a/.gitignore b/.gitignore index b5d35b2..469ea52 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ node_modules/ npm_debug.log .ruby-version +.rubocop-* diff --git a/.rubocop.yml b/.rubocop.yml index 870c0b9..b2dc6b1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1 @@ -inherit_from: - - .rubocop_ruby.yml - - .rubocop_rails.yml +inherit_from: https://raw.githubusercontent.com/decidim/decidim/release/0.27-stable/.rubocop.yml diff --git a/.rubocop_rails.yml b/.rubocop_rails.yml deleted file mode 100644 index 0cf3b44..0000000 --- a/.rubocop_rails.yml +++ /dev/null @@ -1,87 +0,0 @@ -require: rubocop-rails - -Rails: - Enabled: true - -Rails/ActionFilter: - Include: - - app/controllers/**/*.rb - -Rails/ContentTag: - Enabled: false - -Rails/CreateTableWithTimestamps: - Enabled: false - -Rails/EnumUniqueness: - Include: - - app/models/**/*.rb - -Rails/Exit: - Include: - - app/**/*.rb - - config/**/*.rb - - lib/**/*.rb - Exclude: - - lib/**/*.rake - -Rails/FindBy: - Include: - - "**/*.rb" - -Rails/FindEach: - Include: - - app/models/**/*.rb - -Rails/HasAndBelongsToMany: - Include: - - app/models/**/*.rb - -Rails/HasManyOrHasOneDependent: - Include: - - app/models/**/*.rb - -Rails/InverseOf: - Enabled: false - -Rails/LexicallyScopedActionFilter: - Include: - - app/controllers/**/*.rb - -Rails/NotNullColumn: - Enabled: false - -Rails/Output: - Include: - - app/**/*.rb - - config/**/*.rb - - db/**/*.rb - - lib/**/*.rb - Exclude: - - db/seeds.rb -Rails/OutputSafety: - Enabled: false - -Rails/Pluck: - Enabled: false - -Rails/RakeEnvironment: - Enabled: false - -Rails/ReadWriteAttribute: - Include: - - app/models/**/*.rb - -Rails/ReversibleMigration: - Enabled: false - -Rails/ScopeArgs: - Include: - - app/models/**/*.rb - -Rails/SkipsModelValidations: - Enabled: true - -Rails/Validation: - Include: - - app/models/**/*.rb diff --git a/.rubocop_ruby.yml b/.rubocop_ruby.yml deleted file mode 100644 index 5933038..0000000 --- a/.rubocop_ruby.yml +++ /dev/null @@ -1,1754 +0,0 @@ -require: - - rubocop-rspec - - rubocop-faker - -# Common configuration. -AllCops: - Include: - - .simplecov - - "**/*.rb" - - "**/*.rake" - - "**/*.gemspec" - - "**/*.ru" - - "**/Gemfile" - - "**/Rakefile" - Exclude: - - "**/vendor/**/*" - - "development_app/**/*" - - "spec/decidim_dummy_app/**/*" - - "node_modules/**/*" - - "db/migrate/*" - - "db/schema.rb" - # Default formatter will be used if no -f/--format option is given. - DefaultFormatter: progress - # Cop names are not displayed in offense messages by default. Change behavior - # by overriding DisplayCopNames, or by giving the -D/--display-cop-names - # option. - DisplayCopNames: true - # Style guide URLs are not displayed in offense messages by default. Change - # behavior by overriding DisplayStyleGuide, or by giving the - # -S/--display-style-guide option. - DisplayStyleGuide: false - # Extra details are not displayed in offense messages by default. Change - # behavior by overriding ExtraDetails, or by giving the - # -E/--extra-details option. - ExtraDetails: false - NewCops: enable - # Additional cops that do not reference a style guide rule may be enabled by - # default. Change behavior by overriding StyleGuideCopsOnly, or by giving - # the --only-guide-cops option. - StyleGuideCopsOnly: false - # All cops except the ones in disabled.yml are enabled by default. Change - # this behavior by overriding DisabledByDefault. When DisabledByDefault is - # true, all cops in the default configuration are disabled, and and only cops - # in user configuration are enabled. This makes cops opt-in instead of - # opt-out. Note that when DisabledByDefault is true, cops in user - # configuration will be enabled even if they don't set the Enabled parameter. - DisabledByDefault: false - # Enables the result cache if true. Can be overridden by the --cache command - # line option. - UseCache: true - # Threshold for how many files can be stored in the result cache before some - # of the files are automatically removed. - MaxFilesInCache: 20000 - # The cache will be stored in "rubocop_cache" under this directory. The name - # "/tmp" is special and will be converted to the system temporary directory, - # which is "/tmp" on Unix-like systems, but could be something else on other - # systems. - CacheRootDirectory: /tmp - # The default cache root directory is /tmp, which on most systems is - # writable by any system user. This means that it is possible for a - # malicious user to anticipate the location of Rubocop's cache directory, - # and create a symlink in its place that could cause Rubocop to overwrite - # unintended files, or read malicious input. If you are certain that your - # cache location is secure from this kind of attack, and wish to use a - # symlinked cache location, set this value to "true". - AllowSymlinksInCacheRootDirectory: true - # What MRI version of the Ruby interpreter is the inspected code intended to - # run on? (If there is more than one, set this to the lowest version.) - # If a value is specified for TargetRubyVersion then it is used. - # Else if .ruby-version exists and it contains an MRI version it is used. - # Otherwise we fallback to the oldest officially supported Ruby version (2.0). - TargetRubyVersion: 2.7 - - RSpec: - Patterns: - - "(?:^|/)spec/" - - "(?:^|/)test/" - -# Indent private/protected/public as deep as method definitions -Layout/AccessModifierIndentation: - EnforcedStyle: indent - SupportedStyles: - - outdent - - indent - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/Alias: - EnforcedStyle: prefer_alias - SupportedStyles: - - prefer_alias - - prefer_alias_method - -# Align the elements of a hash literal if they span more than one line. -Layout/HashAlignment: - # Alignment of entries using hash rocket as separator. Valid values are: - # - # key - left alignment of keys - # "a" => 2 - # "bb" => 3 - # separator - alignment of hash rockets, keys are right aligned - # "a" => 2 - # "bb" => 3 - # table - left alignment of keys, hash rockets, and values - # "a" => 2 - # "bb" => 3 - EnforcedHashRocketStyle: key - # Alignment of entries using colon as separator. Valid values are: - # - # key - left alignment of keys - # a: 0 - # bb: 1 - # separator - alignment of colons, keys are right aligned - # a: 0 - # bb: 1 - # table - left alignment of keys and values - # a: 0 - # bb: 1 - EnforcedColonStyle: key - # Select whether hashes that are the last argument in a method call should be - # inspected? Valid values are: - # - # always_inspect - Inspect both implicit and explicit hashes. - # Registers an offense for: - # function(a: 1, - # b: 2) - # Registers an offense for: - # function({a: 1, - # b: 2}) - # always_ignore - Ignore both implicit and explicit hashes. - # Accepts: - # function(a: 1, - # b: 2) - # Accepts: - # function({a: 1, - # b: 2}) - # ignore_implicit - Ignore only implicit hashes. - # Accepts: - # function(a: 1, - # b: 2) - # Registers an offense for: - # function({a: 1, - # b: 2}) - # ignore_explicit - Ignore only explicit hashes. - # Accepts: - # function({a: 1, - # b: 2}) - # Registers an offense for: - # function(a: 1, - # b: 2) - EnforcedLastArgumentHashStyle: always_inspect - SupportedLastArgumentHashStyles: - - always_inspect - - always_ignore - - ignore_implicit - - ignore_explicit - -Layout/ParameterAlignment: - # Alignment of parameters in multi-line method calls. - # - # The `with_first_parameter` style aligns the following lines along the same - # column as the first parameter. - # - # method_call(a, - # b) - # - # The `with_fixed_indentation` style aligns the following lines with one - # level of indentation relative to the start of the line with the method call. - # - # method_call(a, - # b) - EnforcedStyle: with_first_parameter - SupportedStyles: - - with_first_parameter - - with_fixed_indentation - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/AndOr: - # Whether `and` and `or` are banned only in conditionals (conditionals) - # or completely (always). - EnforcedStyle: always - SupportedStyles: - - always - - conditionals - -Style/AsciiComments: - Enabled: false - -# Checks if usage of %() or %Q() matches configuration. -Style/BarePercentLiterals: - EnforcedStyle: bare_percent - SupportedStyles: - - percent_q - - bare_percent - -Style/BlockDelimiters: - EnforcedStyle: line_count_based - SupportedStyles: - # The `line_count_based` style enforces braces around single line blocks and - # do..end around multi-line blocks. - - line_count_based - # The `semantic` style enforces braces around functional blocks, where the - # primary purpose of the block is to return a value and do..end for - # procedural blocks, where the primary purpose of the block is its - # side-effects. - # - # This looks at the usage of a block's method to determine its type (e.g. is - # the result of a `map` assigned to a variable or passed to another - # method) but exceptions are permitted in the `ProceduralMethods`, - # `FunctionalMethods` and `IgnoredMethods` sections below. - - semantic - # The `braces_for_chaining` style enforces braces around single line blocks - # and do..end around multi-line blocks, except for multi-line blocks whose - # return value is being chained with another method (in which case braces - # are enforced). - - braces_for_chaining - ProceduralMethods: - # Methods that are known to be procedural in nature but look functional from - # their usage, e.g. - # - # time = Benchmark.realtime do - # foo.bar - # end - # - # Here, the return value of the block is discarded but the return value of - # `Benchmark.realtime` is used. - - benchmark - - bm - - bmbm - - create - - each_with_object - - measure - - new - - realtime - - tap - - with_object - FunctionalMethods: - # Methods that are known to be functional in nature but look procedural from - # their usage, e.g. - # - # let(:foo) { Foo.new } - # - # Here, the return value of `Foo.new` is used to define a `foo` helper but - # doesn't appear to be used from the return value of `let`. - - let - - let! - - subject - - watch - IgnoredMethods: - # Methods that can be either procedural or functional and cannot be - # categorised from their usage alone, e.g. - # - # foo = lambda do |x| - # puts "Hello, #{x}" - # end - # - # foo = lambda do |x| - # x * 100 - # end - # - # Here, it is impossible to tell from the return value of `lambda` whether - # the inner block's return value is significant. - - lambda - - proc - - it - -Style/ExplicitBlockArgument: - Enabled: false - -Style/HashEachMethods: - Enabled: false - -Style/HashLikeCase: - MinBranchesCount: 5 - -# Indentation of `when`. -Layout/CaseIndentation: - EnforcedStyle: case - SupportedStyles: - - case - - end - IndentOneStep: false - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - # This only matters if IndentOneStep is true - IndentationWidth: ~ - -Style/ClassAndModuleChildren: - Enabled: false - # Checks the style of children definitions at classes and modules. - # - # Basically there are two different styles: - # - # `nested` - have each child on a separate line - # class Foo - # class Bar - # end - # end - # - # `compact` - combine definitions as much as possible - # class Foo::Bar - # end - # - # The compact style is only forced, for classes / modules with one child. - EnforcedStyle: nested - SupportedStyles: - - nested - - compact - -Style/ClassCheck: - EnforcedStyle: is_a? - SupportedStyles: - - is_a? - - kind_of? - -# Align with the style guide. -Style/CollectionMethods: - # Mapping from undesired method to desired_method - # e.g. to use `detect` over `find`: - # - # CollectionMethods: - # PreferredMethods: - # find: detect - PreferredMethods: - collect: "map" - collect!: "map!" - inject: "reduce" - detect: "find" - find_all: "select" - -# Use ` or %x around command literals. -Style/CommandLiteral: - EnforcedStyle: backticks - # backticks: Always use backticks. - # percent_x: Always use %x. - # mixed: Use backticks on single-line commands, and %x on multi-line commands. - SupportedStyles: - - backticks - - percent_x - - mixed - # If false, the cop will always recommend using %x if one or more backticks - # are found in the command string. - AllowInnerBackticks: false - -# Checks formatting of special comments -Style/CommentAnnotation: - Keywords: - - TODO - - FIXME - - OPTIMIZE - - HACK - - REVIEW - -Style/ConditionalAssignment: - EnforcedStyle: assign_to_condition - SupportedStyles: - - assign_to_condition - - assign_inside_condition - # When configured to `assign_to_condition`, `SingleLineConditionsOnly` - # will only register an offense when all branches of a condition are - # a single line. - # When configured to `assign_inside_condition`, `SingleLineConditionsOnly` - # will only register an offense for assignment to a condition that has - # at least one multiline branch. - SingleLineConditionsOnly: true - -# Checks that you have put a copyright in a comment before any code. -# -# You can override the default Notice in your .rubocop.yml file. -# -# In order to use autocorrect, you must supply a value for the -# AutocorrectNotice key that matches the regexp Notice. A blank -# AutocorrectNotice will cause an error during autocorrect. -# -# Autocorrect will add a copyright notice in a comment at the top -# of the file immediately after any shebang or encoding comments. -# -# Example rubocop.yml: -# -# Style/Copyright: -# Enabled: true -# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc' -# AutocorrectNotice: "# Copyright (c) 2015 Yahoo! Inc." -# -Style/Copyright: - Notice: '^Copyright (\(c\) )?2[0-9]{3} .+' - AutocorrectNotice: "" - -Style/DocumentationMethod: - RequireForNonPublicMethods: false - -# Multi-line method chaining should be done with leading dots. -Layout/DotPosition: - EnforcedStyle: leading - SupportedStyles: - - leading - - trailing - -# Warn on empty else statements -# empty - warn only on empty else -# nil - warn on else with nil in it -# both - warn on empty else and else with nil in it -Style/EmptyElse: - EnforcedStyle: both - SupportedStyles: - - empty - - nil - - both - -# Use empty lines between defs. -Layout/EmptyLineBetweenDefs: - # If true, this parameter means that single line method definitions don't - # need an empty line between them. - AllowAdjacentOneLineDefs: false - -Layout/EmptyLinesAroundBlockBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -Layout/EmptyLinesAroundClassBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -Layout/EmptyLinesAroundModuleBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -# Checks whether the source file has a utf-8 encoding comment or not -# AutoCorrectEncodingComment must match the regex -# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/ -Style/Encoding: - Enabled: true - -Layout/ExtraSpacing: - # When true, allows most uses of extra spacing if the intent is to align - # things with the previous or next line, not counting empty lines or comment - # lines. - AllowForAlignment: false - # When true, forces the alignment of = in assignments on consecutive lines. - ForceEqualSignAlignment: false - -Naming/FileName: - Exclude: - - "**/Gemfile" - - "**/Rakefile" - - "**/*.gemspec" - # When true, requires that each source file should define a class or module - # with a name which matches the file name (converted to ... case). - # It further expects it to be nested inside modules which match the names - # of subdirectories in its path. - ExpectMatchingDefinition: false - # If non-nil, expect all source file names to match the following regex. - # Only the file name itself is matched, not the entire file path. - # Use anchors as necessary if you want to match the entire name rather than - # just a part of it. - Regex: ~ - # With `IgnoreExecutableScripts` set to `true`, this cop does not - # report offending filenames for executable scripts (i.e. source - # files with a shebang in the first line). - IgnoreExecutableScripts: true - -Layout/FirstArgumentIndentation: - EnforcedStyle: special_for_inner_method_call_in_parentheses - SupportedStyles: - # The first parameter should always be indented one step more than the - # preceding line. - - consistent - # The first parameter should normally be indented one step more than the - # preceding line, but if it's a parameter for a method call that is itself - # a parameter in a method call, then the inner parameter should be indented - # relative to the inner method. - - special_for_inner_method_call - # Same as special_for_inner_method_call except that the special rule only - # applies if the outer method call encloses its arguments in parentheses. - - special_for_inner_method_call_in_parentheses - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks use of for or each in multiline loops. -Style/For: - EnforcedStyle: each - SupportedStyles: - - for - - each - -# Enforce the method used for string formatting. -Style/FormatString: - EnforcedStyle: format - SupportedStyles: - - format - - sprintf - - percent - -Style/FormatStringToken: - EnforcedStyle: template - -Style/FrozenStringLiteralComment: - EnforcedStyle: always - SupportedStyles: - - never - # `always` will always add the frozen string literal comment to a file - # regardless of the Ruby version or if `freeze` or `<<` are called on a - # string literal. If you run code against multiple versions of Ruby, it is - # possible that this will create errors in Ruby 2.3.0+. - - always - -# Built-in global variables are allowed by default. -Style/GlobalVars: - AllowedVariables: [] - -# `MinBodyLength` defines the number of lines of the a body of an if / unless -# needs to have to trigger this cop -Style/GuardClause: - MinBodyLength: 6 - -Style/HashSyntax: - EnforcedStyle: ruby19 - SupportedStyles: - # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys - - ruby19 - # checks for hash rocket syntax for all hashes - - hash_rockets - # forbids mixed key syntaxes (e.g. {a: 1, :b => 2}) - - no_mixed_keys - # enforces both ruby19 and no_mixed_keys styles - - ruby19_no_mixed_keys - # Force hashes that have a symbol value to use hash rockets - UseHashRocketsWithSymbolValues: false - # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style - PreferHashRocketsForNonAlnumEndingSymbols: false - -Layout/IndentationConsistency: - # The difference between `rails` and `normal` is that the `rails` style - # prescribes that in classes and modules the `protected` and `private` - # modifier keywords shall be indented the same as public methods and that - # protected and private members shall be indented one step more than the - # modifiers. Other than that, both styles mean that entities on the same - # logical depth shall have the same indentation. - EnforcedStyle: normal - SupportedStyles: - - normal - - rails - -Layout/IndentationWidth: - # Number of spaces for each indentation level. - Width: 2 - -# Checks the indentation of the first element in an array literal. -Layout/FirstArrayElementIndentation: - # The value `special_inside_parentheses` means that array literals with - # brackets that have their opening bracket on the same line as a surrounding - # opening round parenthesis, shall have their first element indented relative - # to the first position inside the parenthesis. - # - # The value `consistent` means that the indentation of the first element shall - # always be relative to the first position of the line where the opening - # bracket is. - # - # The value `align_brackets` means that the indentation of the first element - # shall always be relative to the position of the opening bracket. - EnforcedStyle: special_inside_parentheses - SupportedStyles: - - special_inside_parentheses - - consistent - - align_brackets - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks the indentation of assignment RHS, when on a different line from LHS -Layout/AssignmentIndentation: - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks the indentation of the first key in a hash literal. -Layout/FirstHashElementIndentation: - # The value `special_inside_parentheses` means that hash literals with braces - # that have their opening brace on the same line as a surrounding opening - # round parenthesis, shall have their first key indented relative to the - # first position inside the parenthesis. - # - # The value `consistent` means that the indentation of the first key shall - # always be relative to the first position of the line where the opening - # brace is. - # - # The value `align_braces` means that the indentation of the first key shall - # always be relative to the position of the opening brace. - EnforcedStyle: special_inside_parentheses - SupportedStyles: - - special_inside_parentheses - - consistent - - align_braces - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/Lambda: - EnforcedStyle: line_count_dependent - SupportedStyles: - - line_count_dependent - - lambda - - literal - Exclude: - - "**/types/**/*" - - "**/*_interface.rb" - -Style/LambdaCall: - EnforcedStyle: call - SupportedStyles: - - call - - braces - -Style/Next: - # With `always` all conditions at the end of an iteration needs to be - # replaced by next - with `skip_modifier_ifs` the modifier if like this one - # are ignored: [1, 2].each { |a| return "yes" if a == 1 } - EnforcedStyle: skip_modifier_ifs - # `MinBodyLength` defines the number of lines of the a body of an if / unless - # needs to have to trigger this cop - MinBodyLength: 3 - SupportedStyles: - - skip_modifier_ifs - - always - -Style/NonNilCheck: - # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for - # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is - # **usually** OK, but might change behavior. - # - # With `IncludeSemanticChanges` set to `false`, this cop does not report - # offenses for `!x.nil?` and does no changes that might change behavior. - IncludeSemanticChanges: false - -Style/NumericPredicate: - EnforcedStyle: predicate - SupportedStyles: - - predicate - - comparison - -Style/MethodDefParentheses: - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - - require_no_parentheses_except_multiline - -Naming/MethodName: - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - -Style/ModuleFunction: - EnforcedStyle: module_function - SupportedStyles: - - module_function - - extend_self - -Layout/MultilineArrayBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last element - - symmetrical - - new_line - - same_line - -Layout/MultilineAssignmentLayout: - # The types of assignments which are subject to this rule. - SupportedTypes: - - block - - case - - class - - if - - kwbegin - - module - EnforcedStyle: new_line - SupportedStyles: - # Ensures that the assignment operator and the rhs are on the same line for - # the set of supported types. - - same_line - # Ensures that the assignment operator and the rhs are on separate lines - # for the set of supported types. - - new_line - -Layout/MultilineHashBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on same line as last element - - symmetrical - - new_line - - same_line - -Layout/MultilineMethodCallBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last argument - - symmetrical - - new_line - - same_line - -Layout/MultilineMethodCallIndentation: - EnforcedStyle: aligned - SupportedStyles: - - aligned - - indented - - indented_relative_to_receiver - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Layout/MultilineMethodDefinitionBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last parameter - - symmetrical - - new_line - - same_line - -Layout/MultilineOperationIndentation: - EnforcedStyle: aligned - SupportedStyles: - - aligned - - indented - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/NumericLiterals: - MinDigits: 5 - -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_with_o - SupportedOctalStyles: - - zero_with_o - - zero_only - -Style/OptionHash: - # A list of parameter names that will be flagged by this cop. - SuspiciousParamNames: - - options - - opts - - args - - params - - parameters - -# Allow safe assignment in conditions. -Style/ParenthesesAroundCondition: - AllowSafeAssignment: true - -Style/PercentLiteralDelimiters: - PreferredDelimiters: - "%": () - "%i": () - "%q": () - "%Q": () - "%r": "{}" - "%s": () - "%w": () - "%W": () - "%x": () - -Style/PercentQLiterals: - EnforcedStyle: lower_case_q - SupportedStyles: - - lower_case_q # Use %q when possible, %Q when necessary - - upper_case_q # Always use %Q - -Style/SlicingWithRange: - Enabled: false - -Naming/PredicateName: - # Predicate name prefixes. - NamePrefix: - - is_ - - has_ - - have_ - # Predicate name prefixes that should be removed. - ForbiddenPrefixes: - - is_ - - have_ - # Predicate names which, despite having a blacklisted prefix, or no ?, - # should still be accepted - AllowedMethods: - - is_a? - # Exclude Rspec specs because there is a strong convetion to write spec - # helpers in the form of `have_something` or `be_something`. - Exclude: - - "**/spec/**/*" - - "**/test/**/*" - -Style/PreferredHashMethods: - Enabled: true - EnforcedStyle: verbose - -Style/DateTime: - Enabled: true - -Style/Documentation: - Enabled: false - -Style/RaiseArgs: - EnforcedStyle: exploded - SupportedStyles: - - compact # raise Exception.new(msg) - - exploded # raise Exception, msg - -Style/RedundantReturn: - # When true allows code like `return x, y`. - AllowMultipleReturnValues: false - -# Use / or %r around regular expressions. -Style/RegexpLiteral: - EnforcedStyle: slashes - # slashes: Always use slashes. - # percent_r: Always use %r. - # mixed: Use slashes on single-line regexes, and %r on multi-line regexes. - SupportedStyles: - - slashes - - percent_r - - mixed - # If false, the cop will always recommend using %r if one or more slashes - # are found in the regexp string. - AllowInnerSlashes: false - -Style/SafeNavigation: - Enabled: false - -Style/Semicolon: - # Allow ; to separate several expressions on the same line. - AllowAsExpressionSeparator: false - -Style/SignalException: - EnforcedStyle: only_raise - SupportedStyles: - - only_raise - - only_fail - - semantic - -Style/SingleLineBlockParams: - Methods: - - reduce: - - a - - e - - inject: - - a - - e - -Style/SingleLineMethods: - AllowIfMethodIsEmpty: true - -Layout/SpaceBeforeFirstArg: - # When true, allows most uses of extra spacing if the intent is to align - # things with the previous or next line, not counting empty lines or comment - # lines. - AllowForAlignment: true - -Style/SpecialGlobalVars: - EnforcedStyle: use_english_names - SupportedStyles: - - use_perl_names - - use_english_names - -Style/StabbyLambdaParentheses: - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - -Style/StringLiterals: - EnforcedStyle: double_quotes - SupportedStyles: - - single_quotes - - double_quotes - # If true, strings which span multiple lines using \ for continuation must - # use the same type of quotes on each line. - ConsistentQuotesInMultiline: false - -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - SupportedStyles: - - single_quotes - - double_quotes - -Style/StringMethods: - # Mapping from undesired method to desired_method - # e.g. to use `to_sym` over `intern`: - # - # StringMethods: - # PreferredMethods: - # intern: to_sym - PreferredMethods: - intern: to_sym - -Layout/SpaceAroundBlockParameters: - EnforcedStyleInsidePipes: no_space - -Layout/SpaceAroundEqualsInParameterDefault: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - -Layout/SpaceAroundOperators: - # When true, allows most uses of extra spacing if the intent is to align - # with an operator on the previous or next line, not counting empty lines - # or comment lines. - AllowForAlignment: true - -Layout/SpaceBeforeBlockBraces: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - -Layout/SpaceInsideBlockBraces: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - # Valid values are: space, no_space - EnforcedStyleForEmptyBraces: no_space - # Space between { and |. Overrides EnforcedStyle if there is a conflict. - SpaceBeforeBlockParameters: true - -Layout/SpaceInsideHashLiteralBraces: - EnforcedStyle: space - EnforcedStyleForEmptyBraces: no_space - SupportedStyles: - - space - - no_space - # "compact" normally requires a space inside hash braces, with the exception - # that successive left braces or right braces are collapsed together - - compact - -Layout/SpaceInsideStringInterpolation: - EnforcedStyle: no_space - SupportedStyles: - - space - - no_space - -Style/AccessModifierDeclarations: - Enabled: false - -Style/SymbolArray: - EnforcedStyle: brackets - SupportedStyles: - - percent - - brackets - -Style/SymbolProc: - # A list of method names to be ignored by the check. - # The names should be fairly unique, otherwise you'll end up ignoring lots of code. - IgnoredMethods: - - respond_to - - define_method - -Style/TernaryParentheses: - EnforcedStyle: require_no_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - AllowSafeAssignment: true - -Layout/TrailingEmptyLines: - EnforcedStyle: final_newline - SupportedStyles: - - final_newline - - final_blank_line - -Style/TrailingCommaInArguments: - # If `comma`, the cop requires a comma after the last argument, but only for - # parenthesized method calls where each argument is on its own line. - # If `consistent_comma`, the cop requires a comma after the last argument, - # for all parenthesized method calls with arguments. - EnforcedStyleForMultiline: no_comma - -Style/TrailingCommaInArrayLiteral: - # If `comma`, the cop requires a comma after the last item in an array or - # hash, but only when each item is on its own line. - # If `consistent_comma`, the cop requires a comma after the last item of all - # non-empty array and hash literals. - EnforcedStyleForMultiline: no_comma - -Style/TrailingCommaInHashLiteral: - # If `comma`, the cop requires a comma after the last item in an array or - # hash, but only when each item is on its own line. - # If `consistent_comma`, the cop requires a comma after the last item of all - # non-empty array and hash literals. - EnforcedStyleForMultiline: no_comma - -# TrivialAccessors requires exact name matches and doesn't allow -# predicated methods by default. -Style/TrivialAccessors: - # When set to false the cop will suggest the use of accessor methods - # in situations like: - # - # def name - # @other_name - # end - # - # This way you can uncover "hidden" attributes in your code. - ExactNameMatch: true - AllowPredicates: true - # Allows trivial writers that don't end in an equal sign. e.g. - # - # def on_exception(action) - # @on_exception=action - # end - # on_exception :restart - # - # Commonly used in DSLs - AllowDSLWriters: false - IgnoreClassMethods: false - AllowedMethods: - - to_ary - - to_a - - to_c - - to_enum - - to_h - - to_hash - - to_i - - to_int - - to_io - - to_open - - to_path - - to_proc - - to_r - - to_regexp - - to_str - - to_s - - to_sym - -Naming/VariableName: - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - -Naming/VariableNumber: - EnforcedStyle: normalcase - SupportedStyles: - - snake_case - - normalcase - - non_integer - -# WordArray enforces how array literals of word-like strings should be expressed. -Style/WordArray: - EnforcedStyle: percent - SupportedStyles: - # percent style: %w(word1 word2) - - percent - # bracket style: ["word1", "word2"] - - brackets - # The MinSize option causes the WordArray rule to be ignored for arrays - # smaller than a certain size. The rule is only applied to arrays - # whose element count is greater than or equal to MinSize. - MinSize: 2 - # The regular expression WordRegex decides what is considered a word. - WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/' - -##################### Metrics ################################## - -Metrics/AbcSize: - # The ABC size is a calculated magnitude, so this number can be an Integer or - # a Float. - Max: 15 - Enabled: false - -Metrics/BlockNesting: - Max: 3 - -Metrics/ClassLength: - CountComments: false # count full line comments? - Max: 100 - Enabled: false - -Metrics/ModuleLength: - CountComments: false # count full line comments? - Max: 100 - Enabled: false - -# Avoid complex methods. -Metrics/CyclomaticComplexity: - Max: 9 - Exclude: - - "bin/bundle" - - "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb" - - "**/*/dummy_authorization_handler.rb" - - "**/*/permissions.rb" - -Metrics/MethodLength: - CountComments: false # count full line comments? - Max: 15 - Enabled: false - -Metrics/ParameterLists: - Max: 5 - CountKeywordArgs: true - Exclude: - - "decidim-core/lib/decidim/filter_form_builder.rb" - -Metrics/PerceivedComplexity: - Max: 10 - Exclude: - - "decidim-admin/app/queries/decidim/admin/newsletter_recipients.rb" - - "**/*/dummy_authorization_handler.rb" - - "**/*/permissions.rb" - -##################### Lint ################################## - -Lint/AmbiguousBlockAssociation: - Enabled: true - Exclude: - - "**/abilities/**/*" - -# Allow safe assignment in conditions. -Lint/AssignmentInCondition: - AllowSafeAssignment: true - -Lint/ConstantDefinitionInBlock: - Enabled: false - -# Call super to initialize state of the parent class. -Lint/MissingSuper: - Enabled: false - -# checks whether the end keywords are aligned properly for `do` `end` blocks. -Layout/BlockAlignment: - # The value `start_of_block` means that the `end` should be aligned with line - # where the `do` keyword appears. - # The value `start_of_line` means it should be aligned with the whole - # expression's starting line. - # The value `either` means both are allowed. - EnforcedStyleAlignWith: either - -# Align ends correctly. -Layout/EndAlignment: - # The value `keyword` means that `end` should be aligned with the matching - # keyword (if, while, etc.). - # The value `variable` means that in assignments, `end` should be aligned - # with the start of the variable on the left hand side of `=`. In all other - # situations, `end` should still be aligned with the keyword. - # The value `start_of_line` means that `end` should be aligned with the start - # of the line which the matching keyword appears on. - EnforcedStyleAlignWith: keyword - AutoCorrect: false - -Layout/DefEndAlignment: - # The value `def` means that `end` should be aligned with the def keyword. - # The value `start_of_line` means that `end` should be aligned with method - # calls like `private`, `public`, etc, if present in front of the `def` - # keyword on the same line. - EnforcedStyleAlignWith: start_of_line - AutoCorrect: false - -Lint/InheritException: - # The default base class in favour of `Exception`. - EnforcedStyle: runtime_error - SupportedStyles: - - runtime_error - - standard_error - -Layout/LineLength: - Max: 180 - # To make it possible to copy or click on URIs in the code, we allow lines - # containing a URI to be longer than Max. - AllowHeredoc: true - AllowURI: true - URISchemes: - - http - - https - Exclude: - - "**/spec/**/*" - -# Checks for unused block arguments -Lint/UnusedBlockArgument: - IgnoreEmptyBlocks: true - AllowUnusedKeywordArguments: false - -# Checks for unused method arguments. -Lint/UnusedMethodArgument: - AllowUnusedKeywordArguments: false - IgnoreEmptyMethods: true - -##################### Performance ############################ - -Metrics/BlockLength: - Enabled: false - -RSpec/BeforeAfterAll: - Enabled: true - -RSpec/ContextWording: - Enabled: true - Prefixes: - - when - - with - - without - - and - -RSpec/DescribeClass: - Exclude: - - spec/gemfiles_spec.rb - - spec/js_bundles_spec.rb - - spec/i18n_spec.rb - - "**/*/spec/**/*_badge_spec.rb" - - decidim-core/spec/lib/global_engines_spec.rb - - "**/tasks/**/*" - -RSpec/EmptyExampleGroup: - Exclude: - - decidim-core/spec/lib/participatory_space_manifest_spec.rb - -RSpec/ExampleLength: - Max: 49 - -RSpec/ExpectInHook: - Enabled: false - -RSpec/IteratedExpectation: - Enabled: true - -RSpec/LetSetup: - Enabled: false - -RSpec/MessageSpies: - Enabled: false - -RSpec/MultipleExpectations: - Enabled: false - -RSpec/MultipleMemoizedHelpers: - Max: 35 - -RSpec/NestedGroups: - Max: 7 - -RSpec/NamedSubject: - Enabled: false - -RSpec/RepeatedExampleGroupDescription: - Enabled: false - -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/VerifiedDoubles: - Enabled: false - -RSpec/LeakyConstantDeclaration: - Enabled: false - -RSpec/DescribedClass: - Enabled: false - -# This is the default configuration file. - -Faker/DeprecatedArguments: - Description: 'Checks that Faker arguments style is based on Faker 2.' - Enabled: true - VersionAdded: '0.1' - Reference: 'https://github.com/faker-ruby/faker/blob/master/CHANGELOG.md#v20-2019-31-07' - ArgumentKeywords: - # - # FakerClassName: - # method_name: - # - keyword_name_for_first_argument - # - keyword_name_for_second_argument - # - keyword_name_for_third_argument - # - Faker::Dune: - quote: - - character - saying: - - source - Faker::Books::Lovecraft: - fhtagn: - - number - sentence: - - word_count - - random_words_to_add - words: - - number - - spaces_allowed - sentences: - - number - paragraph: - - sentence_count - - random_sentences_to_add - paragraphs: - - number - paragraph_by_chars: - - characters - Faker::Address: - city: - - options - street_address: - - include_secondary - zip_code: - - state_abbreviation - country_by_code: - - code - country_name_to_code: - - name - Faker::Alphanumeric: - alpha: - - number - alphanumeric: - - number - Faker::App: - semantic_version: - - major - - minor - - patch - Faker::Avatar: - image: - - slug - - size - - format - - set - - bgset - Faker::Bank: - account_number: - - digits - iban: - - country_code - Faker::Boolean: - boolean: - - true_ratio - Faker::ChileRut: - rut: - - min_rut - - fixed - full_rut: - - min_rut - - fixed - Faker::Code: - isbn: - - base - ean: - - base - nric: - - min_age - - max_age - Faker::Commerce: - promotion_code: - - digits - department: - - max - - fixed_amount - price: - - range - - as_string - Faker::Company: - polish_register_of_national_economy: - - length - brazilian_company_number: - - formatted - Faker::CryptoCoin: - coin_name: - - coin - acronym: - - coin - url_logo: - - coin - Faker::Date: - between: - - from - - to - between_except: - - from - - to - - excepted - forward: - - days - backward: - - days - birthday: - - min_age - - max_age - Faker::Demographic: - height: - - unit - Faker::DrivingLicence: - british_driving_licence: - - last_name - - initials - - gender - - date_of_birth - Faker::File: - dir: - - segment_count - - root - - directory_separator - file_name: - - dir - - name - - ext - - directory_separator - Faker::Fillmurray: - image: - - grayscale - - width - - height - Faker::Finance: - vat_number: - - country - Faker::Hipster: - words: - - number - - supplemental - - spaces_allowed - sentence: - - word_count - - supplemental - - random_words_to_add - sentences: - - number - - supplemental - paragraph: - - sentence_count - - supplemental - - random_sentences_to_add - paragraphs: - - number - - supplemental - paragraph_by_chars: - - characters - - supplemental - Faker::IDNumber: - brazilian_citizen_number: - - formatted - brazilian_id: - - formatted - Faker::Internet: - email: - - name - - separators - free_email: - - name - safe_email: - - name - username: - - specifier - - separators - password: - - min_length - - max_length - - mix_case - - special_characters - domain_name: - - subdomain - fix_umlauts: - - string - mac_address: - - prefix - url: - - host - - path - - scheme - slug: - - words - - glue - user_agent: - - vendor - Faker::Invoice: - amount_between: - - from - - to - creditor_reference: - - ref - reference: - - ref - Faker::Json: - shallow_json: - - width - - options - add_depth_to_json: - - json - - width - - options - Faker::Lorem: - words: - - number - - supplemental - characters: - - number - sentence: - - word_count - - supplemental - - random_words_to_add - sentences: - - number - - supplemental - paragraph: - - sentence_count - - supplemental - - random_sentences_to_add - paragraphs: - - number - - supplemental - paragraph_by_chars: - - number - - supplemental - question: - - word_count - - supplemental - - random_words_to_add - questions: - - number - - supplemental - Faker::LoremFlickr: - image: - - size - - search_terms - - match_all - grayscale_image: - - size - - search_terms - - match_all - pixelated_image: - - size - - search_terms - - match_all - colorized_image: - - size - - color - - search_terms - - match_all - Faker::LoremPixel: - image: - - size - - is_gray - - category - - number - - text - - secure - Faker::Markdown: - sandwich: - - sentences - - repeat - Faker::Measurement: - height: - - amount - length: - - amount - volume: - - amount - weight: - - amount - metric_height: - - amount - metric_length: - - amount - metric_volume: - - amount - metric_weight: - - amount - Faker::Name: - initials: - - number - Faker::NationalHealthService: - check_digit: - - number - Faker::Number: - number: - - digits - leading_zero_number: - - digits - decimal_part: - - digits - decimal: - - l_digits - - r_digits - hexadecimal: - - digits - normal: - - mean - - standard_deviation - between: - - from - - to - within: - - range - positive: - - from - - to - negative: - - from - - to - Faker::Omniauth: - google: - - name - - email - - uid - facebook: - - name - - email - - username - - uid - twitter: - - name - - nickname - - uid - linkedin: - - name - - email - - uid - github: - - name - - email - - uid - Faker::PhoneNumber: - subscriber_number: - - length - Faker::Placeholdit: - image: - - size - - format - - background_color - - text_color - - text - Faker::Relationship: - familial: - - connection - Faker::Source: - hello_world: - - lang - print: - - str - - lang - print_1_to_10: - - lang - Faker::String: - random: - - length - Faker::Stripe: - valid_card: - - card_type - valid_token: - - card_type - invalid_card: - - card_error - ccv: - - card_type - Faker::Time: - between: - - from - - to - - format - between_dates: - - from - - to - - period - - format - forward: - - days - - period - - format - backward: - - days - - period - - format - Faker::Twitter: - user: - - include_status - - include_email - status: - - include_user - - include_photo - status_entities: - - include_photo - Faker::Types: - rb_string: - - words - rb_integer: - - from - - to - rb_hash: - - number - - type - complex_rb_hash: - - number - rb_array: - - len - Faker::Vehicle: - model: - - make_of_model - mileage: - - min - - max - license_plate: - - state_abbreviation - Faker::WorldCup: - group: - - group - roster: - - country - - type - Faker::Dota: - quote: - - hero - Faker::Movies::StarWars: - quote: - - character - Decidim::Faker::Localized: - words: - - number - - supplemental - characters: - - number - sentence: - - word_count - - supplemental - - random_words_to_add - sentences: - - number - - supplemental - paragraph: - - sentence_count - - supplemental - - random_sentences_to_add - paragraphs: - - number - - supplemental - paragraph_by_chars: - - number - - supplemental - question: - - word_count - - supplemental - - random_words_to_add - questions: - - number - - supplemental - diff --git a/Gemfile.lock b/Gemfile.lock index 8e67b87..6e642cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,46 +1,48 @@ PATH remote: . specs: - decidim-civicrm (0.26.1) - decidim-admin (~> 0.26.1) - decidim-core (~> 0.26.1) - decidim-verifications (~> 0.26.1) + decidim-civicrm (0.27.3) + decidim-admin (~> 0.27.3) + decidim-core (~> 0.27.3) + decidim-verifications (~> 0.27.3) GEM remote: https://rubygems.org/ specs: - actioncable (6.0.5) - actionpack (= 6.0.5) + actioncable (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.5) - actionpack (= 6.0.5) - activejob (= 6.0.5) - activerecord (= 6.0.5) - activestorage (= 6.0.5) - activesupport (= 6.0.5) + actionmailbox (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (>= 2.7.1) - actionmailer (6.0.5) - actionpack (= 6.0.5) - actionview (= 6.0.5) - activejob (= 6.0.5) + actionmailer (6.1.7.4) + actionpack (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.5) - actionview (= 6.0.5) - activesupport (= 6.0.5) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.7.4) + actionview (= 6.1.7.4) + activesupport (= 6.1.7.4) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.5) - actionpack (= 6.0.5) - activerecord (= 6.0.5) - activestorage (= 6.0.5) - activesupport (= 6.0.5) + actiontext (6.1.7.4) + actionpack (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) nokogiri (>= 1.8.5) - actionview (6.0.5) - activesupport (= 6.0.5) + actionview (6.1.7.4) + activesupport (= 6.1.7.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -48,31 +50,33 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (6.0.5) - activesupport (= 6.0.5) + activejob (6.1.7.4) + activesupport (= 6.1.7.4) globalid (>= 0.3.6) - activemodel (6.0.5) - activesupport (= 6.0.5) - activerecord (6.0.5) - activemodel (= 6.0.5) - activesupport (= 6.0.5) - activestorage (6.0.5) - actionpack (= 6.0.5) - activejob (= 6.0.5) - activerecord (= 6.0.5) + activemodel (6.1.7.4) + activesupport (= 6.1.7.4) + activerecord (6.1.7.4) + activemodel (= 6.1.7.4) + activesupport (= 6.1.7.4) + activestorage (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activesupport (= 6.1.7.4) marcel (~> 1.0) - activesupport (6.0.5) + mini_mime (>= 1.1.0) + activesupport (6.1.7.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) acts_as_list (0.9.19) activerecord (>= 3.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - axe-core-api (4.4.0) + axe-core-api (4.7.0) dumb_delegator virtus axe-core-rspec (4.1.0) @@ -84,7 +88,7 @@ GEM ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) batch-loader (1.5.0) - bcrypt (3.1.17) + bcrypt (3.1.19) better_html (1.0.16) actionview (>= 4.0) activesupport (>= 4.0) @@ -99,7 +103,7 @@ GEM browser (2.7.1) builder (3.2.4) byebug (11.1.3) - capybara (3.37.1) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -108,7 +112,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.2) + carrierwave (2.2.4) activemodel (>= 5.0.0) activesupport (>= 5.0.0) addressable (~> 2.6) @@ -128,9 +132,9 @@ GEM actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) - chef-utils (17.10.0) + chef-utils (18.2.7) concurrent-ruby - childprocess (3.0.0) + childprocess (4.1.0) codecov (0.6.0) simplecov (>= 0.15, < 0.22) coercible (1.0.0) @@ -142,65 +146,67 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.10) + commonmarker (0.23.9) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) - css_parser (1.11.0) + css_parser (1.14.0) addressable - date_validator (0.9.0) - activemodel - activesupport + date (3.3.3) + date_validator (0.12.0) + activemodel (>= 3) + activesupport (>= 3) db-query-matchers (0.10.0) activesupport (>= 4.0, < 7) rspec (~> 3.0) - decidim (0.26.1) - decidim-accountability (= 0.26.1) - decidim-admin (= 0.26.1) - decidim-api (= 0.26.1) - decidim-assemblies (= 0.26.1) - decidim-blogs (= 0.26.1) - decidim-budgets (= 0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-debates (= 0.26.1) - decidim-forms (= 0.26.1) - decidim-generators (= 0.26.1) - decidim-meetings (= 0.26.1) - decidim-pages (= 0.26.1) - decidim-participatory_processes (= 0.26.1) - decidim-proposals (= 0.26.1) - decidim-sortitions (= 0.26.1) - decidim-surveys (= 0.26.1) - decidim-system (= 0.26.1) - decidim-templates (= 0.26.1) - decidim-verifications (= 0.26.1) - decidim-accountability (0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-admin (0.26.1) + decidim (0.27.3) + decidim-accountability (= 0.27.3) + decidim-admin (= 0.27.3) + decidim-api (= 0.27.3) + decidim-assemblies (= 0.27.3) + decidim-blogs (= 0.27.3) + decidim-budgets (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-debates (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-generators (= 0.27.3) + decidim-meetings (= 0.27.3) + decidim-pages (= 0.27.3) + decidim-participatory_processes (= 0.27.3) + decidim-proposals (= 0.27.3) + decidim-sortitions (= 0.27.3) + decidim-surveys (= 0.27.3) + decidim-system (= 0.27.3) + decidim-templates (= 0.27.3) + decidim-verifications (= 0.27.3) + decidim-accountability (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-admin (0.27.3) active_link_to (~> 1.0) - decidim-core (= 0.26.1) + decidim-core (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-api (0.26.1) + decidim-api (0.27.3) graphql (~> 1.12, < 1.13) + graphql-docs (~> 2.1.0) rack-cors (~> 1.0) + decidim-assemblies (0.27.3) + decidim-core (= 0.27.3) + decidim-blogs (0.27.3) + decidim-admin (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-budgets (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-comments (0.27.3) + decidim-core (= 0.27.3) redcarpet (~> 3.5, >= 3.5.1) - decidim-assemblies (0.26.1) - decidim-core (= 0.26.1) - decidim-blogs (0.26.1) - decidim-admin (= 0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-budgets (0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-comments (0.26.1) - decidim-core (= 0.26.1) - redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.26.1) + decidim-core (0.27.3) active_link_to (~> 1.0) acts_as_list (~> 0.9) batch-loader (~> 1.2) @@ -209,17 +215,17 @@ GEM cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) - date_validator (~> 0.9.0) - decidim-api (= 0.26.1) + date_validator (~> 0.12.0) + decidim-api (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) diffy (~> 3.3) doorkeeper (~> 5.1) doorkeeper-i18n (~> 4.0) - file_validators (~> 2.1) + file_validators (~> 3.0) fog-local (~> 0.6) - foundation_rails_helper - geocoder (~> 1.5) + foundation_rails_helper (~> 4.0) + geocoder (~> 1.8) hashdiff (>= 0.4.0, < 2.0.0) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) @@ -238,117 +244,115 @@ GEM premailer-rails (~> 1.10) rack (~> 2.2, >= 2.2.3) rack-attack (~> 6.0) - rails (~> 6.0.4) + rails (~> 6.1.0) rails-i18n (~> 6.0) ransack (~> 2.4.1) - rectify (~> 0.13.0) redis (~> 4.1) request_store (~> 1.5.0) rubyXL (~> 3.4) rubyzip (~> 2.0) - searchlight (~> 4.1) seven_zip_ruby (~> 1.3) social-share-button (~> 1.2, >= 1.2.1) valid_email2 (~> 2.1) webpacker (= 6.0.0.rc.5) + webpush (~> 1.1) wisper (~> 2.0) - decidim-debates (0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-dev (0.26.1) + decidim-debates (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-dev (0.27.3) axe-core-rspec (~> 4.1.0) byebug (~> 11.0) capybara (~> 3.24) db-query-matchers (~> 0.10.0) - decidim (= 0.26.1) + decidim (= 0.27.3) erb_lint (~> 0.0.35) factory_bot_rails (~> 4.8) i18n-tasks (~> 0.9.18) mdl (~> 0.5) - nokogiri (~> 1.12) + nokogiri (~> 1.13) + parallel_tests (~> 3.7) puma (~> 5.0) rails-controller-testing (~> 1.0) - rspec-cells (~> 0.3.4) + rspec-cells (~> 0.3.7) rspec-html-matchers (~> 0.9.1) rspec-rails (~> 4.0) rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.3.0) - rubocop (~> 0.92.0) - rubocop-rails (~> 2.8) - rubocop-rspec (= 1.43.2) - selenium-webdriver (~> 3.142) - simplecov (~> 0.19.0) - simplecov-cobertura (~> 1.3.1) - system_test_html_screenshots (~> 0.2) + rubocop (~> 1.28.0) + rubocop-rails (~> 2.14) + rubocop-rspec (~> 2.10) + selenium-webdriver (~> 4.1.0) + simplecov (~> 0.21.0) + simplecov-cobertura (~> 2.1.0) w3c_rspec_validators (~> 0.3.0) webmock (~> 3.6) wisper-rspec (~> 1.0) - decidim-forms (0.26.1) - decidim-core (= 0.26.1) + decidim-forms (0.27.3) + decidim-core (= 0.27.3) wicked_pdf (~> 2.1) wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.26.1) - decidim-core (= 0.26.1) - decidim-meetings (0.26.1) - decidim-core (= 0.26.1) - decidim-forms (= 0.26.1) + decidim-generators (0.27.3) + decidim-core (= 0.27.3) + decidim-meetings (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) icalendar (~> 2.5) - decidim-pages (0.26.1) - decidim-core (= 0.26.1) - decidim-participatory_processes (0.26.1) - decidim-core (= 0.26.1) - decidim-proposals (0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - doc2text (~> 0.4.4) + decidim-pages (0.27.3) + decidim-core (= 0.27.3) + decidim-participatory_processes (0.27.3) + decidim-core (= 0.27.3) + decidim-proposals (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + doc2text (~> 0.4.5) redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.26.1) - decidim-admin (= 0.26.1) - decidim-comments (= 0.26.1) - decidim-core (= 0.26.1) - decidim-proposals (= 0.26.1) - decidim-surveys (0.26.1) - decidim-core (= 0.26.1) - decidim-forms (= 0.26.1) - decidim-templates (= 0.26.1) - decidim-system (0.26.1) + decidim-sortitions (0.27.3) + decidim-admin (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-proposals (= 0.27.3) + decidim-surveys (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-templates (= 0.27.3) + decidim-system (0.27.3) active_link_to (~> 1.0) - decidim-core (= 0.26.1) + decidim-core (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-templates (0.26.1) - decidim-core (= 0.26.1) - decidim-forms (= 0.26.1) - decidim-verifications (0.26.1) - decidim-core (= 0.26.1) + decidim-templates (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-verifications (0.27.3) + decidim-core (= 0.27.3) declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.8.1) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.2) - devise (>= 4.8.0) - devise_invitable (2.0.6) + devise-i18n (1.11.0) + devise (>= 4.9.0) + devise_invitable (2.0.8) actionmailer (>= 5.0) devise (>= 4.6) diff-lcs (1.5.0) - diffy (3.4.0) - doc2text (0.4.5) - nokogiri (>= 1.13.2, < 1.14.0) + diffy (3.4.2) + doc2text (0.4.6) + nokogiri (>= 1.13.2, < 1.15.0) rubyzip (~> 2.3.0) docile (1.4.0) - doorkeeper (5.5.4) + doorkeeper (5.6.6) railties (>= 5) doorkeeper-i18n (4.0.1) dumb_delegator (1.0.0) - equalizer (0.0.11) erb_lint (0.0.37) activesupport better_html (~> 1.0.7) @@ -359,9 +363,12 @@ GEM smart_properties erbse (0.1.4) temple - erubi (1.10.0) - excon (0.92.3) + erubi (1.12.0) + escape_utils (1.3.0) + excon (0.100.0) execjs (2.8.1) + extended-markdown-filter (0.7.0) + html-pipeline (~> 2.9) factory_bot (4.11.1) activesupport (>= 3.0.0) factory_bot_rails (4.11.1) @@ -369,12 +376,12 @@ GEM railties (>= 3.0.0) faker (2.21.0) i18n (>= 1.8.11, < 2) - faraday (2.3.0) - faraday-net_http (~> 2.0) + faraday (2.7.10) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (2.0.2) + faraday-net_http (3.0.2) ffi (1.15.5) - file_validators (2.3.0) + file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) fog-core (2.3.0) @@ -390,16 +397,29 @@ GEM activemodel (>= 4.1, < 7.1) activesupport (>= 4.1, < 7.1) railties (>= 4.1, < 7.1) - geocoder (1.7.5) - globalid (1.0.0) + gemoji (3.0.1) + geocoder (1.8.2) + globalid (1.1.0) activesupport (>= 5.0) graphql (1.12.24) + graphql-docs (2.1.0) + commonmarker (~> 0.16) + escape_utils (~> 1.2) + extended-markdown-filter (~> 0.4) + gemoji (~> 3.0) + graphql (~> 1.12) + html-pipeline (~> 2.9) + sass (~> 3.4) hashdiff (1.0.1) hashie (5.0.0) - highline (2.0.3) + highline (2.1.0) + hkdf (0.3.0) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) html_tokenizer (0.0.7) htmlentities (4.3.4) - i18n (1.10.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) i18n-tasks (0.9.37) activesupport (>= 4.0.2) @@ -411,7 +431,7 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - icalendar (2.7.1) + icalendar (2.8.0) ice_cube (~> 0.16) ice_cube (0.16.4) ice_nine (0.11.2) @@ -420,8 +440,8 @@ GEM ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - json (2.6.2) - jwt (2.3.0) + json (2.6.3) + jwt (2.7.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -452,11 +472,14 @@ GEM loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) - mdl (0.11.0) + mdl (0.12.0) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) mixlib-cli (~> 2.1, >= 2.1.1) @@ -465,46 +488,62 @@ GEM method_source (1.0.0) mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_magick (4.11.0) + mime-types-data (3.2023.0218.1) + mini_magick (4.12.0) mini_mime (1.1.2) - minitest (5.15.0) + minitest (5.18.1) mixlib-cli (2.1.8) - mixlib-config (3.0.9) + mixlib-config (3.0.27) tomlrb mixlib-shellout (3.2.7) chef-utils msgpack (1.5.1) - multi_json (1.15.0) multi_xml (0.6.0) mustache (1.1.1) - nio4r (2.5.8) - nokogiri (1.13.6-x86_64-linux) + net-imap (0.3.6) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.9) + nokogiri (1.14.5-arm64-darwin) + racc (~> 1.4) + nokogiri (1.14.5-x86_64-linux) racc (~> 1.4) - oauth (0.5.10) - oauth2 (1.4.9) + oauth (1.1.0) + oauth-tty (~> 1.0, >= 1.0.1) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + oauth-tty (1.0.5) + version_gem (~> 1.1, >= 1.1.1) + oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) - multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) - omniauth (2.1.0) + rack (>= 1.2, < 4) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + omniauth (2.1.1) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.0.1) + omniauth-google-oauth2 (1.1.1) jwt (>= 2.0) - oauth2 (~> 1.1) + oauth2 (~> 2.0.6) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.7.1) + omniauth-oauth2 (~> 1.8.0) omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) - omniauth-oauth2 (1.7.2) - oauth2 (~> 1.4) - omniauth (>= 1.9, < 3) + omniauth-oauth2 (1.8.0) + oauth2 (>= 1.4, < 3) + omniauth (~> 2.0) omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) omniauth (~> 2.0) @@ -516,67 +555,71 @@ GEM activerecord (>= 5.2) request_store (~> 1.1) parallel (1.22.1) + parallel_tests (3.13.0) + parallel parser (3.1.2.0) ast (~> 2.4.1) pg (1.1.4) pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - premailer (1.16.0) + premailer (1.21.0) addressable - css_parser (>= 1.6.0) + css_parser (>= 1.12.0) htmlentities (>= 4.0.0) - premailer-rails (1.11.1) + premailer-rails (1.12.0) actionmailer (>= 3) + net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (4.0.7) - puma (5.6.4) + public_suffix (5.0.3) + puma (5.6.6) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.3) + racc (1.7.1) + rack (2.2.7) rack-attack (6.6.1) rack (>= 1.0, < 3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-protection (2.2.0) + rack-protection (3.0.6) rack - rack-proxy (0.7.2) + rack-proxy (0.7.6) rack - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.0.5) - actioncable (= 6.0.5) - actionmailbox (= 6.0.5) - actionmailer (= 6.0.5) - actionpack (= 6.0.5) - actiontext (= 6.0.5) - actionview (= 6.0.5) - activejob (= 6.0.5) - activemodel (= 6.0.5) - activerecord (= 6.0.5) - activestorage (= 6.0.5) - activesupport (= 6.0.5) - bundler (>= 1.3.0) - railties (= 6.0.5) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.4) + actioncable (= 6.1.7.4) + actionmailbox (= 6.1.7.4) + actionmailer (= 6.1.7.4) + actionpack (= 6.1.7.4) + actiontext (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activemodel (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) + bundler (>= 1.15.0) + railties (= 6.1.7.4) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) + rails-html-sanitizer (1.4.3) loofah (~> 2.3) rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.5) - actionpack (= 6.0.5) - activesupport (= 6.0.5) + railties (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + rake (>= 12.2) + thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) ransack (2.4.2) @@ -586,28 +629,22 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rectify (0.13.0) - activemodel (>= 4.1.0) - activerecord (>= 4.1.0) - activesupport (>= 4.1.0) - virtus (~> 1.0.5) - wisper (>= 1.6.1) - redcarpet (3.5.1) - redis (4.6.0) + redcarpet (3.6.0) + redis (4.8.1) regexp_parser (2.4.0) request_store (1.5.1) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) rspec (3.11.0) rspec-core (~> 3.11.0) rspec-expectations (~> 3.11.0) rspec-mocks (~> 3.11.0) - rspec-cells (0.3.7) + rspec-cells (0.3.8) cells (>= 4.0.0, < 6.0.0) - rspec-rails (< 6.0) + rspec-rails (>= 3.0.0, < 6.1.0) rspec-core (3.11.0) rspec-support (~> 3.11.0) rspec-expectations (3.11.0) @@ -632,82 +669,92 @@ GEM rspec-support (3.11.0) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.92.0) + rubocop (1.28.2) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 0.5.0) + rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) + unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.18.0) parser (>= 3.1.1.0) rubocop-faker (1.1.0) faker (>= 2.12.0) rubocop (>= 0.82.0) - rubocop-rails (2.9.1) + rubocop-rails (2.15.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (1.43.2) - rubocop (~> 0.87) + rubocop (>= 1.7.0, < 2.0) + rubocop-rspec (2.11.1) + rubocop (~> 1.19) ruby-progressbar (1.11.0) ruby-vips (2.1.4) ffi (~> 1.12) ruby2_keywords (0.0.5) - rubyXL (3.4.23) + rubyXL (3.4.25) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - searchlight (4.1.0) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + selenium-webdriver (4.1.0) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) semantic_range (3.0.0) seven_zip_ruby (1.3.0) - simplecov (0.19.1) + simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov-cobertura (1.3.1) - simplecov (~> 0.8) + simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) smart_properties (1.17.0) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) social-share-button (1.2.4) coffee-rails spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.3) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - ssrf_filter (1.0.7) - system_test_html_screenshots (0.2.0) - actionpack (>= 5.2, < 6.1.a) - temple (0.8.2) + ssrf_filter (1.1.1) + temple (0.10.2) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.2.1) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.10) - tomlrb (2.0.1) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tilt (2.2.0) + timeout (0.4.0) + tomlrb (2.0.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uber (0.1.0) unicode-display_width (1.8.0) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) - virtus (1.0.5) + version_gem (1.1.3) + virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) - equalizer (~> 0.0, >= 0.0.9) w3c_rspec_validators (0.3.0) rails rspec @@ -723,7 +770,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.14.0) + webmock (3.18.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -732,28 +779,32 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) + webpush (1.1.0) + hkdf (~> 0.2) + jwt (~> 2.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked_pdf (2.6.2) + wicked_pdf (2.6.3) activesupport wisper (2.0.1) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.5) + wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.5.4) + zeitwerk (2.6.8) PLATFORMS + arm64-darwin-21 x86_64-linux DEPENDENCIES bootsnap (~> 1.4) byebug (~> 11.0) codecov - decidim (= 0.26.1) + decidim (= 0.27.3) decidim-civicrm! - decidim-dev (= 0.26.1) + decidim-dev (= 0.27.3) faker (~> 2.14) letter_opener_web (~> 1.3) listen (~> 3.1) @@ -764,7 +815,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 2.7.5p203 + ruby 3.0.2p107 BUNDLED WITH - 2.2.31 + 2.4.12 diff --git a/Rakefile b/Rakefile index 20bb216..00ba5d1 100644 --- a/Rakefile +++ b/Rakefile @@ -27,11 +27,26 @@ def seed_db(path) end end +# Temporary fix to overcome the issue with babel plugin updates, see: +# https://github.com/decidim/decidim/pull/10916 +def fix_babel_config(path) + Dir.chdir(path) do + babel_config = "#{Dir.pwd}/babel.config.json" + File.delete(babel_config) if File.exist?(babel_config) + FileUtils.cp("#{__dir__}/babel.config.json", Dir.pwd) + + # Temporary fix to overcome the issue with sass-embedded, see: + # https://github.com/decidim/decidim/pull/11074 + system("npm i sass-embedded@~1.62.0") + end +end + desc "Generates a dummy app for testing" task test_app: "decidim:generate_external_test_app" do ENV["RAILS_ENV"] = "test" install_initializer("spec/decidim_dummy_app", "test") install_module("spec/decidim_dummy_app") + fix_babel_config("spec/decidim_dummy_app") end desc "Generates a development app." @@ -50,5 +65,6 @@ task :development_app do install_initializer("development_app", "development") install_module("development_app") + fix_babel_config("development_app") seed_db("development_app") end diff --git a/app/commands/decidim/civicrm/admin/create_event_meeting.rb b/app/commands/decidim/civicrm/admin/create_event_meeting.rb index 6946b86..4e50a57 100644 --- a/app/commands/decidim/civicrm/admin/create_event_meeting.rb +++ b/app/commands/decidim/civicrm/admin/create_event_meeting.rb @@ -4,7 +4,7 @@ module Decidim module Civicrm module Admin # A command with all the business logic for when a user starts following a resource. - class CreateEventMeeting < Rectify::Command + class CreateEventMeeting < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/civicrm/admin/update_event_meeting.rb b/app/commands/decidim/civicrm/admin/update_event_meeting.rb index fbce702..fa60231 100644 --- a/app/commands/decidim/civicrm/admin/update_event_meeting.rb +++ b/app/commands/decidim/civicrm/admin/update_event_meeting.rb @@ -4,7 +4,7 @@ module Decidim module Civicrm module Admin # A command with all the business logic for when a user starts following a resource. - class UpdateEventMeeting < Rectify::Command + class UpdateEventMeeting < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/civicrm/sync_contact.rb b/app/commands/decidim/civicrm/sync_contact.rb index d03f82e..f073a87 100644 --- a/app/commands/decidim/civicrm/sync_contact.rb +++ b/app/commands/decidim/civicrm/sync_contact.rb @@ -2,7 +2,7 @@ module Decidim module Civicrm - class SyncContact < Rectify::Command + class SyncContact < Decidim::Command # Public: Initializes the command. # # form - A contact form diff --git a/app/models/decidim/civicrm/group.rb b/app/models/decidim/civicrm/group.rb index 3400a30..5d62602 100644 --- a/app/models/decidim/civicrm/group.rb +++ b/app/models/decidim/civicrm/group.rb @@ -20,10 +20,10 @@ def last_sync # returns a formatted list of all participatory spaces linked to this groups for automatic sync def participatory_spaces - group_participatory_spaces.map do |item| + group_participatory_spaces.to_h do |item| i18n_name = I18n.t("decidim.admin.menu.#{item.participatory_space.manifest.name}") ["#{item.participatory_space_type}.#{item.participatory_space_id}", "#{i18n_name}: #{translated_attribute(item.participatory_space.title)}"] - end.to_h + end end end end diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..3314d8d --- /dev/null +++ b/babel.config.json @@ -0,0 +1,25 @@ +{ + "presets": [ + [ + "@babel/preset-env", { + "forceAllTransforms": true, + "useBuiltIns": "entry", + "corejs": 3, + "modules": false + } + ], + ["@babel/preset-react"] + ], + "plugins": [ + "@babel/plugin-transform-classes", + [ + "@babel/plugin-transform-runtime", + { + "helpers": false, + "regenerator": true, + "corejs": false + } + ], + ["@babel/plugin-transform-regenerator", { "async": false }] + ] +} diff --git a/db/migrate/20210908095920_create_decidim_civicrm_contacts.rb b/db/migrate/20210908095920_create_decidim_civicrm_contacts.rb index 0b28cbb..1b35b62 100644 --- a/db/migrate/20210908095920_create_decidim_civicrm_contacts.rb +++ b/db/migrate/20210908095920_create_decidim_civicrm_contacts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmContacts < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_contacts do |t| @@ -12,7 +14,7 @@ def change t.timestamps - t.index ["decidim_organization_id", "civicrm_contact_id"], name: "index_unique_civicrm_contact_and_organization", unique: true + t.index %w(decidim_organization_id civicrm_contact_id), name: "index_unique_civicrm_contact_and_organization", unique: true end end end diff --git a/db/migrate/20210908095921_create_decidim_civicrm_groups.rb b/db/migrate/20210908095921_create_decidim_civicrm_groups.rb index 72697e4..466ca90 100644 --- a/db/migrate/20210908095921_create_decidim_civicrm_groups.rb +++ b/db/migrate/20210908095921_create_decidim_civicrm_groups.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmGroups < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_groups do |t| @@ -9,12 +11,11 @@ def change t.string :title t.string :description t.jsonb :extra, default: {} - t.boolean :marked_for_deletion, default: false t.boolean :auto_sync_members, default: false - t.index ["decidim_organization_id", "civicrm_group_id"], name: "index_unique_civicrm_group_and_organization", unique: true + t.index %w(decidim_organization_id civicrm_group_id), name: "index_unique_civicrm_group_and_organization", unique: true t.timestamps end end diff --git a/db/migrate/20210908095922_create_decidim_civicrm_group_memberships.rb b/db/migrate/20210908095922_create_decidim_civicrm_group_memberships.rb index b81025c..24c1813 100644 --- a/db/migrate/20210908095922_create_decidim_civicrm_group_memberships.rb +++ b/db/migrate/20210908095922_create_decidim_civicrm_group_memberships.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmGroupMemberships < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_group_memberships do |t| @@ -9,8 +11,7 @@ def change t.timestamps - t.index ["civicrm_contact_id", "group_id"], name: "index_unique_civicrm_membership_group_and_contact", unique: true + t.index %w(civicrm_contact_id group_id), name: "index_unique_civicrm_membership_group_and_contact", unique: true end end end - diff --git a/db/migrate/20210908095923_create_decidim_civicrm_membership_types.rb b/db/migrate/20210908095923_create_decidim_civicrm_membership_types.rb index 9f11bee..fdcb1ea 100644 --- a/db/migrate/20210908095923_create_decidim_civicrm_membership_types.rb +++ b/db/migrate/20210908095923_create_decidim_civicrm_membership_types.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmMembershipTypes < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_membership_types do |t| diff --git a/db/migrate/20211009165842_create_decidim_civicrm_group_participatory_spaces.rb b/db/migrate/20211009165842_create_decidim_civicrm_group_participatory_spaces.rb index cbc9013..c37b233 100644 --- a/db/migrate/20211009165842_create_decidim_civicrm_group_participatory_spaces.rb +++ b/db/migrate/20211009165842_create_decidim_civicrm_group_participatory_spaces.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmGroupParticipatorySpaces < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_group_participatory_spaces do |t| t.references :group, null: false, foreign_key: { to_table: :decidim_civicrm_groups }, index: { name: :index_civicrm_group_spaces_on_group_id } - t.references :participatory_space, null: false, polymorphic: true, index: true, index: { name: :index_civicrm_group_spaces_on_space_id } + t.references :participatory_space, null: false, polymorphic: true, index: { name: :index_civicrm_group_spaces_on_space_id } t.timestamps - t.index ["group_id", "participatory_space_type", "participatory_space_id"], name: "index_unique_civicrm_space_and_group", unique: true + t.index %w(group_id participatory_space_type participatory_space_id), name: "index_unique_civicrm_space_and_group", unique: true end end end diff --git a/db/migrate/20211025165842_create_decidim_civicrm_event_meetings.rb b/db/migrate/20211025165842_create_decidim_civicrm_event_meetings.rb index db3edcd..a8d853c 100644 --- a/db/migrate/20211025165842_create_decidim_civicrm_event_meetings.rb +++ b/db/migrate/20211025165842_create_decidim_civicrm_event_meetings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmEventMeetings < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_event_meetings do |t| diff --git a/db/migrate/20211027165842_create_decidim_civicrm_event_registrations.rb b/db/migrate/20211027165842_create_decidim_civicrm_event_registrations.rb index c1b4767..2e17e1f 100644 --- a/db/migrate/20211027165842_create_decidim_civicrm_event_registrations.rb +++ b/db/migrate/20211027165842_create_decidim_civicrm_event_registrations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateDecidimCivicrmEventRegistrations < ActiveRecord::Migration[5.2] def change create_table :decidim_civicrm_event_registrations do |t| diff --git a/db/migrate/20211126132120_add_membership_types_to_contacts.rb b/db/migrate/20211126132120_add_membership_types_to_contacts.rb index 5eb5aa9..66369f6 100644 --- a/db/migrate/20211126132120_add_membership_types_to_contacts.rb +++ b/db/migrate/20211126132120_add_membership_types_to_contacts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddMembershipTypesToContacts < ActiveRecord::Migration[5.2] def change add_column :decidim_civicrm_contacts, :membership_types, :jsonb diff --git a/db/seeds.rb b/db/seeds.rb index 9877696..365b2c6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -if !Rails.env.production? || ENV["SEED"] +if !Rails.env.production? || ENV.fetch("SEED", nil) print "Creating seeds for decidim_civicrm...\n" unless Rails.env.test? organization = Decidim::Organization.first diff --git a/decidim-civicrm.gemspec b/decidim-civicrm.gemspec index 79e9bcb..f8c71fd 100644 --- a/decidim-civicrm.gemspec +++ b/decidim-civicrm.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["vera@platoniq.net", "ivan@platoniq.net"] s.license = "AGPL-3.0" s.homepage = "https://github.com/Platoniq/decidim-module-decidim_civicrm" - s.required_ruby_version = ">= 2.7" + s.required_ruby_version = ">= 3.0" s.name = "decidim-civicrm" s.summary = "A Decidim module to connect with CiViCRM as OAUTH provider and perform verifications based on CiViCRM Contact attributes." diff --git a/lib/decidim/civicrm/api/find_contact.rb b/lib/decidim/civicrm/api/find_contact.rb index 576883d..3f45c15 100644 --- a/lib/decidim/civicrm/api/find_contact.rb +++ b/lib/decidim/civicrm/api/find_contact.rb @@ -6,9 +6,11 @@ module Api class FindContact < Base::FindQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Contact", - contact_id: id, - json: json_params(query || default_query) + { + entity: "Contact", + contact_id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/find_event.rb b/lib/decidim/civicrm/api/find_event.rb index d5e75c4..42eddf6 100644 --- a/lib/decidim/civicrm/api/find_event.rb +++ b/lib/decidim/civicrm/api/find_event.rb @@ -6,9 +6,11 @@ module Api class FindEvent < Base::FindQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Event", - id: id, - json: json_params(query || default_query) + { + entity: "Event", + id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/find_group.rb b/lib/decidim/civicrm/api/find_group.rb index 33cba9c..f768113 100644 --- a/lib/decidim/civicrm/api/find_group.rb +++ b/lib/decidim/civicrm/api/find_group.rb @@ -6,9 +6,11 @@ module Api class FindGroup < Base::FindQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Group", - group_id: id, - json: json_params(query || default_query) + { + entity: "Group", + group_id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/find_participant.rb b/lib/decidim/civicrm/api/find_participant.rb index 6c19ee6..2dc1af5 100644 --- a/lib/decidim/civicrm/api/find_participant.rb +++ b/lib/decidim/civicrm/api/find_participant.rb @@ -6,9 +6,11 @@ module Api class FindParticipant < Base::FindQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Participant", - id: id, - json: json_params(query || default_query) + { + entity: "Participant", + id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/find_user.rb b/lib/decidim/civicrm/api/find_user.rb index 2d3b624..95b01f4 100644 --- a/lib/decidim/civicrm/api/find_user.rb +++ b/lib/decidim/civicrm/api/find_user.rb @@ -6,9 +6,11 @@ module Api class FindUser < Base::FindQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "User", - id: id, - json: json_params(query || default_query) + { + entity: "User", + id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/list_contact_groups.rb b/lib/decidim/civicrm/api/list_contact_groups.rb index 4d6c435..7a828d0 100644 --- a/lib/decidim/civicrm/api/list_contact_groups.rb +++ b/lib/decidim/civicrm/api/list_contact_groups.rb @@ -6,9 +6,11 @@ module Api class ListContactGroups < Base::ListQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "GroupContact", - contact_id: id, - json: json_params(query || default_query) + { + entity: "GroupContact", + contact_id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/list_contact_memberships.rb b/lib/decidim/civicrm/api/list_contact_memberships.rb index c4f2bcd..72104f9 100644 --- a/lib/decidim/civicrm/api/list_contact_memberships.rb +++ b/lib/decidim/civicrm/api/list_contact_memberships.rb @@ -6,9 +6,11 @@ module Api class ListContactMemberships < Base::ListQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Membership", - contact_id: id, - json: json_params(query || default_query) + { + entity: "Membership", + contact_id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/list_contacts_in_group.rb b/lib/decidim/civicrm/api/list_contacts_in_group.rb index 8a40738..20f1210 100644 --- a/lib/decidim/civicrm/api/list_contacts_in_group.rb +++ b/lib/decidim/civicrm/api/list_contacts_in_group.rb @@ -6,9 +6,11 @@ module Api class ListContactsInGroup < Base::ListQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Contact", - group: id, - json: json_params(query || default_query) + { + entity: "Contact", + group: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/list_groups.rb b/lib/decidim/civicrm/api/list_groups.rb index 663f655..fba9f90 100644 --- a/lib/decidim/civicrm/api/list_groups.rb +++ b/lib/decidim/civicrm/api/list_groups.rb @@ -6,9 +6,11 @@ module Api class ListGroups < Base::ListQuery def initialize(query = nil) @request = Base::Request.get( - entity: "Group", - is_active: 1, - json: json_params(query || default_query) + { + entity: "Group", + is_active: 1, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/api/list_membership_types.rb b/lib/decidim/civicrm/api/list_membership_types.rb index 3199bba..a90b127 100644 --- a/lib/decidim/civicrm/api/list_membership_types.rb +++ b/lib/decidim/civicrm/api/list_membership_types.rb @@ -6,8 +6,10 @@ module Api class ListMembershipTypes < Base::ListQuery def initialize(query = nil) @request = Base::Request.get( - entity: "MembershipType", - json: json_params(query || default_query) + { + entity: "MembershipType", + json: json_params(query || default_query) + } ) store_result end diff --git a/lib/decidim/civicrm/api/participants_in_event.rb b/lib/decidim/civicrm/api/participants_in_event.rb index a684fd7..9884f6c 100644 --- a/lib/decidim/civicrm/api/participants_in_event.rb +++ b/lib/decidim/civicrm/api/participants_in_event.rb @@ -6,9 +6,11 @@ module Api class ParticipantsInEvent < Base::ListQuery def initialize(id, query = nil) @request = Base::Request.get( - entity: "Participant", - event_id: id, - json: json_params(query || default_query) + { + entity: "Participant", + event_id: id, + json: json_params(query || default_query) + } ) store_result diff --git a/lib/decidim/civicrm/event_parsers/event_registration_parser.rb b/lib/decidim/civicrm/event_parsers/event_registration_parser.rb index dbf0078..677c72a 100644 --- a/lib/decidim/civicrm/event_parsers/event_registration_parser.rb +++ b/lib/decidim/civicrm/event_parsers/event_registration_parser.rb @@ -15,8 +15,8 @@ def initialize(registration) def json { - "event_id": event.civicrm_event_id, - "contact_id": contact_id + event_id: event.civicrm_event_id, + contact_id: contact_id } end diff --git a/lib/decidim/civicrm/verifications/groups_action_authorizer.rb b/lib/decidim/civicrm/verifications/groups_action_authorizer.rb index df039cc..f2b66e2 100644 --- a/lib/decidim/civicrm/verifications/groups_action_authorizer.rb +++ b/lib/decidim/civicrm/verifications/groups_action_authorizer.rb @@ -9,7 +9,7 @@ def authorize status_code = :unauthorized - return [status_code, { fields: { "groups": "..." } }] if authorization_groups.blank? + return [status_code, { fields: { groups: "..." } }] if authorization_groups.blank? return [:ok, {}] if belongs_to_group? [status_code, {}] diff --git a/lib/decidim/civicrm/verifications/membership_types_action_authorizer.rb b/lib/decidim/civicrm/verifications/membership_types_action_authorizer.rb index a0ed783..e8e566c 100644 --- a/lib/decidim/civicrm/verifications/membership_types_action_authorizer.rb +++ b/lib/decidim/civicrm/verifications/membership_types_action_authorizer.rb @@ -9,7 +9,7 @@ def authorize status_code = :unauthorized - return [status_code, { fields: { "membership_types": "..." } }] if authorization_membership_types.blank? + return [status_code, { fields: { membership_types: "..." } }] if authorization_membership_types.blank? return [:ok, {}] if belongs_to_membership_type? [status_code, {}] diff --git a/lib/decidim/civicrm/version.rb b/lib/decidim/civicrm/version.rb index 964f63a..2f2b7d7 100644 --- a/lib/decidim/civicrm/version.rb +++ b/lib/decidim/civicrm/version.rb @@ -3,8 +3,8 @@ module Decidim # This holds the decidim-civicrm version. module Civicrm - DECIDIM_VERSION = "0.26.1" - COMPAT_DECIDIM_VERSION = ">= 0.26.1, < 0.27" - VERSION = "0.5" + DECIDIM_VERSION = "0.27.3" + COMPAT_DECIDIM_VERSION = ">= 0.27.0, < 0.28" + VERSION = "0.6" end end diff --git a/lib/generators/decidim/civicrm/templates/development_civicrm_config.rb b/lib/generators/decidim/civicrm/templates/development_civicrm_config.rb index 288e9cf..4c615dc 100644 --- a/lib/generators/decidim/civicrm/templates/development_civicrm_config.rb +++ b/lib/generators/decidim/civicrm/templates/development_civicrm_config.rb @@ -4,17 +4,17 @@ Decidim::Civicrm.configure do |config| # Configure api credentials config.api = { - key: ENV["CIVICRM_VERIFICATION_API_KEY"], - secret: ENV["CIVICRM_VERIFICATION_SECRET"], - url: ENV["CIVICRM_VERIFICATION_URL"] + key: ENV.fetch("CIVICRM_VERIFICATION_API_KEY", nil), + secret: ENV.fetch("CIVICRM_VERIFICATION_SECRET", nil), + url: ENV.fetch("CIVICRM_VERIFICATION_URL", nil) } # Configure omniauth secrets config.omniauth = { enabled: true, - client_id: ENV["CIVICRM_CLIENT_ID"], - client_secret: ENV["CIVICRM_CLIENT_SECRET"], - site: ENV["CIVICRM_SITE"] + client_id: ENV.fetch("CIVICRM_CLIENT_ID", nil), + client_secret: ENV.fetch("CIVICRM_CLIENT_SECRET", nil), + site: ENV.fetch("CIVICRM_SITE", nil) } Rails.application.secrets[:omniauth][:civicrm] = config.omniauth diff --git a/package-lock.json b/package-lock.json index 5db0186..5135330 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { - "name": "decidim-module-notify", - "version": "1.1.0", + "name": "decidim-module-civicrm", + "version": "0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "decidim-module-notify", - "version": "1.1.0", + "name": "decidim-module-civicrm", + "version": "0.5", "license": "AGPL-3.0-or-later", "devDependencies": { - "eslint": "^7.25.0", + "eslint": "^7.32.0", "eslint-config-prettier": "^8.2.0", "eslint-config-standard": "^11.0.0", "eslint-plugin-import": "^2.22.0", diff --git a/package.json b/package.json index b8f1cf6..d8129ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "decidim-module-civicrm", - "version": "0.4", + "version": "0.5", "description": "A CiViCRM integration with Decidim", "scripts": { "lint": "eslint -c .eslintrc.json --ext .js app/packs/", @@ -190,7 +190,6 @@ }, "devDependencies": { "eslint": "^7.32.0", - "eslint": "^7.25.0", "eslint-config-prettier": "^8.2.0", "eslint-config-standard": "^11.0.0", "eslint-plugin-import": "^2.22.0", diff --git a/spec/commands/join_meeting_spec.rb b/spec/commands/join_meeting_spec.rb index 0d9a6ff..9d0b0a8 100644 --- a/spec/commands/join_meeting_spec.rb +++ b/spec/commands/join_meeting_spec.rb @@ -17,7 +17,7 @@ module Decidim::Meetings questionnaire: nil) end - let(:user) { create :user, :confirmed, organization: organization, email_on_notification: false } + let(:user) { create :user, :confirmed, organization: organization, notifications_sending_frequency: "real_time" } let(:registration_form) { Decidim::Meetings::JoinMeetingForm.new } context "when everything is ok" do @@ -28,8 +28,9 @@ module Decidim::Meetings it "sends an email confirming the registration" do perform_enqueued_jobs { subject.call } - email = last_email - email_body = last_email_body + expect(ActionMailer::Base.deliveries.count).to eq(2) + email = emails.first + email_body = email_body(emails.first) last_registration = Registration.last expect(email.subject).to include("confirmed") expect(email_body).to include(last_registration.code) @@ -53,8 +54,7 @@ module Decidim::Meetings it "do not send an email confirming the registration" do perform_enqueued_jobs { subject.call } - expect(last_email).to be_nil - expect(last_email_body).to be_nil + expect(ActionMailer::Base.deliveries.count).to eq(1) end end end diff --git a/spec/controllers/admin/meetings_controller_spec.rb b/spec/controllers/admin/meetings_controller_spec.rb index 167a2e9..3a879e0 100644 --- a/spec/controllers/admin/meetings_controller_spec.rb +++ b/spec/controllers/admin/meetings_controller_spec.rb @@ -34,7 +34,7 @@ module Admin it "creates redirects back" do post :create, params: params - expect(response).to redirect_to(meetings_path) + expect(response).to redirect_to("/admin/civicrm/meetings") end it "creates a new event meeting" do @@ -45,7 +45,7 @@ module Admin let(:decidim_meeting_id) { nil } it "do not create a new event meeting" do - expect { post(:create, params: params) }.to change(EventMeeting, :count).by(0) + expect { post(:create, params: params) }.not_to change(EventMeeting, :count) end end end @@ -76,11 +76,11 @@ module Admin it "toggles" do put :toggle_active, params: { id: event_meeting.id } - expect(event_meeting.reload.redirect_active).to eq(true) + expect(event_meeting.reload.redirect_active).to be(true) put :toggle_active, params: { id: event_meeting.id } - expect(event_meeting.reload.redirect_active).to eq(false) + expect(event_meeting.reload.redirect_active).to be(false) end end end diff --git a/spec/lib/civicrm_spec.rb b/spec/lib/civicrm_spec.rb index 70cb4e2..dccd1fc 100644 --- a/spec/lib/civicrm_spec.rb +++ b/spec/lib/civicrm_spec.rb @@ -3,9 +3,9 @@ module Decidim describe Civicrm do it "has a version number" do - expect(Decidim::Civicrm::VERSION).not_to be nil - expect(Decidim::Civicrm::DECIDIM_VERSION).not_to be nil - expect(Decidim::Civicrm::COMPAT_DECIDIM_VERSION).not_to be nil + expect(Decidim::Civicrm::VERSION).not_to be_nil + expect(Decidim::Civicrm::DECIDIM_VERSION).not_to be_nil + expect(Decidim::Civicrm::COMPAT_DECIDIM_VERSION).not_to be_nil end end end diff --git a/spec/lib/event_parsers/event_base_parser_spec.rb b/spec/lib/event_parsers/event_base_parser_spec.rb index 458145b..41fbb36 100644 --- a/spec/lib/event_parsers/event_base_parser_spec.rb +++ b/spec/lib/event_parsers/event_base_parser_spec.rb @@ -13,7 +13,7 @@ module Decidim::Civicrm end it "is invalid" do - expect(subject.valid?).to eq(false) + expect(subject.valid?).to be(false) end end end diff --git a/spec/lib/event_parsers/event_meeting_parser_spec.rb b/spec/lib/event_parsers/event_meeting_parser_spec.rb index addf76d..0b9429f 100644 --- a/spec/lib/event_parsers/event_meeting_parser_spec.rb +++ b/spec/lib/event_parsers/event_meeting_parser_spec.rb @@ -43,7 +43,7 @@ module Decidim::Civicrm end it "is valid" do - expect(subject.valid?).to eq(true) + expect(subject.valid?).to be(true) end it "returns data" do diff --git a/spec/lib/event_parsers/event_registration_parser_spec.rb b/spec/lib/event_parsers/event_registration_parser_spec.rb index 55b7156..722d8fa 100644 --- a/spec/lib/event_parsers/event_registration_parser_spec.rb +++ b/spec/lib/event_parsers/event_registration_parser_spec.rb @@ -42,7 +42,7 @@ module Decidim::Civicrm end it "is valid" do - expect(subject.valid?).to eq(true) + expect(subject.valid?).to be(true) end it "returns data" do @@ -71,7 +71,7 @@ module Decidim::Civicrm let(:contact_id) { nil } it "is invalid" do - expect(subject.valid?).to eq(false) + expect(subject.valid?).to be(false) end end end diff --git a/spec/lib/overrides_spec.rb b/spec/lib/overrides_spec.rb index 7a44860..1aea5e9 100644 --- a/spec/lib/overrides_spec.rb +++ b/spec/lib/overrides_spec.rb @@ -9,20 +9,20 @@ { package: "decidim-core", files: { - "/app/commands/decidim/create_omniauth_registration.rb" => "10fc028fa6a7bef9936e6f9edb9b167b" + "/app/commands/decidim/create_omniauth_registration.rb" => "3b5ea20858cc445b85952999025dae2a" } }, { package: "decidim-admin", files: { - "/app/controllers/decidim/admin/resource_permissions_controller.rb" => "689b3ae4ec504b98566461b805cba176" + "/app/controllers/decidim/admin/resource_permissions_controller.rb" => "f3a204b0f85cc18556aadaa26ee68dc7" } }, { package: "decidim-meetings", files: { "/app/controllers/decidim/meetings/registrations_controller.rb" => "77274bb241d55cd570f563f967843a72", - "/app/commands/decidim/meetings/join_meeting.rb" => "2465c6921c02ba517269e45cee2c53ae" + "/app/commands/decidim/meetings/join_meeting.rb" => "58c65f8451ab82639249ea8401838ab0" } } ] From fcfe186e5ff56d9fb7d58b5754c4bff66db075c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20Mu=C3=B1oz?= Date: Mon, 31 Jul 2023 12:25:43 +0200 Subject: [PATCH 4/4] Use menu.add_item instead of menu.item (#33) * Use menu.add_item instead of menu.item * Fix linter errors * Add uri --- lib/decidim/civicrm/admin_engine.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/decidim/civicrm/admin_engine.rb b/lib/decidim/civicrm/admin_engine.rb index ac4b845..41d786e 100644 --- a/lib/decidim/civicrm/admin_engine.rb +++ b/lib/decidim/civicrm/admin_engine.rb @@ -46,12 +46,13 @@ class AdminEngine < ::Rails::Engine initializer "decidim.civicrm.admin_menu" do Decidim.menu :admin_menu do |menu| - menu.item I18n.t("menu.civicrm", scope: "decidim.admin", default: "CiViCRM"), - decidim_civicrm_admin.groups_path, - icon_name: "people", - position: 5.75, - active: is_active_link?(decidim_civicrm_admin.groups_path, :inclusive), - if: defined?(current_user) && current_user&.read_attribute("admin") + menu.add_item :civicrm, + I18n.t("menu.civicrm", scope: "decidim.admin", default: "CiViCRM"), + decidim_civicrm_admin.groups_path, + icon_name: "people", + position: 5.75, + active: is_active_link?(decidim_civicrm_admin.groups_path, :inclusive), + if: defined?(current_user) && current_user&.read_attribute("admin") end end