Skip to content

Commit

Permalink
Merge pull request #1108 from concord-consortium/fix-glossary-edit-link
Browse files Browse the repository at this point in the history
fix: user.project_admin_of? with nil project
  • Loading branch information
dougmartin authored Dec 6, 2023
2 parents fd12ef3 + e8d6c4c commit cd33614
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def is_project_admin?()
end

def project_admin_of?(project)
project && admined_projects.any? {|ap| ap.id == project.id }
!!(project && admined_projects.any? {|ap| ap.id == project.id })
end

def most_recent_authentication
Expand Down
1 change: 1 addition & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@
expect(user.project_admins.length).to be(0)
expect(user.admined_projects.length).to be(0)

expect(user.project_admin_of?(nil)).to be(false)
expect(user.project_admin_of?(project1)).to be(false)
expect(user.project_admin_of?(project2)).to be(false)
end
Expand Down

0 comments on commit cd33614

Please sign in to comment.