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

Make omniauth idcat mobil compatible since Decidim 0.20 #5

Merged
merged 3 commits into from
Apr 28, 2020
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This project is in BETA, but going to be tested in production.

## next version:

## Version 0.0.5 (MINOR)
- Make gem compatible with Decidim v0.20 (tested against decidim v0.21)
- Remove initializer to force `Decidim::CurrentOrganization` to be executed before `Warden::Manager`. It is already done in Decidim since v0.16

## Version 0.0.4 (PATCH)
- Remove Gemfile.lock to avoid problems with apps using this gem and solving devise vulneravility: https://github.com/plataformatec/devise/issues/4981.

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ Omniauth's configuration is setted in `config/initializers/omniauth_idcat_mobil.

Refer to `omniauth-idcat_mobil` gem for further documentation.

## TODO
After decidim v0.16, remove from `lib/decidim/idcat_mobil/engine.rb:23` the `initializer "decidim.middleware"`.

## Contributing

See [Decidim](https://github.com/decidim/decidim).
Expand Down
2 changes: 0 additions & 2 deletions config/initializers/omniauth_idcat_mobil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
ENV["IDCAT_MOBIL_SITE_URL"],
scope: :autenticacio_usuari
end

Decidim::User.omniauth_providers << :idcat_mobil
2 changes: 1 addition & 1 deletion decidim-idcat_mobil.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,lib}/**/*", "LICENSE-AGPLv3.txt", "Rakefile", "README.md"]

s.add_dependency "omniauth-idcat_mobil", "~> 0.2.0"
DECIDIM_VERSION= ">= 0.13.1"
DECIDIM_VERSION= ">= 0.20.0"
s.add_dependency "decidim", DECIDIM_VERSION
s.add_dependency "decidim-core", DECIDIM_VERSION
s.add_development_dependency "decidim-dev", DECIDIM_VERSION
Expand Down
22 changes: 11 additions & 11 deletions lib/decidim/idcat_mobil/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class Engine < ::Rails::Engine
# root to: "idcat_mobil#index"
end

#
# Force `Decidim::CurrentOrganization` to be executed before `Warden::Manager` to avoid path generation problems.
# NOTE: Remove this initializer when in Decidim 0.16.0 where it has been fixed.
#
initializer "decidim.middleware" do |app|
# as `app.config.middleware` is just a proxy made available for configuration purposes
# and acts as a command recorder that executes deletes always at the end
# we can not remove and re-insert, but only duplicate `Decidim::CurrentOrganization`.
# app.config.middleware.delete Decidim::CurrentOrganization
app.config.middleware.insert_before Warden::Manager, Decidim::CurrentOrganization
end
# #
# # Force `Decidim::CurrentOrganization` to be executed before `Warden::Manager` to avoid path generation problems.
# # NOTE: Remove this initializer when in Decidim 0.16.0 where it has been fixed.
# #
# initializer "decidim.middleware" do |app|
# # as `app.config.middleware` is just a proxy made available for configuration purposes
# # and acts as a command recorder that executes deletes always at the end
# # we can not remove and re-insert, but only duplicate `Decidim::CurrentOrganization`.
# # app.config.middleware.delete Decidim::CurrentOrganization
# app.config.middleware.insert_before Warden::Manager, Decidim::CurrentOrganization
# end

# initializer "decidim_idcat_mobil.assets" do |app|
# app.config.assets.precompile += %w[decidim_idcat_mobil_manifest.js decidim_idcat_mobil_manifest.css]
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/idcat_mobil/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Decidim
module IdcatMobil
def self.version
# See CHANGELOG.md to see what changed
"0.0.4"
"0.0.5"
end
end
end