Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[pull] develop from decidim:develop #160

Merged
merged 4 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/workflows/brakeman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- decidim-budgets
- decidim-comments
- decidim-conferences
- decidim-consultations
- decidim-core
- decidim-debates
- decidim-dev
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/ci_consultations.yml

This file was deleted.

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ruby RUBY_VERSION

gem "decidim", path: "."
gem "decidim-conferences", path: "."
gem "decidim-consultations", path: "."
gem "decidim-elections", path: "."
gem "decidim-initiatives", path: "."
gem "decidim-templates", path: "."
Expand Down
5 changes: 0 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ PATH
decidim-meetings (= 0.28.0.dev)
wicked_pdf (~> 2.1)
wkhtmltopdf-binary (~> 0.12)
decidim-consultations (0.28.0.dev)
decidim-admin (= 0.28.0.dev)
decidim-comments (= 0.28.0.dev)
decidim-core (= 0.28.0.dev)
decidim-core (0.28.0.dev)
active_link_to (~> 1.0)
acts_as_list (~> 1.0)
Expand Down Expand Up @@ -821,7 +817,6 @@ DEPENDENCIES
byebug (~> 11.0)
decidim!
decidim-conferences!
decidim-consultations!
decidim-dev!
decidim-elections!
decidim-initiatives!
Expand Down
41 changes: 38 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ You can read more about this change on PR [\#10288](https://github.com/decidim/d

## 2. General notes

## 2.1. Redesign

TBD

## 2.2. Consultation

The consultations module has been fully removed from this version, so if you're using it in your application you need to remove it from your Gemfile:

```console
bundle remove decidim-consultations
```

If you're not using it, then you don't need to do anything.

If you're maintaining a version of this module, please share the URL of the git repository by [creating an issue on the decidim.org website repository](https://github.com/decidim/decidim.org) so that we can update the [Modules page](https://decidim.org/modules).

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

## 3. One time actions

These are one time actions that need to be done after the code is updated in the production database.
Expand Down Expand Up @@ -118,6 +136,26 @@ bundle exec rake decidim:webpacker:install

This will make the necessary changes in the `config/webpacker.yml`, but also in the `config/webpack/` folder.

### 3.5. Initialize content blocks on spaces or resources with landing page

The processes and assemblies participatory spaces have changed the show page and now is composed using content blocks. For the new spaces created in this version a callback is executed creating the content blocks marked as `default!` in the engine for the corresponding homepage scope. To have the same initialization in the existing spaces there is a task to generate those blocks if not present already. Run the below command to generate default content blocks when not present for all spaces and resources with content blocks homepage (participatory processes, participatory process groups and assemblies):

```console
bundle exec rake decidim:content_blocks:initialize_default_content_blocks
```

The task has some optional arguments:

- The first to specify the manifest name and generate the default content blocks only on the spaces or resources with the manifest name (`participatory_processes`, `participatory_process_group` or `assemblies`).
- The second can be the id of a resource o space to apply only on the space or resource with the id. This argument is considered only if the manifest name argument is present.
- The last argument only works on participatory spaces (assemblies and participatory processes) and when set as true the task also creates a content block for each published component on the space unless a block already exists for that component or the block exists for the component type and configured to display resources from all components of the same type.

For example, to generate the default content blocks and also the components blocks on participatory spaces run the command with arguments:

```console
bundle exec rake decidim:content_blocks:initialize_default_content_blocks[,,true]
```

#### Note for development

If you are using the `Procfile.dev` file, you will need to make sure that you have the following line in your configuration. If you have not altered the `Procfile.dev` file, you will not need to do anything, as we covered that part:
Expand Down Expand Up @@ -299,8 +337,6 @@ The transferred data can differ between the different modules but the official m
- **decidim-comments**
- Comments
- Comment votes
- **decidim-consultations**
- Consultation votes
- **decidim-debates**
- Debates
- Endorsements for debates (through endorsement transfers at `decidim-core`)
Expand Down Expand Up @@ -381,7 +417,6 @@ module DecidimYourCity
Decidim::AuthorizationTransfer.unregister(:blogs) # blog posts
Decidim::AuthorizationTransfer.unregister(:budgets) # budgets
Decidim::AuthorizationTransfer.unregister(:comments) # comments
Decidim::AuthorizationTransfer.unregister(:consultations) # consultation votes
Decidim::AuthorizationTransfer.unregister(:debates) # debates
Decidim::AuthorizationTransfer.unregister(:elections) # elections
Decidim::AuthorizationTransfer.unregister(:forms) # form answers, e.g. survey form answers or meeting registrations
Expand Down
3 changes: 2 additions & 1 deletion bin/backporter
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class BackporterCLI < Thor
desc "", "Backport a pull request to another branch"
option :github_token, required: true, desc: <<~HELP
Required. Github Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
Alternatively, you can use the `gh` CLI tool to authenticate with `gh auth token` (i.e. --github-token=$(gh auth token))
HELP
option :version_number, required: true, desc: "Required. The version number that you want to do the backport to. It must have the format MAJOR.MINOR."
option :pull_request_id, required: true, desc: "Required. The ID of the pull request that you want to make the backport from. It should have the \"type: fix\" label."
Expand All @@ -27,7 +28,7 @@ class BackporterCLI < Thor
version_number: options[:version_number],
exit_with_unstaged_changes: options[:exit_with_unstaged_changes]
).call
rescue Decidim::Backporter::InvalidMetadataError
rescue Decidim::GithubManager::Querier::Base::InvalidMetadataError
puts "Metadata was not returned from the server. Please check that the provided pull request ID and GitHub token are correct."
end

Expand Down
48 changes: 48 additions & 0 deletions bin/backports_checker
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "thor"

require "./lib/decidim/git_backport_checker"

class BackportsCheckerCLI < Thor
desc "", <<~HELP
Backports checker. Shows the status of the pull requests opened in the last days

The output by default is for the terminal. It uses a color code to differentiate the status of the Pull Requests, following the colors of GitHub:
- \e[34mPurple\e[0m: closed with a merge
- \e[35mRed\e[0m: closed without being merge
- \e[32mGreen\e[0m: opened without being merge
HELP
option :github_token, required: true, desc: <<~HELP
Required. Github Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
Alternatively, you can use the `gh` CLI tool to authenticate with `gh auth token` (i.e. --github-token=$(gh auth token))
HELP
option :last_version_number, required: true, desc: <<~HELP
Required. The version number of the last supported version that you want to do the backports to. It must have the format MAJOR.MINOR.
HELP
option :days_to_check_from, required: false, default: 90, type: :numeric, desc: "How many days since the pull requests were merged we will check from."
default_task :backports_checker

def backports_checker
checker = Decidim::GitBackportChecker.new(
token: options[:github_token],
last_version_number: options[:last_version_number],
days_to_check_from: options[:days_to_check_from]
)
checker.call
puts checker.cli_report
rescue Decidim::GithubManager::Querier::Base::InvalidMetadataError
puts "Metadata was not returned from the server. Please check that the provided GitHub token is correct."
end

def help
super("backports_checker")
end

def self.exit_on_failure?
true
end
end

BackportsCheckerCLI.start(ARGV)
2 changes: 1 addition & 1 deletion bin/changelog_generator
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ChangeLogGenerator
id = get_pr_id(commit)
return nil unless id

Decidim::GithubManager::Querier.new(
Decidim::GithubManager::Querier::ByIssueId.new(
token: github_token,
issue_id: id
).call
Expand Down
5 changes: 0 additions & 5 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ ignore_unused:
- decidim.budgets.projects.filters.*
- decidim.sortitions.admin_log.*
- decidim.sortitions.sortitions.orders.*
- decidim.consultations.admin_log.*
- decidim.consultations.consultations.orders.*
- decidim.consultations.show.badge_name.*
- decidim.votings.admin_log.*
- decidim.votings.votings.filters.*
- decidim.votings.votings.orders.*
Expand Down Expand Up @@ -246,7 +243,6 @@ ignore_unused:
- decidim.participatory_process_groups.content_blocks.*.name
- decidim.assemblies.content_blocks.*.name
- decidim.initiatives.content_blocks.*.name
- decidim.consultations.content_blocks.*.name
- decidim.meetings.content_blocks.*.name
- decidim.votings.content_blocks.*.name
- decidim.blogs.content_blocks.*.name
Expand Down Expand Up @@ -364,7 +360,6 @@ ignore_unused:
- layouts.decidim.votings.promoted_voting.vote
- versions.directions.*
- layouts.decidim.conferences.conference.*
- decidim.consultations.show.footer_button_text.*
- decidim.admin.conflicts.*
- decidim.profiles.show.badges
- decidim.profiles.show.conversations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ def create

CreateComponent.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("components.create.success", scope: "decidim.admin")
if (landing_page_path = participatory_space_landing_page_path(@component)).present?
flash[:notice_html] = I18n.t("components.create.success_landing_page", landing_page_path:, scope: "decidim.admin").html_safe
else
flash[:notice] = I18n.t("components.create.success", scope: "decidim.admin")
end

redirect_to action: :index
end

Expand Down Expand Up @@ -168,6 +173,13 @@ def handle_component_settings_change(previous_settings, current_settings)
current_settings["default_step"] || {}
)
end

def participatory_space_landing_page_path(component)
participatory_space = component.participatory_space
return if participatory_space.manifest.content_blocks_scope_name.blank?

Decidim::EngineRouter.admin_proxy(participatory_space).send("edit_#{participatory_space.manifest.route_name}_landing_page_path")
end
end
end
end
1 change: 1 addition & 0 deletions decidim-admin/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ en:
create:
error: There was a problem creating this component.
success: Component created successfully.
success_landing_page: Component created successfully. You can add a content block for this component in the home of the space. Go to <a href="%{landing_page_path}">Landing page</a> to configure it.
destroy:
error: There was a problem destroying this component.
success: Component deleted successfully.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ def user_localized_body(user)
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down Expand Up @@ -200,9 +197,6 @@ def user_localized_body(user)
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down Expand Up @@ -257,9 +251,6 @@ def user_localized_body(user)
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down Expand Up @@ -303,9 +294,6 @@ def user_localized_body(user)
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down
3 changes: 0 additions & 3 deletions decidim-admin/spec/forms/selective_newsletter_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ module Admin
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down
3 changes: 1 addition & 2 deletions decidim-admin/spec/helpers/menu_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ module Admin

it "renders the default main menu" do
expect(default_main_menu).to \
have_selector("li", count: 14) &
have_selector("li", count: 13) &
have_link("Dashboard", href: "/admin/") &
have_link("Processes", href: "/admin/participatory_processes") &
have_link("Conferences", href: "/admin/conferences") &
have_link("Assemblies", href: "/admin/assemblies") &
have_link("Votings", href: "/admin/votings") &
have_link("Consultations", href: "/admin/consultations") &
have_link("Initiatives", href: "/admin/initiatives") &
have_link("Global moderation", href: "/admin/moderations") &
have_link("Pages", href: "/admin/static_pages") &
Expand Down
6 changes: 0 additions & 6 deletions decidim-admin/spec/queries/newsletter_recipients_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ module Decidim::Admin
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] }
Expand Down Expand Up @@ -105,9 +102,6 @@ module Decidim::Admin
{ "id" => nil,
"manifest_name" => "conferences",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "consultations",
"ids" => [] },
{ "id" => nil,
"manifest_name" => "initiatives",
"ids" => [] },
Expand Down
6 changes: 2 additions & 4 deletions decidim-admin/spec/system/admin_manages_newsletters_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "spec_helper"
%w(conferences initiatives consultations).each do |space|
%w(conferences initiatives).each do |space|
require "decidim/#{space}/test/factories.rb"
end

Expand Down Expand Up @@ -175,11 +175,9 @@
let!(:participatory_process) { create(:participatory_process, organization:) }
let!(:assembly) { create(:assembly, organization:) }
let!(:conference) { create(:conference, organization:) }
let!(:consultation) { create(:consultation, organization:) }
let(:question) { create(:question, :published, consultation:) }
let!(:initiative) { create(:initiative, organization:) }
let!(:newsletter) { create(:newsletter, organization:) }
let(:spaces) { [participatory_process, assembly, conference, consultation, initiative] }
let(:spaces) { [participatory_process, assembly, conference, initiative] }
let!(:component) { create(:dummy_component, participatory_space: participatory_process) }

def select_all
Expand Down
Loading
Loading