Skip to content
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
29 changes: 7 additions & 22 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
{
"permissions": {
"allow": [
"Bash(bundle exec brakeman:*)",
"Bash(bundle exec rails routes:*)",
"Bash(bundle exec rails runner:*)",
"Bash(bundle exec rspec:*)",
"Bash(bundle exec rubocop:*)",
"Bash(bundle exec rails runner:*)",
"Bash(RAILS_ENV=test bundle exec rails runner:*)",
"Bash(RAILS_ENV=test bundle exec rspec:*)",
"Bash(git stash:*)",
"Bash(git add:*)",
"Bash(git apply:*)",
"Bash(git checkout:*)",
"Bash(git commit:*)",
"Bash(git diff:*)",
"Bash(git pull:*)",
"Bash(git push:*)",
"Bash(git reset:*)",
"Bash(git stash:*)",
"Bash(git diff:*)",
"Bash(bin/rails db:migrate:*)",
"Bash(for i in 1 2 3)",
"Bash(do bundle exec rspec spec/system/stories_spec.rb:71 --format progress)",
"Bash(done)",
"Bash(bin/rails runner:*)",
"Bash(chmod:*)",
"Bash(mysql -u root:*)",
"Bash(git -C /Users/maebeale/programming/awbw branch --show-current)",
"Bash(bundle exec rails routes:*)",
"Bash(bundle exec rubocop:*)",
"Bash(git -C /Users/maebeale/programming/awbw diff --name-only main...HEAD)",
"Bash(git log:*)",

"Bash(git fetch:*)",
"Bash(git rebase:*)",
"Bash(grep:*)"

"Bash(bin/rails generate:*)",
"Bash(bin/rails db:schema:dump:*)",
"Bash(RAILS_ENV=test bin/rails:*)"

"Bash(git merge:*)"
]
}
}
17 changes: 13 additions & 4 deletions app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,19 @@ def set_form_variables
@organization_statuses = OrganizationStatus.all
@sectors_collection = Sector.published.order(:name).pluck(:name, :id)
@current_sector_ids = @organization.sectorable_items.map(&:sector_id)
@people_array = authorized_scope(Person.joins(:user))
.order(:first_name, :last_name)
.pluck(:first_name, :last_name, :id)
.map { |fn, ln, id| [ "#{fn} #{ln}", id ] }
# Build array of [display_name, id] for person selection dropdown
# Email priority matches Person#preferred_email: user.email > person.email > person.email_2
@people_array = authorized_scope(Person.left_joins(:user))
.order(:first_name, :last_name)
.pluck(
:first_name,
:last_name,
:id,
Arel.sql("COALESCE(users.email, people.email, people.email_2)")
)
.map { |fn, ln, id, email|
[ "#{fn} #{ln}#{" (#{email})" if email.present?}", id ]
}

if @organization.persisted? && @organization.errors.empty?
affiliations = @organization.affiliations
Expand Down
4 changes: 4 additions & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ def primary_organization
.first&.organization
end

def preferred_email
user&.email.presence || email.presence || email_2.presence
end

private

def strip_whitespace
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<% cache [person, current_user.super_user?] do %>
<tr class="hover:bg-gray-50 transition-colors duration-150">
<td class="px-4 py-2">
<%= person_profile_button(person) %>
<%= person_profile_button(person, subtitle: person.preferred_email) %>
</td>
<td class="px-4 py-2 text-center text-sm text-gray-800">
<%= person.member_since&.year %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/stories/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

<div class="flex-1 mb-4 md:mb-0">
<%= f.input :spotlighted_facilitator_id,
collection: Person.joins(:user).order("users.first_name, users.last_name"),
collection: Person.left_joins(:user).order("users.first_name, users.last_name"),
label_method: :full_name,
value_method: :id,
include_blank: true,
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/workshop_variation_ideas.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :workshop_variation_idea do
name { "Workshop Variation Idea" }
sequence(:name) { |n| "Workshop Variation Idea #{n}" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed this to fix a failing test

body { "This is a variation idea description" }
youtube_url { "https://www.youtube.com/watch?v=example" }
permission_given { true }
Expand Down
2 changes: 2 additions & 0 deletions spec/system/reset_password_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
sign_in person_user
# Start on a page where the user nav is visible
visit root_path
# Wait for any flash message overlay to disappear before clicking avatar
page.has_no_css?('#flash_now', visible: true, wait: 10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this to fix flaky test

# Open user nav dropdown (wait for avatar to appear after page load)
find('#avatar button', wait: 10).click
# Click "Change password"
Expand Down