Skip to content

Commit

Permalink
Merge branch 'develop' into feature/admin_answers_close_comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ElviaBth committed Aug 13, 2024
2 parents 797ccf2 + 378a1e6 commit f3b7c87
Show file tree
Hide file tree
Showing 274 changed files with 5,608 additions and 545 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ AGPL
Ajuntament
Ajuntamentde
alabs
amd
amendables
AMR
andreslucena
Expand Down Expand Up @@ -866,6 +867,8 @@ tableize
tagsinput
tailwindcss
tarekraafat
taxonomizable
taxonomization
technopolitical
templatable
templateable
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/test_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ on:
required: false
default: true
type: boolean
chrome_version:
description: 'Chrome & Chromedriver version'
required: false
default: "126.0.6478.182"
type: string

jobs:
build_app:
Expand Down Expand Up @@ -78,7 +83,14 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
- run: |
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${{inputs.chrome_version}}-1_amd64.deb
sudo dpkg -i /tmp/chrome.deb
rm /tmp/chrome.deb
name: Install Chrome version ${{inputs.chrome_version}}
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{inputs.chrome_version}}
- uses: actions/cache@v4
id: app-cache
with:
Expand Down Expand Up @@ -122,3 +134,4 @@ jobs:
name: screenshots
path: ./spec/decidim_dummy_app/tmp/screenshots
if-no-files-found: ignore
overwrite: true
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ end
group :development do
gem "letter_opener_web", "~> 2.0"
gem "listen", "~> 3.1"
gem "spring", "~> 4.0"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.2"
end
6 changes: 2 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ PATH
decidim-sortitions (= 0.30.0.dev)
decidim-surveys (= 0.30.0.dev)
decidim-system (= 0.30.0.dev)
decidim-templates (= 0.30.0.dev)
decidim-verifications (= 0.30.0.dev)
decidim-accountability (0.30.0.dev)
decidim-comments (= 0.30.0.dev)
Expand Down Expand Up @@ -143,6 +142,8 @@ PATH
selenium-webdriver (~> 4.9)
simplecov (~> 0.22.0)
simplecov-cobertura (~> 2.1.0)
spring (~> 4.0)
spring-watcher-listen (~> 2.0)
w3c_rspec_validators (~> 0.3.0)
webmock (~> 3.18)
wisper-rspec (~> 1.0)
Expand Down Expand Up @@ -190,7 +191,6 @@ PATH
decidim-templates (0.30.0.dev)
decidim-core (= 0.30.0.dev)
decidim-forms (= 0.30.0.dev)
decidim-proposals (= 0.30.0.dev)
decidim-verifications (0.30.0.dev)
decidim-core (= 0.30.0.dev)

Expand Down Expand Up @@ -810,8 +810,6 @@ DEPENDENCIES
listen (~> 3.1)
parallel_tests (~> 4.2)
puma (>= 6.3.1)
spring (~> 4.0)
spring-watcher-listen (~> 2.0)
web-console (~> 4.2)

RUBY VERSION
Expand Down
29 changes: 27 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gem "decidim-dev", github: "decidim/decidim"

```console
sudo apt install p7zip # or the alternative installation process for your operating system. See "2.1. 7zip dependency introduction"
bundle remove spring spring-watcher-listen
bundle update decidim
bin/rails decidim:upgrade
bin/rails db:migrate
Expand All @@ -42,7 +43,19 @@ You can read more about this change on PR [#13185](https://github.com/decidim/de

These are one time actions that need to be done after the code is updated in the production database.

### 3.1. [[TITLE OF THE ACTION]]
### 3.1. Remove spring and spring-watcher-listen from your Gemfile

To simplify the upgrade process, we have decided to add `spring` and `spring-watcher-listener` as hard dependencies of `decidim-dev`.

Before upgrading to this version, make sure you run in your console:

```bash
bundle remove spring spring-watcher-listen
```

You can read more about this change on PR [#13235](https://github.com/decidim/decidim/pull/13235).

### 3.2. [[TITLE OF THE ACTION]]

You can read more about this change on PR [#XXXX](https://github.com/decidim/decidim/pull/XXXX).

Expand All @@ -61,7 +74,19 @@ You can read more about this change on PR [#XXXX](https://github.com/decidim/dec

## 5. Changes in APIs

### 5.1. [[TITLE OF THE CHANGE]]
### 5.1. Decidim version number no longer disclosed through the GraphQL API by default

In previous Decidim versions, you could request the running Decidim version through the following API query against the GraphQL API:

```graphql
query { decidim { version } }
```

This no longer returns the running Decidim version by default and instead it will result to `null` being reported as the version number.

If you would like to re-enable exposing the Decidim version number through the GraphQL API, you may do so by setting the `DECIDIM_API_DISCLOSE_SYSTEM_VERSION` environment variable to `true`. However, this is highly discouraged but may be required for some automation or integrations.

### 5.2. [[TITLE OF THE CHANGE]]

In order to [[REASONING (e.g. improve the maintenance of the code base)]] we have changed...

Expand Down
13 changes: 0 additions & 13 deletions decidim-admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ There are some pages that exist by default and cannot be deleted since there
are links to them inside the Decidim framework, see `Decidim::StaticPage` for
the default list.

### Pager Configuration

The number of results shown per page and per page range can be configured in the app `decidim.rb` initializer as follows:

```ruby
Decidim::Admin.configure do |config|
config.per_page_range = [15, 50, 100]
end
```

* `Decidim::Admin.per_page_range.first` sets the `default_per_page` value for `Decidim::Admin` (in Kaminari)
* `Decidim::Admin.per_page_range.last` sets the `max_per_page` value for `Decidim::Admin` (in Kaminari)

## Contributing

See [Decidim](https://github.com/decidim/decidim).
Expand Down
23 changes: 23 additions & 0 deletions decidim-admin/app/commands/decidim/admin/create_taxonomy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Decidim
module Admin
# A command with all the business logic to create a taxonomy.
# This command is called from the controller.
class CreateTaxonomy < Decidim::Commands::CreateResource
fetch_form_attributes :name, :organization, :parent_id

protected

def resource_class = Decidim::Taxonomy

def extra_params
{
extra: {
parent_name: form.try(:parent).try(:name)
}
}
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class DestroyComponent < Decidim::Commands::DestroyResource
private

def run_before_hooks
Decidim::Reminder.where(component: resource).destroy_all
resource.manifest.run_hooks(:before_destroy, resource)
end

Expand Down
18 changes: 18 additions & 0 deletions decidim-admin/app/commands/decidim/admin/destroy_taxonomy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module Decidim
module Admin
# A command with all the business logic to destroy a taxonomy.
class DestroyTaxonomy < Decidim::Commands::DestroyResource
private

def extra_params
{
extra: {
parent_name: resource.parent.try(:name)
}
}
end
end
end
end
76 changes: 76 additions & 0 deletions decidim-admin/app/commands/decidim/admin/reorder_taxonomies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# frozen_string_literal: true

module Decidim
module Admin
# A command that reorders a collection of taxonomies
# the ones that might be missing.
class ReorderTaxonomies < Decidim::Command
# Public: Initializes the command.
#
# organization - the Organization where the content blocks reside
# order - an Array holding the order of IDs of published content blocks.
def initialize(organization, order, offset = 0)
@organization = organization
@order = order
@offset = offset
end

# Executes the command. Broadcasts these events:
#
# - :ok when everything is valid.
# - :invalid if the data was not valid and we could not proceed.
#
# Returns nothing.
def call
return broadcast(:invalid) if order.blank?
return broadcast(:invalid) if collection.empty?

reorder_steps
broadcast(:ok)
end

private

attr_reader :organization, :offset

def reorder_steps
transaction do
reset_weights
collection.reload
set_new_weights
end
end

def reset_weights
# rubocop:disable Rails/SkipsModelValidations
collection.where.not(weight: nil).where(id: order).update_all(weight: nil)
# rubocop:enable Rails/SkipsModelValidations
end

def set_new_weights
data = order.each_with_index.inject({}) do |hash, (id, index)|
hash.update(id => index + 1 + offset)
end

data.each do |id, weight|
item = collection.find_by(id:)
item.update!(weight:) if item.present?
end
end

def order
return nil unless @order.is_a?(Array) && @order.present?

@order
end

def collection
@collection ||= Decidim::Taxonomy.where(organization:, parent_id: first_item.parent_id)
end

def first_item
@first_item ||= Decidim::Taxonomy.where(organization:).find(order.first)
end
end
end
end
20 changes: 20 additions & 0 deletions decidim-admin/app/commands/decidim/admin/update_taxonomy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

module Decidim
module Admin
# A command to update a taxonomy.
class UpdateTaxonomy < Decidim::Commands::UpdateResource
fetch_form_attributes :name, :parent_id

protected

def extra_params
{
extra: {
parent_name: resource.parent.try(:name)
}
}
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Filterable
extend ActiveSupport::Concern

included do
include Decidim::Admin::Paginable
include Decidim::Paginable
include Decidim::TranslatableAttributes

helper Decidim::Admin::FilterableHelper
Expand Down
20 changes: 0 additions & 20 deletions decidim-admin/app/controllers/concerns/decidim/admin/paginable.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require "active_support/concern"

module Decidim
module Admin
module Taxonomies
module Filterable
extend ActiveSupport::Concern

included do
include Decidim::Admin::Filterable

private

def base_query
collection
end

def search_field_predicate
:name_or_children_name_cont
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

require "active_support/concern"

module Decidim
module Admin
module VerificationConflicts
module Filterable
extend ActiveSupport::Concern

included do
include Decidim::Admin::Filterable

private

def base_query
collection
end

def search_field_predicate
:current_user_name_or_current_user_nickname_or_current_user_email_cont
end

def filters
[]
end
end
end
end
end
end
Loading

0 comments on commit f3b7c87

Please sign in to comment.