Commit Graph
121 Commits
Author SHA1 Message Date
Brenda Wallace 70827646a4 Merge branch 'main' into seed-packet-photo-sides 2026-10-28 22:10:15 +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 a026a00a60 Merge branch 'main' into api/graphiti 2026-10-28 21:54:10 +13:00
Brenda Wallace 96e37b6c90 feat: Enhance photo handling in posts with new features and UI updates 2026-10-28 21:50:26 +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 WallaceandClaude Sonnet 5.5 ab024ac51a Address review comments on packet photo labels
Keep every packet label when a side is photographed again, and use the newest
photo of a side. Before, giving a second photo the same label cleared the
older photo's, which let it back into the crop's photos and default picture.

Carry the label through the HTML photo picker (its search form and the links
that add a photo), so a packet photo added without JavaScript is labelled.

Have the OCR script treat any network failure on an image (DNS, timeout) as
that image failing, so the rest of the batch still runs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 21:20:27 +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 Wallace a79f24cf5e Refactor API controllers and specs for improved request handling and error responses 2026-10-25 18:44:05 +13:00
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 WallaceandClaude Sonnet 5 d9d3ebb9bd Let garden cards choose and add a Flickr photo as JSON
GET /photos/new.json gives a page of the member's Flickr photos (or says
to connect or reconnect Flickr), and POST /photos.json adds one to the
planting or garden and returns the garden's refreshed card, or the
validation errors as 422.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 17:42:26 +12:00
google-labs-jules[bot]andCloCkWeRX 9ebd98de2d Harden Rack::Attack and pagination against aggressive web crawlers
- Configure Allow2Ban in Rack::Attack to ban IPs requesting >500 pages per day for 1 week (7 days).
- Add honeypot route /dont-crawl-me disallowed in robots.txt and configure Fail2Ban in Rack::Attack to ban IPs visiting it for 7 days upon 1 hit.
- Update PhotosController#index to raise ActiveRecord::RecordNotFound when page parameter is out of bounds, returning 404 Not Found to crawlers instead of 200 OK.
- Add request and controller specs for Rack::Attack rules and pagination 404 responses.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-09-16 18:50:30 +12:00
google-labs-jules[bot]andCloCkWeRX 97e236f7e8 Convert Photos controller to plain SQL queries
- Refactored `PhotosController#index` to use ActiveRecord queries instead of Searchkick/Elasticsearch.
- Handled filtering by crop and planting via associations.
- Added eager loading for the photo owner to prevent N+1 queries.
- Decoupled the `Photo` model from Elasticsearch by removing the `SearchPhotos` concern.
- Deleted `app/models/concerns/search_photos.rb`.
- Updated controller and model specs to use standard ActiveRecord expectations.
- Cleaned up the photo factory by removing the now-obsolete `:reindex` trait.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-06-23 12:16:50 +00:00
google-labs-jules[bot]andCloCkWeRX 3c70ba12ca Allow filtering Flickr photos by tag when adding photos
- Update MemberFlickr concern to support tag-based search using flickr.photos.search
- Update PhotosController to handle the 'tag' parameter
- Add tag search input field to the 'New Photo' view
- Add test case to verify tag filtering in PhotosController spec

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-04-28 02:59:21 +00:00
Daniel O'Connor 464017de6f Try planting filtering 2026-04-27 08:05:32 +00:00
google-labs-jules[bot]andDaniel O'Connor 8564ec7a7c Add comments to photos (#4130)
* Add comments to photos

Extend the photo show page to support comments by logged in users.

- Make the Comment model polymorphic.
- Update the Photo and Post models to have comments.
- Update the comments controller to handle the polymorphic association.
- Update the photo show page to display comments and a comment form.
- Create a reusable comments partial.

* Add migration

* Fix tests

* Fix tests

* Slightly fix tests

* Fix variables

* Add field

* Refactor slightly

* Refactor slightly

* Refactor slightly

* Refactor

* Photos respond to this as well

* Refactor to polymorphic_url

* Rename

* Wrong relationship

* Refactor and fix tests

* Fix relationships

* Fix rendering

* Fix tests

* Fix model tests

* Fix test

* Fix test

* Fix test

* Fix test

* Fix controller spec

* Fix view tests

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2025-08-24 21:10:16 +09:30
Daniel O'Connor 1f0cfa9b6c Add GBIF to our scientific names, so that our crops can associate creative commons photos (#3559)
* Add GBIF cient

* Add lookup

* Add autocomplete for GBIF lookup

* Add extra detail to scientific names

* Autocomplete

* Add routes

* Rmeove mapping

* Add autocomplete

* Update GBIF data on save

* db/schema

* Style

* Extract service

* Add concern

* Add concern

* Save photos

* Initial coverage

* Coverage

* Add coverage

* Shut up, codeclimate

* Shut up, codeclimate

* Unused

* Shut up, codeclimate

* Apply suggestions from code review

* Remove localhost

* Fix rubocop

* Fix rubocop

* Add UI links

* Add rake

* Indent

* Update Gemfile.lock

* Update lib/tasks/gbif.rake

* Update app/views/crops/_scientific_names.html.haml

* Rubocop

* Expand edit photo form

* Fix error

* Add model validations

* Skip photos without backlinks

* Fix tests

* Add photo words

* Allow blank

* Rubocop and handle invalid legacy data

* Apply suggestions from code review

* Update lib/tasks/gbif.rake
2024-01-21 13:22:25 +10:30
Daniel O'Connor a8b8a58f33 Various rspec autocorrections 2022-11-08 00:09:50 +10:30
codefactor-io 84d02b169a [CodeFactor] Apply fixes 2021-01-05 19:46:07 +13:00
Brenda Wallace 60c74ddff3 Reconnecting stale flickr auth tokens 2021-01-05 19:46:07 +13:00
Brenda ef37f74c0f Splitting up complex method in photos controller 2020-08-26 12:36:58 +12:00
codefactor-io 6c9a15f95e [CodeFactor] Apply fixes 2020-01-11 21:29:37 +00:00
codefactor-io 7e30b6b6e0 [CodeFactor] Apply fixes 2020-01-03 11:28:51 +00:00
Brenda Wallace f76266a716 photos controller working with ES 2019-12-31 21:46:42 +13:00
Brenda Wallace 1c7816c951 fixing photos by crop query in photos controller 2019-12-27 17:20:28 +13:00
codefactor-io 950dd7f810 [CodeFactor] Apply fixes 2019-12-25 01:27:49 +00:00
Brenda Wallace 673f977efc Photos controller using elastic search 2019-12-25 14:27:13 +13:00
codefactor-io f8916dfecb [CodeFactor] Apply fixes 2019-12-20 04:16:33 +00:00
Brenda Wallace 9d68ab0228 Rubocop fix of controller 2019-12-20 17:13:54 +13:00
Brenda Wallace 04fd1a343a Rubocop update (#2334)
* Update rubocop config

* Rubocop update - for rubocop 0.77

* [CodeFactor] Apply fixes

* rubocop fixes

* [CodeFactor] Apply fixes to commit 2826c2e
2019-12-16 22:35:33 +13:00
Brenda Wallace b7321ed46f Add source to photos 2019-09-20 22:26:39 +12:00
Brenda Wallace e0e10c29dc Renaming photographings to photo associations
now it matches the name of its controller, and it is clearer to understand
2019-07-13 16:13:37 +12:00
Brenda Wallace e7b0b6f18e Remove table display on plantings#show, replace with boxes 2019-03-27 21:04:56 +13:00
Brenda Wallace e446c14bd7 Use the new Photo.by_cropscope on photos controller 2019-02-05 12:44:34 +13:00
Brenda Wallace f1ad9cc3c7 Rubocop fix up 2019-02-04 20:55:04 +13:00
Brenda Wallace 5822764c1d Fetch photos in the controller 2019-02-04 20:52:13 +13:00
Brenda Wallace ab880514c2 Further tidy of photo display 2019-02-04 20:43:52 +13:00
Brenda Wallace 87d2c8b4c8 Fixed bug - look up photos by crop 2019-02-04 19:39:21 +13:00
Brenda Wallace 2faa2fd6f0 Content for other formats on photos#show 2018-12-30 15:42:51 +13:00
Brenda Wallace 7399346354 one line method 2018-12-30 15:18:11 +13:00
Brenda Wallace 914e9ef3be photos needs a show method 2018-12-30 15:05:10 +13:00
Brenda Wallace 8e160a4c93 Fixed another wrong method name 2018-12-30 15:05:00 +13:00
Brenda Wallace 3ad048b7e8 Fixed linter issue, empty line after guard clause 2018-09-13 23:10:43 +12:00
Brenda Wallace a221f10113 Move photos owner validation to models 2018-06-04 12:03:11 +12:00
Brenda Wallace 65b4c7dbc1 Revert "Auto corrected by following Style/StringLiterals"
This reverts commit ab56a3c6b3.
2018-02-09 07:58:47 +13:00
Awesome Code ab56a3c6b3 Auto corrected by following Style/StringLiterals 2018-02-07 10:20:26 +13:00
Brenda Wallace 88da0da616 Re-fetches from flickr 2018-02-05 12:52:59 +13:00
Brenda Wallace 14551b6ec8 Merge remote-tracking branch 'upstream/dev' into feature/photos-1457
Conflicts:
	spec/models/crop_spec.rb
2017-12-09 20:59:20 +13:00
Brenda Wallace a6a7f789a3 Rubocop upgrade (and some style fixes) 2017-12-01 21:07:39 +13:00
Brenda Wallace 697779e67c Don't add item to photo is already there 2017-11-30 10:15:05 +13:00
Brenda Wallace ff57176d60 Simplified the photos controller a bit 2017-11-29 22:13:03 +13:00