Skip to content

Fix people search error and reduce show page queries#1093

Merged
maebeale merged 1 commit intomainfrom
maebeale/fix-people-search-n1
Feb 19, 2026
Merged

Fix people search error and reduce show page queries#1093
maebeale merged 1 commit intomainfrom
maebeale/fix-people-search-n1

Conversation

@maebeale
Copy link
Collaborator

Summary

  • Fix SearchCop::UnknownAttribute error on people search by using association paths ("user.first_name") instead of alias symbols (:user_first_name) in the default all attribute group, and adding the missing scope { left_joins } for cross-table search
  • Memoize badges, facilitator_since_date, and affiliated_since_date in PersonDecorator to eliminate duplicate queries on the show page
  • Eager load user, avatar_attachment, and contact_methods in the people show action

Test plan

  • Search people by contact info (e.g. "u", "123") — should return results without 500 error
  • View a person show page — verify badges, dates, and contact info render correctly
  • Confirm reduced query count in server logs on person show page

🤖 Generated with Claude Code


def show
@person = Person.find(params[:id]).decorate
@person = Person.includes(:avatar_attachment, :contact_methods, user: :avatar_attachment).find(params[:id]).decorate
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are not using user.avatar right? Only person.avatar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack. yes.

The SearchCop `all` attribute group was using alias names (e.g.
:user_first_name) instead of association paths (e.g. "user.first_name"),
causing UnknownAttribute errors on any people search. Also added the
missing `scope { left_joins }` for the cross-table attributes.

Memoize badges, facilitator_since_date, and affiliated_since_date in
PersonDecorator to eliminate duplicate queries on the show page, and
eager load user/avatar/contact_methods in the show action.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/fix-people-search-n1 branch from c04dc2e to 3460c85 Compare February 19, 2026 17:01
@maebeale maebeale merged commit 3a6f6b1 into main Feb 19, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/fix-people-search-n1 branch February 19, 2026 17:27
jmilljr24 added a commit that referenced this pull request Feb 19, 2026
* Add truncated event description to event card (#1045)

* Add truncated event description to event card

* updated event description

* Performance improvements (#1072)

* Move grand_totals out of the workshop_logs view

* Cache the banner results to cut down on page load

* Remove conditional navbar

* Remove duplicate call to set_time_zone_from_user

* Only show users with people in workshop_logs dropdown

* Optimize ahoy pages

* Turn on rack-mini-profiler for all users in staging

* Add scope to report to improve workshop_logs page

* Add back in missing col from select

* Change bookmark detection on dashboard home

* Add labels when using audience and timescope filters

* Style updates

* Fix rubocop SpaceInsideArrayLiteralBrackets offenses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix bookmark icon not updating after removal

The in-memory bookmarks collection retained destroyed records,
causing bookmark_for to still find them during Turbo Stream re-render.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add more rhino (#1073)

* add rhino to models

* update show

* promote rhino field

* fix person profile links

* update link name to dashboard

* update specs

* Person show affiliation dates display (#1071)

* WIP: person show affiliation dates display

* Change prompt and logic re dates shown on person form

* Update display of affiliation info on org form

* Change internal_id display

* Add content_for back to org show

* Docker dev setup tweaks (#1075)

* Add a note about `.env` to `README`

Docker dev setup uses the `.env` file for setting environment variables.

Also ran a markdown linter on `README`.

* Add `bin/setup` step to Docker dev environment instructions

The docker setup creates the dev DB and some tables, but doesn't run
migrations or seed the DB, so this additional step is necessary for now.

* Re-build images on starting dev docker containers

When a new gem or npm package is added to the app, the dev docker images
have to be re-built so that those dependencies are installed.

Without the dependencies the dev containers won't start and so it won't
be possible to install them explicitly via (e.g. via `docker compose
exec web bundle install`).

This is because the dev containers execute commands on start-up (e.g.
`bin/rails server`) that require the dependencies to be present.

* Run `npm ci` instead of `npm install` in `bin/setup`

[`npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci) installs
versions of npm packages specified in the lockfile and so ensures that
the same versions are used by everyone.

This command is also used in `Dockerfile.dev`.

* Auto-confirm users created in DB seeds

* Exclude system specs when running them inside a dev Docker container

The dev docker container doesn't have ChromeDriver, so all system specs
fail (it also takes ages for them to fail because they wait for a
timeout when trying to connect to ChromeDriver).

ChromeDriver and everything else that's needed to run system specs
should be made available in the dev docker container eventually.

* Verify the entire email in `spec/requests/users_spec.rb`

The email generated by the user factory can contain anything, including
the string `rosa`, so checking for that string makes the test flaky.
E.g. it failed for me with this message:

```
expected "hue.crona@prosacco.example" not to include "rosa"
```

Checking the whole email is more reliable.

* Add note about not being able to run system specs via Docker

* Tabbed activity page (#1077)

* Consolidate activity pages into single tabbed view

Add a shared tab navigation bar across all four activity pages (Charts,
Counts, Events, Visits) so they function as one unified Activities page.
Replace three separate admin home cards with a single Activities card.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add analytics charts, restyle admin pages, and reorder home cards

- Add new charts: session duration, heatmap, top engaged users,
  bounce rate, search-to-view conversion, user signup trend, top
  exit events, and avg events per visit stat card
- Consolidate New/Returning Visitors into single chart
- Reorganize chart sections (content discovery, referrals)
- Restyle link colors to text-gray-800 with hover:text-blue-600
- Reorder admin home cards (people/orgs/users to top, banners/news/faqs to bottom)
- Add white card wrappers to admin home page
- Standardize page headers to text-2xl font-semibold
- Restyle visits page filters to match events page layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: replace inline rescue with safe_json_parse method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: align case/end in session duration bucketing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove project change in package.lock

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Workshop variation updates (#1078)

* Add publicly visible to workshop_variations

* Use authorized_scope to find correct associated workshop_variations for a workshop)

* Fix validation spec

* Fix variations error (#1079)

* Correctly call authorized_scope. add includes and sort.

* make variation body NOT required for validation by db

* Update routing from workshop show to creating variations or variation ideas

* Make sure variation button permission works

* add scroll to page to go to anchor

* Update organization form UX, esp and improve comment display (#1076)

* Cleanup organization form and improve comment display

- Restructure org form: add Background Info section, rename labels to
  Organization Type/Email, use DomainTheme for sectors background
- Gate internal notes behind params[:admin] and admin authorization
- Redirect org update to profile page instead of index
- Move :notes to admin-only strong params
- Add consistent mb-8 spacing between all form sections
- Rework comment fields to show created_by first name as colored badge,
  with dual initials badges when updated_by differs from created_by
- Fixed-width name column ensures comments align across rows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix rubocop style: add spaces inside bracket array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Simplify strong params: allow :notes without conditional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix tests for org form changes

- Remove notes field assertions (now gated behind params[:admin])
- Update redirect expectation to organization profile path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Gate org status behind params[:admin], increase title truncation to 40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove organization_status_id assertions from view specs

Status field is now gated behind params[:admin], so it won't render
in view specs that don't set that param.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Docker dev setup tweaks (#1075)

* Add a note about `.env` to `README`

Docker dev setup uses the `.env` file for setting environment variables.

Also ran a markdown linter on `README`.

* Add `bin/setup` step to Docker dev environment instructions

The docker setup creates the dev DB and some tables, but doesn't run
migrations or seed the DB, so this additional step is necessary for now.

* Re-build images on starting dev docker containers

When a new gem or npm package is added to the app, the dev docker images
have to be re-built so that those dependencies are installed.

Without the dependencies the dev containers won't start and so it won't
be possible to install them explicitly via (e.g. via `docker compose
exec web bundle install`).

This is because the dev containers execute commands on start-up (e.g.
`bin/rails server`) that require the dependencies to be present.

* Run `npm ci` instead of `npm install` in `bin/setup`

[`npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci) installs
versions of npm packages specified in the lockfile and so ensures that
the same versions are used by everyone.

This command is also used in `Dockerfile.dev`.

* Auto-confirm users created in DB seeds

* Exclude system specs when running them inside a dev Docker container

The dev docker container doesn't have ChromeDriver, so all system specs
fail (it also takes ages for them to fail because they wait for a
timeout when trying to connect to ChromeDriver).

ChromeDriver and everything else that's needed to run system specs
should be made available in the dev docker container eventually.

* Verify the entire email in `spec/requests/users_spec.rb`

The email generated by the user factory can contain anything, including
the string `rosa`, so checking for that string makes the test flaky.
E.g. it failed for me with this message:

```
expected "hue.crona@prosacco.example" not to include "rosa"
```

Checking the whole email is more reliable.

* Add note about not being able to run system specs via Docker

* Tabbed activity page (#1077)

* Consolidate activity pages into single tabbed view

Add a shared tab navigation bar across all four activity pages (Charts,
Counts, Events, Visits) so they function as one unified Activities page.
Replace three separate admin home cards with a single Activities card.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add analytics charts, restyle admin pages, and reorder home cards

- Add new charts: session duration, heatmap, top engaged users,
  bounce rate, search-to-view conversion, user signup trend, top
  exit events, and avg events per visit stat card
- Consolidate New/Returning Visitors into single chart
- Reorganize chart sections (content discovery, referrals)
- Restyle link colors to text-gray-800 with hover:text-blue-600
- Reorder admin home cards (people/orgs/users to top, banners/news/faqs to bottom)
- Add white card wrappers to admin home page
- Standardize page headers to text-2xl font-semibold
- Restyle visits page filters to match events page layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: replace inline rescue with safe_json_parse method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: align case/end in session duration bucketing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove project change in package.lock

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Workshop variation updates (#1078)

* Add publicly visible to workshop_variations

* Use authorized_scope to find correct associated workshop_variations for a workshop)

* Fix validation spec

* Fix variations error (#1079)

* Correctly call authorized_scope. add includes and sort.

* make variation body NOT required for validation by db

* Update routing from workshop show to creating variations or variation ideas

* Make sure variation button permission works

* add scroll to page to go to anchor

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Eugene Bolshakov <eugene.bolshakov@gmail.com>

* Add highlight_controller (#1081)

* add custom turbo frame missing (#1085)

* make the turbo progress bar a bit easy to see (#1087)

* Replace eye-slash icon with closed-eye SVG for password hide toggle (#1088)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* WIP: Fix image/file uploads for Community News, Resources, and Stories (#1084)

* Fix image/file uploads for Community News, Resources, and Stories

Accept modern image formats (WebP, HEIC, HEIF) that were being silently
rejected—especially iPhone photos which default to HEIC. Fix the file_type
validation to use polymorphic dispatch (self.class::ACCEPTED_CONTENT_TYPES)
instead of a hardcoded case statement. Add accept attributes and accepted
type hints to file inputs so users see what's allowed before uploading.
Add direct-upload:error handling so upload failures surface visibly
instead of silently dropping files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove unnecessary Asset fallback guard in form partial

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Handle non-Asset models (Person, Organization) in upload partial

The shared _form_image_field partial is also used by models that have
has_one_attached directly rather than through the Asset STI hierarchy.
Guard the accept_attribute/accepted_types_label calls with respond_to?
so Person and Organization forms don't break.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Improve image display UX: clickable images, file previews, error styling

- Make all primary/gallery images on show pages open full image in new tab
  by defaulting link to true in display_image partial
- Add link: false where images are inside existing link wrappers (cards,
  story_shares index) or forms
- Add client-side file type icon previews for non-image uploads (PDF, Word,
  ZIP, etc.) in file_preview_controller
- Show admin-only created_at date on resource index cards
- Redirect to resource show page after create/update
- Style file validation errors with icon and card border

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add explicit name to package.json to prevent lock file churn

Without an explicit name field, npm derives the package name from the
directory, causing package-lock.json to differ across workspaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Preserve link_to_object default, use link: true only on show pages

Restore the original display_image default where link falls back to
link_to_object. Cards/index views that pass link_to_object: true still
navigate to the record's show page. Views that pass neither get no link.
Show pages explicitly pass link: true to open images in a new tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add view spec for image link behavior, fix redirect expectations

- Add resources/show view spec verifying hero image opens in new tab
  (target="_blank" with rel="noopener noreferrer")
- Update request spec redirect expectations to match new behavior:
  create/update now redirect to resource show page, not index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add gallery image test, fix create redirect assertion

- Test that gallery images on show page also open in new tab
- Use find_by instead of Resource.last for create redirect assertion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Allow null body column on models using rhino_body (#1089)

These models have migrated from body to rhino_body (ActionText) but
the database still has NOT NULL on the body column. New records that
only set rhino_body fail with Trilogy::ProtocolError on save.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* add admin info for debugging (#1094)

* Restrict people/org access to admins only (#1091)

* Restrict people and organization access to admins only

Temporarily lock down index and show for Person and Organization
policies to admin-only while these features are prepared for
separate launch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Keep both searchable/non-searchable test cases for person show policy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add authorization specs and fix person show for owners

- Allow owners to view their own person show page (PersonPolicy#show?)
- Fix show action to authorize before decorating (Draper was masking owner? check)
- Add organization_policy_spec.rb
- Add people and organizations authorization request specs
- Cover visitor, regular user, owner, and admin access patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Redirect to show page after create/update (#1092)

* Redirect to show page after create/update across controllers

After saving a record, redirect to its show page instead of the index
page so the user lands on the record they just created or edited.

Excludes base data (categories, category_types, organization_statuses,
sectors) and FAQs which continue redirecting to index. Preserves
conditional routing (workshop_show, root_path fallbacks) in branching
controllers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update request specs to expect redirect to show page after save

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix system specs to expect show page after story save

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Change allowed_to? guards from :index? to :show? for show redirects

Since these controllers now redirect to the show page instead of the
index after save, the permission guard should check :show? on the
instance rather than :index? on the class.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Fix people search SearchCop error and memoize show page queries (#1093)

The SearchCop `all` attribute group was using alias names (e.g.
:user_first_name) instead of association paths (e.g. "user.first_name"),
causing UnknownAttribute errors on any people search. Also added the
missing `scope { left_joins }` for the cross-table attributes.

Memoize badges, facilitator_since_date, and affiliated_since_date in
PersonDecorator to eliminate duplicate queries on the show page, and
eager load user/avatar/contact_methods in the show action.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Diti <deepthinayak366@gmail.com>
Co-authored-by: maebeale <maebeale@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Eugene Bolshakov <eugene.bolshakov@gmail.com>
Co-authored-by: Ryan Vasios <rvasios@wrapbook.com>
jmilljr24 added a commit that referenced this pull request Feb 19, 2026
* Add truncated event description to event card (#1045)

* Add truncated event description to event card

* updated event description

* Performance improvements (#1072)

* Move grand_totals out of the workshop_logs view

* Cache the banner results to cut down on page load

* Remove conditional navbar

* Remove duplicate call to set_time_zone_from_user

* Only show users with people in workshop_logs dropdown

* Optimize ahoy pages

* Turn on rack-mini-profiler for all users in staging

* Add scope to report to improve workshop_logs page

* Add back in missing col from select

* Change bookmark detection on dashboard home

* Add labels when using audience and timescope filters

* Style updates

* Fix rubocop SpaceInsideArrayLiteralBrackets offenses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix bookmark icon not updating after removal

The in-memory bookmarks collection retained destroyed records,
causing bookmark_for to still find them during Turbo Stream re-render.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add more rhino (#1073)

* add rhino to models

* update show

* promote rhino field

* fix person profile links

* update link name to dashboard

* update specs

* Person show affiliation dates display (#1071)

* WIP: person show affiliation dates display

* Change prompt and logic re dates shown on person form

* Update display of affiliation info on org form

* Change internal_id display

* Add content_for back to org show

* Docker dev setup tweaks (#1075)

* Add a note about `.env` to `README`

Docker dev setup uses the `.env` file for setting environment variables.

Also ran a markdown linter on `README`.

* Add `bin/setup` step to Docker dev environment instructions

The docker setup creates the dev DB and some tables, but doesn't run
migrations or seed the DB, so this additional step is necessary for now.

* Re-build images on starting dev docker containers

When a new gem or npm package is added to the app, the dev docker images
have to be re-built so that those dependencies are installed.

Without the dependencies the dev containers won't start and so it won't
be possible to install them explicitly via (e.g. via `docker compose
exec web bundle install`).

This is because the dev containers execute commands on start-up (e.g.
`bin/rails server`) that require the dependencies to be present.

* Run `npm ci` instead of `npm install` in `bin/setup`

[`npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci) installs
versions of npm packages specified in the lockfile and so ensures that
the same versions are used by everyone.

This command is also used in `Dockerfile.dev`.

* Auto-confirm users created in DB seeds

* Exclude system specs when running them inside a dev Docker container

The dev docker container doesn't have ChromeDriver, so all system specs
fail (it also takes ages for them to fail because they wait for a
timeout when trying to connect to ChromeDriver).

ChromeDriver and everything else that's needed to run system specs
should be made available in the dev docker container eventually.

* Verify the entire email in `spec/requests/users_spec.rb`

The email generated by the user factory can contain anything, including
the string `rosa`, so checking for that string makes the test flaky.
E.g. it failed for me with this message:

```
expected "hue.crona@prosacco.example" not to include "rosa"
```

Checking the whole email is more reliable.

* Add note about not being able to run system specs via Docker

* Tabbed activity page (#1077)

* Consolidate activity pages into single tabbed view

Add a shared tab navigation bar across all four activity pages (Charts,
Counts, Events, Visits) so they function as one unified Activities page.
Replace three separate admin home cards with a single Activities card.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add analytics charts, restyle admin pages, and reorder home cards

- Add new charts: session duration, heatmap, top engaged users,
  bounce rate, search-to-view conversion, user signup trend, top
  exit events, and avg events per visit stat card
- Consolidate New/Returning Visitors into single chart
- Reorganize chart sections (content discovery, referrals)
- Restyle link colors to text-gray-800 with hover:text-blue-600
- Reorder admin home cards (people/orgs/users to top, banners/news/faqs to bottom)
- Add white card wrappers to admin home page
- Standardize page headers to text-2xl font-semibold
- Restyle visits page filters to match events page layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: replace inline rescue with safe_json_parse method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: align case/end in session duration bucketing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove project change in package.lock

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Workshop variation updates (#1078)

* Add publicly visible to workshop_variations

* Use authorized_scope to find correct associated workshop_variations for a workshop)

* Fix validation spec

* Fix variations error (#1079)

* Correctly call authorized_scope. add includes and sort.

* make variation body NOT required for validation by db

* Update routing from workshop show to creating variations or variation ideas

* Make sure variation button permission works

* add scroll to page to go to anchor

* Update organization form UX, esp and improve comment display (#1076)

* Cleanup organization form and improve comment display

- Restructure org form: add Background Info section, rename labels to
  Organization Type/Email, use DomainTheme for sectors background
- Gate internal notes behind params[:admin] and admin authorization
- Redirect org update to profile page instead of index
- Move :notes to admin-only strong params
- Add consistent mb-8 spacing between all form sections
- Rework comment fields to show created_by first name as colored badge,
  with dual initials badges when updated_by differs from created_by
- Fixed-width name column ensures comments align across rows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix rubocop style: add spaces inside bracket array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Simplify strong params: allow :notes without conditional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix tests for org form changes

- Remove notes field assertions (now gated behind params[:admin])
- Update redirect expectation to organization profile path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Gate org status behind params[:admin], increase title truncation to 40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove organization_status_id assertions from view specs

Status field is now gated behind params[:admin], so it won't render
in view specs that don't set that param.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Docker dev setup tweaks (#1075)

* Add a note about `.env` to `README`

Docker dev setup uses the `.env` file for setting environment variables.

Also ran a markdown linter on `README`.

* Add `bin/setup` step to Docker dev environment instructions

The docker setup creates the dev DB and some tables, but doesn't run
migrations or seed the DB, so this additional step is necessary for now.

* Re-build images on starting dev docker containers

When a new gem or npm package is added to the app, the dev docker images
have to be re-built so that those dependencies are installed.

Without the dependencies the dev containers won't start and so it won't
be possible to install them explicitly via (e.g. via `docker compose
exec web bundle install`).

This is because the dev containers execute commands on start-up (e.g.
`bin/rails server`) that require the dependencies to be present.

* Run `npm ci` instead of `npm install` in `bin/setup`

[`npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci) installs
versions of npm packages specified in the lockfile and so ensures that
the same versions are used by everyone.

This command is also used in `Dockerfile.dev`.

* Auto-confirm users created in DB seeds

* Exclude system specs when running them inside a dev Docker container

The dev docker container doesn't have ChromeDriver, so all system specs
fail (it also takes ages for them to fail because they wait for a
timeout when trying to connect to ChromeDriver).

ChromeDriver and everything else that's needed to run system specs
should be made available in the dev docker container eventually.

* Verify the entire email in `spec/requests/users_spec.rb`

The email generated by the user factory can contain anything, including
the string `rosa`, so checking for that string makes the test flaky.
E.g. it failed for me with this message:

```
expected "hue.crona@prosacco.example" not to include "rosa"
```

Checking the whole email is more reliable.

* Add note about not being able to run system specs via Docker

* Tabbed activity page (#1077)

* Consolidate activity pages into single tabbed view

Add a shared tab navigation bar across all four activity pages (Charts,
Counts, Events, Visits) so they function as one unified Activities page.
Replace three separate admin home cards with a single Activities card.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add analytics charts, restyle admin pages, and reorder home cards

- Add new charts: session duration, heatmap, top engaged users,
  bounce rate, search-to-view conversion, user signup trend, top
  exit events, and avg events per visit stat card
- Consolidate New/Returning Visitors into single chart
- Reorganize chart sections (content discovery, referrals)
- Restyle link colors to text-gray-800 with hover:text-blue-600
- Reorder admin home cards (people/orgs/users to top, banners/news/faqs to bottom)
- Add white card wrappers to admin home page
- Standardize page headers to text-2xl font-semibold
- Restyle visits page filters to match events page layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: replace inline rescue with safe_json_parse method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix RuboCop: align case/end in session duration bucketing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove project change in package.lock

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Workshop variation updates (#1078)

* Add publicly visible to workshop_variations

* Use authorized_scope to find correct associated workshop_variations for a workshop)

* Fix validation spec

* Fix variations error (#1079)

* Correctly call authorized_scope. add includes and sort.

* make variation body NOT required for validation by db

* Update routing from workshop show to creating variations or variation ideas

* Make sure variation button permission works

* add scroll to page to go to anchor

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Eugene Bolshakov <eugene.bolshakov@gmail.com>

* Add highlight_controller (#1081)

* add custom turbo frame missing (#1085)

* make the turbo progress bar a bit easy to see (#1087)

* Replace eye-slash icon with closed-eye SVG for password hide toggle (#1088)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* WIP: Fix image/file uploads for Community News, Resources, and Stories (#1084)

* Fix image/file uploads for Community News, Resources, and Stories

Accept modern image formats (WebP, HEIC, HEIF) that were being silently
rejected—especially iPhone photos which default to HEIC. Fix the file_type
validation to use polymorphic dispatch (self.class::ACCEPTED_CONTENT_TYPES)
instead of a hardcoded case statement. Add accept attributes and accepted
type hints to file inputs so users see what's allowed before uploading.
Add direct-upload:error handling so upload failures surface visibly
instead of silently dropping files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove unnecessary Asset fallback guard in form partial

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Handle non-Asset models (Person, Organization) in upload partial

The shared _form_image_field partial is also used by models that have
has_one_attached directly rather than through the Asset STI hierarchy.
Guard the accept_attribute/accepted_types_label calls with respond_to?
so Person and Organization forms don't break.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Improve image display UX: clickable images, file previews, error styling

- Make all primary/gallery images on show pages open full image in new tab
  by defaulting link to true in display_image partial
- Add link: false where images are inside existing link wrappers (cards,
  story_shares index) or forms
- Add client-side file type icon previews for non-image uploads (PDF, Word,
  ZIP, etc.) in file_preview_controller
- Show admin-only created_at date on resource index cards
- Redirect to resource show page after create/update
- Style file validation errors with icon and card border

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add explicit name to package.json to prevent lock file churn

Without an explicit name field, npm derives the package name from the
directory, causing package-lock.json to differ across workspaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Preserve link_to_object default, use link: true only on show pages

Restore the original display_image default where link falls back to
link_to_object. Cards/index views that pass link_to_object: true still
navigate to the record's show page. Views that pass neither get no link.
Show pages explicitly pass link: true to open images in a new tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add view spec for image link behavior, fix redirect expectations

- Add resources/show view spec verifying hero image opens in new tab
  (target="_blank" with rel="noopener noreferrer")
- Update request spec redirect expectations to match new behavior:
  create/update now redirect to resource show page, not index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add gallery image test, fix create redirect assertion

- Test that gallery images on show page also open in new tab
- Use find_by instead of Resource.last for create redirect assertion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Allow null body column on models using rhino_body (#1089)

These models have migrated from body to rhino_body (ActionText) but
the database still has NOT NULL on the body column. New records that
only set rhino_body fail with Trilogy::ProtocolError on save.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* add admin info for debugging (#1094)

* Restrict people/org access to admins only (#1091)

* Restrict people and organization access to admins only

Temporarily lock down index and show for Person and Organization
policies to admin-only while these features are prepared for
separate launch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Keep both searchable/non-searchable test cases for person show policy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add authorization specs and fix person show for owners

- Allow owners to view their own person show page (PersonPolicy#show?)
- Fix show action to authorize before decorating (Draper was masking owner? check)
- Add organization_policy_spec.rb
- Add people and organizations authorization request specs
- Cover visitor, regular user, owner, and admin access patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Redirect to show page after create/update (#1092)

* Redirect to show page after create/update across controllers

After saving a record, redirect to its show page instead of the index
page so the user lands on the record they just created or edited.

Excludes base data (categories, category_types, organization_statuses,
sectors) and FAQs which continue redirecting to index. Preserves
conditional routing (workshop_show, root_path fallbacks) in branching
controllers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update request specs to expect redirect to show page after save

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix system specs to expect show page after story save

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Change allowed_to? guards from :index? to :show? for show redirects

Since these controllers now redirect to the show page instead of the
index after save, the permission guard should check :show? on the
instance rather than :index? on the class.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Fix people search SearchCop error and memoize show page queries (#1093)

The SearchCop `all` attribute group was using alias names (e.g.
:user_first_name) instead of association paths (e.g. "user.first_name"),
causing UnknownAttribute errors on any people search. Also added the
missing `scope { left_joins }` for the cross-table attributes.

Memoize badges, facilitator_since_date, and affiliated_since_date in
PersonDecorator to eliminate duplicate queries on the show page, and
eager load user/avatar/contact_methods in the show action.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Diti <deepthinayak366@gmail.com>
Co-authored-by: maebeale <maebeale@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Eugene Bolshakov <eugene.bolshakov@gmail.com>
Co-authored-by: Ryan Vasios <rvasios@wrapbook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments