Skip to content

Commit

Permalink
Add private user admin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Sep 10, 2024
1 parent a4198a9 commit 84acf37
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Decidim
module Privacy
module Admin
module CreateParticipatorySpacePrivateUserExtensions
extend ActiveSupport::Concern

included do
private

def existing_user
return @existing_user if defined?(@existing_user)

@existing_user = Decidim::User.entire_collection.find_by(
email: form.email.downcase,
organization: private_user_to.organization
)

InviteUserAgain.call(@existing_user, invitation_instructions) if @existing_user&.invitation_pending?
@existing_user
end
end
end
end
end
end
3 changes: 3 additions & 0 deletions lib/decidim/privacy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class Engine < ::Rails::Engine
# The following changes are related to "Ask old password for changing email/password(PR #11737)"
# These changes should be removed once it has been backported to v.27
Decidim::UpdateAccount.include(Decidim::Privacy::UpdateAccountExtensions)
Decidim::Admin::CreateParticipatorySpacePrivateUser.include(
Decidim::Privacy::Admin::CreateParticipatorySpacePrivateUserExtensions
)

# controllers
Decidim::ApplicationController.include(
Expand Down

0 comments on commit 84acf37

Please sign in to comment.