Sha256: 84b6b6bd437c90724d1e52fb66651f328af7d9bd68f88f00e7ff2050021fb6a8

Contents?: true

Size: 993 Bytes

Versions: 58

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The controller to manage email confirmations for user groups.
  class GroupEmailConfirmationsController < Decidim::ApplicationController
    include FormFactory
    include UserGroups

    before_action :enforce_user_groups_enabled

    helper_method :user_group

    def create
      enforce_permission_to :manage, :user_group, user_group: user_group
      if user_group.email.blank?
        flash.keep[:alert] = t("decidim.profiles.user.fill_in_email_to_confirm_it")
        redirect_to(edit_group_path(user_group.nickname)) && return
      end

      user_group.send_confirmation_instructions

      flash.keep[:notice] = t("decidim.profiles.user.confirmation_instructions_sent")
      redirect_back(fallback_location: decidim.profile_path(user_group.nickname))
    end

    private

    def user_group
      @user_group ||= Decidim::UserGroups::ManageableUserGroups.for(current_user).find_by(nickname: params[:group_id])
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
decidim-core-0.23.3 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.23.2 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.23.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.23.1.rc1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.23.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.22.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.21.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.20.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.20.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.19.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.18.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.19.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.17.2 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.18.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.17.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.16.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.17.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.16.0 app/controllers/decidim/group_email_confirmations_controller.rb