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

Require person_add_requests on all groups (#106) #194

Merged
merged 1 commit into from
Feb 24, 2025
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
14 changes: 14 additions & 0 deletions app/controllers/jubla/group/person_add_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2012-2013, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

module Jubla::Group::PersonAddRequestsController
def activate
raise "shall never get called with jubla wagon"
end

def deactivate
raise "shall never get called with jubla wagon"
end
end
9 changes: 9 additions & 0 deletions app/views/group/person_add_requests/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-# Copyright (c) 2012-2013, Jungwacht Blauring Schweiz. This file is part of
-# hitobito_jubla and licensed under the Affero General Public License version 3
-# or later. See the COPYING file at the top-level directory or at
-# https://github.com/hitobito/hitobito_jubla.

= render 'list'

- if can?(:activate_person_add_requests, @group)
= render 'approvers'
10 changes: 10 additions & 0 deletions db/migrate/20250219083234_require_add_requests_on_all_groups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class RequireAddRequestsOnAllGroups < ActiveRecord::Migration[7.1]
def up
execute "UPDATE groups SET require_person_add_requests = TRUE"
change_column_default :groups, :require_person_add_requests, true
end

def down
change_column_default :groups, :require_person_add_requests, false
end
end
1 change: 1 addition & 0 deletions lib/hitobito_jubla/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Wagon < Rails::Engine

GroupsController.include Jubla::GroupsController
EventsController.include Jubla::EventsController
Group::PersonAddRequestsController.prepend Jubla::Group::PersonAddRequestsController
Event::ApplicationMarketController.include Jubla::Event::ApplicationMarketController
Event::QualificationsController.include Jubla::Event::QualificationsController
Event::RegisterController.include Jubla::Event::RegisterController
Expand Down
26 changes: 26 additions & 0 deletions spec/controllers/group/person_add_requests_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2012-2013, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

require "spec_helper"

describe Group::PersonAddRequestsController do
before { sign_in(people(:top_leader)) }

describe "#POST activate" do
it "raises" do
expect do
post :activate, params: { group_id: groups(:ch).id }
end.to raise_error "shall never get called with jubla wagon"
end
end

describe "#DELETE deactivate" do
it "raises" do
expect do
delete :deactivate, params: { group_id: groups(:ch).id }
end.to raise_error "shall never get called with jubla wagon"
end
end
end
Loading