-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require person_add_requests on all groups (#106)
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
app/controllers/jubla/group/person_add_requests_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
db/migrate/20250219083234_require_add_requests_on_all_groups.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
spec/controllers/group/person_add_requests_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |