Skip to content

Commit

Permalink
Bump decidim-centers including roles and disabling scopes (#27)
Browse files Browse the repository at this point in the history
* Bump decidim-centers including roles and disabling scopes

* Add .node-version

* Change codecov with coveralls

* Fix sentry initializer

* Downgrade foundation-sites

* Bump decidim-centers from v0.2.0 to v0.2.1
  • Loading branch information
fblupi authored Dec 10, 2024
1 parent 160f933 commit 16ad1cc
Show file tree
Hide file tree
Showing 20 changed files with 9,331 additions and 69 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ jobs:
DATABASE_PASSWORD: postgres

- name: Run RSpec
run: CODECOV=1 bundle exec rspec
run: CI=1 bundle exec rspec
env:
RAILS_ENV: test
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.9.1
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem "decidim", DECIDIM_VERSION
# gem "decidim-initiatives", DECIDIM_VERSION
# gem "decidim-templates", DECIDIM_VERSION

gem "decidim-centers", "~> 0.1.0"
gem "decidim-centers", "~> 0.2.1"
gem "decidim-decidim_awesome", "~> 0.10.0"
gem "decidim-extra_user_fields", git: "https://github.com/Platoniq/decidim-module-extra_user_fields"
gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer"
Expand Down Expand Up @@ -64,6 +64,6 @@ group :production do
end

group :test do
gem "codecov", require: false
gem "coveralls_reborn", require: false
gem "database_cleaner"
end
21 changes: 16 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ GEM
html_tokenizer (~> 0.0.6)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.10.3)
msgpack (~> 1.2)
Expand Down Expand Up @@ -170,8 +171,6 @@ GEM
concurrent-ruby
childprocess (4.1.0)
chronic (0.10.2)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (5.0.0)
Expand All @@ -191,6 +190,11 @@ GEM
country_select (4.0.0)
countries (~> 3.0)
sort_alphabetical (~> 1.0)
coveralls_reborn (0.25.0)
simplecov (>= 0.18.1, < 0.22.0)
term-ansicolor (~> 1.6)
thor (>= 0.20.3, < 2.0)
tins (~> 1.16)
crack (0.4.5)
rexml
crass (1.0.6)
Expand Down Expand Up @@ -251,7 +255,7 @@ GEM
decidim-budgets (0.27.4)
decidim-comments (= 0.27.4)
decidim-core (= 0.27.4)
decidim-centers (0.1.1)
decidim-centers (0.2.1)
decidim-core (>= 0.27.0, < 0.28)
deface (~> 1.9)
decidim-comments (0.27.4)
Expand Down Expand Up @@ -839,13 +843,19 @@ GEM
sshkit-interactive (0.3.0)
sshkit (~> 1.12)
ssrf_filter (1.1.1)
sync (0.5.0)
temple (0.10.2)
term-ansicolor (1.11.2)
tins (~> 1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.2.0)
timeout (0.4.0)
tins (1.37.0)
bigdecimal
sync
tomlrb (2.0.3)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -905,6 +915,7 @@ PLATFORMS
arm64-darwin-21
arm64-darwin-22
arm64-darwin-23
arm64-darwin-24
x86_64-linux

DEPENDENCIES
Expand All @@ -918,10 +929,10 @@ DEPENDENCIES
capistrano-rails-console
capistrano-rbenv
capistrano-sidekiq
codecov
coveralls_reborn
database_cleaner
decidim (= 0.27.4)
decidim-centers (~> 0.1.0)
decidim-centers (~> 0.2.1)
decidim-decidim_awesome (~> 0.10.0)
decidim-dev (= 0.27.4)
decidim-extra_user_fields!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![[CI] Lint](https://github.com/Platoniq/participa-aneca/actions/workflows/lint.yml/badge.svg)](https://github.com/Platoniq/participa-aneca/actions/workflows/lint.yml)
[![[CI] Test](https://github.com/Platoniq/participa-aneca/actions/workflows/test.yml/badge.svg)](https://github.com/Platoniq/participa-aneca/actions/workflows/test.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/57cd5b8ca8064dfff86c/maintainability)](https://codeclimate.com/github/Platoniq/participa-aneca/maintainability)
[![codecov](https://codecov.io/gh/Platoniq/participa-aneca/branch/main/graph/badge.svg)](https://codecov.io/gh/Platoniq/participa-aneca)
[![Coverage Status](https://coveralls.io/repos/github/Platoniq/participa-aneca/badge.svg?branch=main)](https://coveralls.io/github/Platoniq/participa-aneca?branch=main)

Free Open-Source participatory democracy, citizen participation and open government for cities and organizations

Expand Down
1 change: 1 addition & 0 deletions app/forms/concerns/decidim/account_form_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def map_model(model)

def map_model_centers(model)
self.center_id = model.center.try(:id)
self.role_id = model.center_role.try(:id)
self.scope_id = model.scope.try(:id)
end

Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ default: &default

development:
<<: *default
database: participa_aneca_development
database: <%= ENV.fetch("DATABASE_NAME") { "participa_aneca_development" } %>

# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
Expand Down
5 changes: 5 additions & 0 deletions config/initializers/decidim_centers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

Decidim::Centers.configure do |config|
config.scopes_enabled = false
end
4 changes: 2 additions & 2 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

if Rails.application.secrets.sentry_enabled
if ENV["SENTRY_DSN"]
Sentry.init do |config|
config.dsn = ENV.fetch("SENTRY_DSN")
config.dsn = ENV.fetch("SENTRY_DSN", nil)
config.breadcrumbs_logger = [:active_support_logger, :http_logger]

# Set traces_sample_rate to 1.0 to capture 100%
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
# This migration comes from decidim_centers (originally 20241204134913)

class CreateDecidimCentersRoles < ActiveRecord::Migration[6.1]
def change
create_table :decidim_centers_roles do |t|
t.references :decidim_organization, foreign_key: true, index: true
t.jsonb :title, null: false
t.datetime :deleted_at

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true
# This migration comes from decidim_centers (originally 20241204135138)

class CreateDecidimCentersRoleUsers < ActiveRecord::Migration[6.1]
def change
create_table :decidim_centers_role_users do |t|
t.references :decidim_centers_role, foreign_key: true, index: { name: "index_decidim_role_users_on_decidim_role_id" }
t.references :decidim_user, foreign_key: true, index: { name: "index_decidim_role_users_on_decidim_user_id" }

t.timestamps
end
end
end
23 changes: 22 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Decidim.seed!

centers = JSON.parse(File.read(Rails.root.join("examples/centers.json")))
roles = JSON.parse(File.read(Rails.root.join("examples/roles.json")))
scopes = JSON.parse(File.read(Rails.root.join("examples/scopes.json")))
organization = Decidim::Organization.first

Expand All @@ -19,6 +20,10 @@
Decidim::Centers::Center.create(title: Decidim.available_locales.to_h { |locale| [locale, center_name] }, organization: organization)
end

roles.each do |role_name|
Decidim::Centers::Role.create(title: Decidim.available_locales.to_h { |locale| [locale, role_name] }, organization: organization)
end

Decidim::Scope.delete_all
scopes.pluck("children").flatten.each do |scope|
Decidim::Scope.create(name: Decidim.available_locales.to_h { |locale| [locale, "#{scope["code"]}. #{scope["name"]}"] }, code: scope["code"], organization: organization)
Expand Down
4 changes: 4 additions & 0 deletions examples/roles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"Profesorado",
"Estudiante"
]
Loading

0 comments on commit 16ad1cc

Please sign in to comment.