Skip to content

Commit

Permalink
fix: Hound issues v1
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaudouinjr committed Sep 12, 2020
1 parent c3d44f0 commit 19f1926
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/manage/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def logged_in
end

def require_director
return redirect_to manage_root_path if current_user.staff? unless current_user.try(:director?)
return redirect_to manage_root_path unless !current_user.staff? || current_user.try(:director?)
return redirect_to root_path unless current_user.try(:director?)
end

def require_director_or_organizer
return redirect_to manage_root_path if current_user.staff? unless current_user.try(:director?) || current_user.try(:organizer?)
return redirect_to manage_root_path unless !current_user.staff? || current_user.try(:director?) || current_user.try(:organizer?)
return redirect_to root_path unless current_user.try(:director?) || current_user.try(:organizer?)
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def full_name
end

def staff?
self.director? || self.organizer? || self.volunteer?
director? || organizer? || volunteer?
end

def organizing_staff?
self.director? || self.organizer?
director? || organizer?
end

def self.from_omniauth(auth)
Expand Down
4 changes: 2 additions & 2 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class UserTest < ActiveSupport::TestCase
user = create(:user, role: :volunteer)
assert_equal true, user.staff?
end

should "report organizer as staff" do
user = create(:user, role: :organizer)
assert_equal true, user.staff?
Expand All @@ -112,7 +112,7 @@ class UserTest < ActiveSupport::TestCase
user = create(:user, role: :volunteer)
assert_equal false, user.organizing_staff?
end

should "report organizer as organizing staff" do
user = create(:user, role: :organizer)
assert_equal true, user.organizing_staff?
Expand Down

0 comments on commit 19f1926

Please sign in to comment.