503 Commits
Author SHA1 Message Date
04744008bf Add ecocrop_data table, import rake task, and crop show ecological requirements (#5239)
* Add ecocrop_data table, import rake task, and view table on crop show

- Add migration creating ecocrop_data table with columns matching CGIAR EcoCrop schema
- Add EcocropData model and Crop#ecocrop_data matching by scientific name
- Add import:ecocrop_data rake task to download parquet file and populate database
- Add _ecocrop_data partial displaying ecological requirements, CC-BY-4.0 license link, and FAO citation on crop show
- Add model, rake task, and view tests

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* Make citation text smaller and URLs clickable in EcoCrop section

- Add small styling to citation text in _ecocrop_data partial
- Turn FAO and CGIAR dataset URLs into clickable links

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-11-02 18:06:22 +10:30
Brenda Wallace 0e172dea43 Implement claiming functionality for garden stalls with area restrictions and postage options 2026-11-02 18:06:42 +13:00
Brenda Wallace 5c9d9350e0 Implement claim functionality for garden stall packets with associated views, styles, and tests 2026-11-02 18:06:42 +13:00
Brenda Wallace bb4bb1b591 Add offer options for stall seeds with UI updates and tests 2026-11-02 18:06:42 +13:00
Brenda Wallace 275ebd1bab Implement garden stall seed management feature with associated views, styles, and tests 2026-11-02 18:06:42 +13:00
Brenda Wallace ae8fddbc7b Implement garden stall feature with opening/closing functionality and related UI components 2026-11-02 18:06:42 +13:00
Brenda Wallace 78dd9625b8 Add Bluesky OAuth integration
- Implement Atproto::ClientConfig for managing OAuth client configuration.
- Create Atproto::Http module for handling HTTP requests with SSRF protection.
- Develop Atproto::Identity class to resolve handles to DIDs and validate DID documents.
- Introduce Atproto::Jws for generating and signing JWTs for OAuth.
- Create Atproto::OauthClient to manage the OAuth authorization flow with Bluesky.
- Add OmniAuth strategy for Bluesky sign-in, allowing users to authenticate using their Bluesky handle.
- Update views to include Bluesky sign-in options and handle connections.
- Modify routes to expose OAuth client metadata.
- Allow members to sign in without an email address when using Bluesky.
- Add tests for Bluesky authorization and sign-in processes.
2026-11-01 12:16:43 +13:00
84cba260bb Add user behaviour detection service for spam scoring (#5185)
* Add user behaviour detection service for spam scoring

Implement UserBehaviourDetectionService to evaluate members for spam indicators:
- Check email confirmation status
- Inspect bio, posts, and comments for spam-related keywords (such as "Sports Betting")
- Display spam score on admin member screens with badges and tooltips

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* Calculate and persist spam_score on member updates

- Add `spam_score` integer column to members table with migration and schema update
- Add `update_spam_score!` method to Member model
- Call `update_spam_score!` on successful member updates in RegistrationsController#update and MembersController#finish_signup
- Use persisted member `spam_score` in Admin::MembersHelper#spam_score_badge

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* Renumber migration to resolve duplicate version conflict

- Renumber migration from 20261031020000 to 20261031060000
- Update db/schema.rb version to 2026_10_31_060000

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-10-31 21:29:03 +10:30
Brenda Wallace f70b85e60d Add OCR functionality for seed packet photos
- Introduced ocr_text, ocr_engine, and ocr_at attributes to Photo model.
- Implemented awaiting_ocr scope to fetch photos needing OCR processing.
- Updated PhotoAssociation model to remove awaiting_text scope.
- Modified Seed model to include packet_texts method for retrieving OCR results.
- Enhanced PhotoResource and SeedResource to handle new OCR attributes.
- Created migration to add OCR fields to photos and remove packet_text from seeds.
- Updated read_packets.py script to save OCR results directly to photos.
- Added tests for new OCR functionality and removed outdated packet_text tests.
2026-10-31 23:21:01 +13:00
Brenda Wallace c58be736d2 Implement feature X to enhance user experience and optimize performance 2026-10-31 19:30:33 +13:00
Brenda Wallace 5313578d98 Add ReminderEvent tracking for planting and harvest reminders
- Update the growstuff rake tasks to log ReminderEvent when planting and harvest reminders are sent.
- Create a factory for ReminderEvent to facilitate testing.
- Implement model specs for ReminderEvent, including validations and weekly counts.
- Add request specs for Admin::ReminderStatsController to verify reminder statistics.
- Enhance unsubscribe specs to ensure ReminderEvent is logged correctly on unsubscriptions.
- Update task specs for growstuff to verify ReminderEvent counts for sent reminders.
2026-10-31 19:29:54 +13:00
Brenda Wallace f7ff9acca3 Add new features tracking and update planting reminder emails 2026-10-31 19:20:40 +13:00
Brenda Wallace df13da9459 Merge remote-tracking branch 'origin/main' into planting-rainfall 2026-10-31 17:33:24 +13:00
Brenda Wallace d659a05f89 Implement weather reading functionality with Open-Meteo integration and updater service 2026-10-31 17:01:12 +13:00
Brenda WallaceandClaude Sonnet 5.5 a2e495a76c Add when to sow, how to sow and germination time to seeds
What a packet says about sowing it. When to sow is the months, as many as the
packet says: a form sends twelve chips to tick, with the seasons as shortcuts
for the grower's hemisphere (none where we do not know it, rather than a
guess), and the list shows them as runs like "Oct-Feb". How to sow is text, in
the packet's words. Germination is a range of days, as maturity is.

A migration adds four columns to seeds. The facts are on the packet sheet, in
the order they happen, and editable from the pencils, from Edit all and from the
standalone form.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 19:35:41 +13:00
Brenda Wallace a5e5ce4988 Merge remote-tracking branch 'origin/main' into seed-packet-photo-sides
# Conflicts:
#	db/schema.rb
2026-10-28 21:57:32 +13:00
Brenda Wallace b6006df384 feat: Implement draft autosave and preview functionality in PostEditor
- Added useDraftAutosave hook to handle automatic saving of post drafts.
- Enhanced PostEditor component to include a preview tab that fetches and displays rendered markdown.
- Updated Post model to manage draft state and associated published_at timestamp.
- Introduced card_photo association to Post for representing a primary image.
- Modified post form to support draft saving and publishing actions.
- Updated navigation to include links to drafts.
- Added tests for draft saving, preview functionality, and card photo validation.
- Created migrations for new database fields related to drafts and card photos.
2026-10-28 21:50:26 +13:00
Brenda Wallace 062bf738b3 Hide the packet text for now, and fix the packet_text migration
The text read from a packet is kept in seeds.packet_text but is not on any form
or page yet: the OCR script will fill it in a follow-up. The column's migration
comment had an apostrophe that broke its string, so it did not run.
2026-10-28 20:35:09 +13:00
Brenda Wallace 1701f77723 Add OCR task for seed packet photos and related specs
- Introduced a Rake task `packets:needing_ocr` to list photos of seed packets that lack text, outputting results as JSON lines.
- Created a Python script `read_packets.py` to process the output of the Rake task, downloading images and performing OCR to extract text.
- Updated model specs for `Crop` to ensure proper handling of photos associated with different seeds.
- Refactored API request specs for `Photos` and `Seeds`, removing unnecessary attributes from the response.
- Added tests for the new Rake task to ensure correct functionality and output format.
2026-10-28 20:23:35 +13:00
Brenda Wallace 1036ad2ecf feat: add packet_text field to seeds and implement OCR reading functionality for seed packets 2026-10-28 20:12:47 +13:00
Brenda Wallace acfaa2a880 feat: add tesseract.js dependency and implement photo association tests
- Added `tesseract.js` as a dependency in `package.json`.
- Created a new spec file for `PhotosHelper` to test `packet_image_urls` method.
- Enhanced `Crop` model tests to ensure packet photos do not interfere with crop photos.
- Introduced validation tests for `Seed` model, covering row spacing and variety constraints.
- Updated API response in `seeds_request_spec.rb` to include variety, batch number, and row spacing.
- Updated `yarn.lock` to reflect new dependencies and versions.
2026-10-28 19:37:09 +13:00
Brenda Wallace 3a2528f5fa Rename 'moment' to 'label' in photo associations and update related functionality for job and seed photos 2026-10-28 19:11:12 +13:00
Brenda WallaceandDaniel O'Connor 8474bdd416 remove newsletter (#4974)
* Remove unused bluecloth gem

Last released in 2011. It was only required, never called; kramdown
renders the markdown.

* Add specs for Tilt markdown rendering and posts markdown partial

* Remove rails_12factor gem

Last released in 2014. Rails 5+ does this via RAILS_SERVE_STATIC_FILES
and RAILS_LOG_TO_STDOUT, which production.rb already reads.

* Remove memcachier gem from Gemfile and Gemfile.lock

* Remove unused webrat gem

Last released in 2011. Nothing requires it; the specs use Rails'
assert_select and Capybara matchers. Only generator comments mention it.

* Remove crowdin-cli gem

Last released in 2018. Crowdin now ships its own standalone CLI, which
reads crowdin.yml and doesn't need the gem. Also drops the dependencies
only it used (rest-client, gli, crowdin-api and friends).

* Removes the crowdin-cli gem (last released 2018), the dependencies only
it needed, and crowdin.yml. Crowdin was never set up: the config still
has a placeholder project ID and nothing else in the repo mentions it.

Assisted by Claude

* Remove newsletter functionality and associated views and tests

* Remove newsletter functionality and related code across the application

* keep the column

* Remove stale test step

* add back newsletter

* Add migration to update newsletter column comment in members table

---------

Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2026-10-26 11:48:36 +10:30
Brenda Wallace c830624a75 Crop job admin 2026-10-24 18:40:10 +13:00
Brenda Wallace f2e437dedc Add creator reference to crop job templates migration 2026-10-24 18:40:10 +13:00
Brenda Wallace 85b5ff9ecd Add feature flags, with job ideas as the first
Admins switch features on and off at /admin/features, kept in Flipper.
Job ideas (the page, the banners and the overlay) only show while its
flag is on. Features are off until switched on.

Closes #5050
2026-10-24 18:01:56 +13:00
Brenda Wallace c6bf51c542 Implement job idea dismissal duration and snooze functionality; add hidden_until attribute and related specs 2026-10-23 21:04:21 +13:00
Brenda Wallace 1266c0e537 Add action attribute to Job model and update related files 2026-10-23 21:04:21 +13:00
Brenda Wallace a3764739b3 Add job idea dismissal feature and related services
- Introduced JobIdeaDismissal model to manage dismissed job ideas for members.
- Added associations and validations for job idea dismissals in the Member model.
- Created JobIdeas service to generate job ideas based on templates and last year's activities.
- Implemented JobIdeas::LastYear and JobIdeas::Templates classes to fetch relevant job ideas.
- Added migration for job_idea_dismissals table and updated schema.
- Developed tests for job idea dismissal functionality and related services.
2026-10-23 21:04:21 +13:00
Brenda Wallace 89599a665d Add crop_job_step association to Job model and migration
- Introduced a has_many association in CropJobStep for jobs with dependent nullify.
- Added crop_job_step reference to Job model with optional association.
- Created migration to add crop_job_step reference to jobs table with foreign key.
- Updated schema to reflect the new association.
- Added tests for crop_job_step association in Job model.
2026-10-23 21:04:21 +13:00
Brenda Wallace 6332f26c58 Merge pull request #4994 from Growstuff/crop-job-templates-admin
Admin for crop job templates, a tidier crop wrangling page, and crop and template seeds
2026-10-23 13:26:33 +10:30
Brenda Wallace e64e893b4f Merge pull request #5015 from Growstuff/job-photos
Photos on jobs, before and after
2026-10-23 13:20:46 +10:30
Brenda Wallace 5312090a67 Merge remote-tracking branch 'origin/job-links-from-typing' into job-celebration 2026-10-23 08:04:26 +13:00
Brenda Wallace 07a86dfd3b Merge remote-tracking branch 'origin/main' into job-links-from-typing 2026-10-23 08:03:09 +13:00
Brenda Wallace 5b7624814e Merge remote-tracking branch 'origin/main' into rename-activities-to-jobs 2026-10-23 07:49:43 +13:00
Brenda Wallace ff7cbc450f Add activities table and remove jobs table from schema 2026-10-23 07:29:27 +13:00
Brenda Wallace 7c299b0f50 Merge remote-tracking branch 'origin/main' into rename-activities-to-jobs 2026-10-23 07:26:02 +13:00
Brenda Wallace 2b542eadf2 Merge remote-tracking branch 'origin/main' into crop-job-templates 2026-10-23 07:17:28 +13:00
Brenda Wallace 66b70180cd Add external_uri attribute to CropJobStep with validations and tests 2026-10-23 07:16:43 +13:00
51feec8de1 Add comment support for plantings (#4984)
* Add comment support for plantings

- Add polymorphic comments association, subject, and author methods to Planting.
- Add comments_count column migration for Planting counter cache.
- Update CommentsController and comments view templates to support Planting.
- Render comments list and form on Planting show view.
- Add specs for Planting comments in models, controllers, and requests.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* put 4.0.7 back

* Opt comments on posts into record-page styling temporarily

* Drop hr

* Flatten comments

* Update schema

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Brenda Wallace <brenda@wallace.net.nz>
2026-10-22 15:22:32 +00:00
Brenda Wallace 51923aadd8 Add job celebration features with animations and notifications for completed tasks 2026-10-22 18:11:35 +13:00
Brenda Wallace d7d14cf65e Implement job linking functionality with crop suggestions and UI enhancements 2026-10-22 17:59:27 +13:00
Brenda Wallace a0b24381ac Refactor activities to jobs across the application
- Renamed all instances of 'Activity' to 'Job' in views, controllers, and models.
- Updated routes to reflect the change from activities to jobs.
- Modified database schema to rename the activities table to jobs and adjusted related columns.
- Updated locale files to change activity-related translations to jobs.
- Adjusted tests to ensure they reference jobs instead of activities.
- Removed the category field from jobs as they are now a plain list.
- Updated seed data and sample data generation to create jobs instead of activities.
2026-10-22 17:16:25 +13:00
Brenda Wallace ffacf8f236 Add crop job templates and steps models with associated migrations and tests 2026-10-22 16:56:47 +13:00
Brenda Wallace 977a984c24 Remove Elasticsearch integration and related code
- Deleted Elasticsearch gems from Gemfile and Gemfile.lock.
- Updated README and TECH documentation to reflect the removal of Elasticsearch.
- Removed Elasticsearch-related code from models, controllers, services, and factories.
- Adjusted tests to eliminate dependencies on Elasticsearch.
- Cleaned up Docker configuration and environment variables related to Elasticsearch.
- Added a TODO file for future gem reviews and potential removals.
2026-10-22 15:37:03 +13:00
Brenda Wallace 229cd7e5e1 Implement normalized name handling and search improvements in Postgres 2026-10-21 12:58:48 +13:00
Brenda Wallace 26a7b196f7 Move crop search to postgres (no elasticsearch) 2026-10-21 12:58:48 +13:00
Brenda Wallace 238880ef36 Revert "Refactor crop search functionality to use Postgres extensions for improved matching and update pagination logic"
This reverts commit 998a362b34.
2026-10-21 08:22:10 +13:00
Brenda Wallace 998a362b34 Refactor crop search functionality to use Postgres extensions for improved matching and update pagination logic 2026-10-21 08:06:42 +13:00
Brenda Wallace 225a9057c5 Implement transplant functionality: refactor planting movement to record history of gardens, update modal for transplanting, and adjust related components and tests accordingly. 2026-10-17 22:57:38 +13:00