Commit Graph

637 Commits

Author SHA1 Message Date
google-labs-jules[bot]
f2421bf4c7 Here's the plan to add polymorphic comments and update related functionality:
This change introduces polymorphic comments, allowing you to comment on Photos, Plantings, Harvests, and Activities, in addition to Posts.

Key changes include:

-   **Comment Model:**
    -   Made `Comment.commentable` a polymorphic association.
    -   Added a data migration to move existing post comments to the new structure.
    -   Updated notification creation logic for polymorphic commentables.
-   **CommentsController:**
    -   Refactored to handle various commentable types using a `find_commentable` method.
-   **Ability Model:**
    -   Updated permissions for comment creation, editing (author/admin), and deletion (author/commentable owner/admin).
-   **Routes:**
    -   Added nested comment routes for Photos, Plantings, Harvests, Activities, and Posts using a `commentable` concern with shallow routes.
-   **Views:**
    -   Created generic partials for comment forms (`_form.html.haml`) and display (`_comment.html.haml`, `_comments.html.haml`).
    -   Integrated these partials into the show pages of all commentable types.
    -   Updated `comments/new` and `comments/edit` views to be generic.
    -   Relevant parent controller `show` actions now eager-load comments.
-   **Testing:**
    -   Added extensive model, controller (using shared examples), and feature tests to cover the new polymorphic comment functionality, including permissions and UI interactions for all commentable types.
    -   Updated and created factories as needed.

This fulfills the issue requirements for adding comments to multiple resource types with appropriate permissions.
2025-05-25 02:03:17 +00:00
Daniel O'Connor
1c97ba1495 Garden collaboration (small part of community gardens) (#3862)
* Add collaboration model

* Permissions and garden show

* List by owner, or where I am a collaborator

* Add index

* Add permissions

* Typo

* Typo

* Add route

* Update schema

* Update schema

* Add CRUD

* Add CRUD

* Add CRUD

* Factory

* Add validations

* Rubocop

* Rubocop

* Rubocop

* Unique index

* Fix

* Make CI more fine grained for faster feedback

* Swap order

* Fix path, fail-fast

* Fix spec

* Remove 'significant drop in coverage' as not everything runs in one giant run

* Fix tests?
2024-09-29 18:28:52 +09:30
Daniel O'Connor
c28b2c0c38 Likes: Add capability to Activities, Plantings, Harvests (#3805)
* Ability to like activities

* Ability to like activities

* Add likeable everywhere

* Refactor

* Remove extra newline

* Typo

* Use classes, not IDs

* Explicitly wait for ajax

* Fix tests

* Move likes under owner

* Add separation

* Move harvest likes near actions

* Rearrange harvests

* Render likes under owner

* Make harvest consistent with other views

* Move planting detail into header

* Move detail into header

* Move detail into header

* Revert

* Fix header

* Move likes into jumotrons

* Fix name

* Change all actions to be after likes and a span

* Cleanup

* Cleanup

* Cleanup

* Cleanup

* i18n and accessibility

* Fix name

* Temporarily make ack into a div

* Update app/views/photos/_actions.html.haml
2024-07-24 17:07:56 +09:30
Daniel O'Connor
e7a0d0276f Photos > Show crop link (#3803)
* Fix #3802 Show crop link

* Fix #3802 Show crop link

* Fix missing arg

* Fix missing arg

* Translations
2024-07-17 20:06:32 +09:30
Daniel O'Connor
5ba25b8e76 Rubocop Rails 7.1 2024-07-13 06:28:30 +00:00
Daniel O'Connor
81060cccf7 Ruby 3.2: Rubocop - Lint/* and Style/* (#3786)
* Rubocop - Layout/*
* Rubocop - Lint and Style
2024-07-13 15:38:37 +09:30
Daniel O'Connor
4f5c47ba58 Ruby 3.2: Rubocop - Layout/* (#3785)
* Rubocop - Layout/*

* Regenerate
2024-07-13 15:19:09 +09:30
Daniel O'Connor
d542326047 Ruby 3.2: Rubocop - Rails/FilePath (#3783)
* Rails/FilePath
2024-07-13 15:13:56 +09:30
Daniel O'Connor
26189855cc Reduce visual impact of hover, and make snappier (#3712)
* Reduce visual impact of hover, and make snappier

* Better seed

* Improve seeding

* Fix codespaces login
2024-04-07 22:17:16 +09:30
Daniel O'Connor
5be0153c74 Activities (#3646)
* Implement activities

* Add activities to timeline

* Add factory

* Add coverage

* Fix misc issues

* Activities display

* Add activities to garden and plantings

* Add activities to garden and plantings

* Add planting

* Add to planting, harvest show

* More CRUD

* More CRUD

* index

* index

* Extract card view

* Permissions

* Add edit

* Remove workaround fro vs code

* Fix title

* CSV

* CSV

* Add RSS, ical

* Extend ical slightly

* Cleanup

* Rubocop

* Remove doubled form

* Change icon

* Fix short description

* Add menus

* Put homepage widget in

* Add activity icon - MIT licenced - https://www.svgrepo.com/svg/336823/plan

* Naming

* Missing files

* Revert VS Code lag induced change

* Update app/views/home/_harvests.html.haml

* Update activities_controller.rb

* Update activities_controller.rb

* Update app/controllers/activities_controller.rb

* Update index.html.haml

* Apply suggestions from code review

* Apply suggestions from code review

* Typo

* Translation

* Apply suggestions from code review

* Update app/views/plantings/index.ics.erb

* Update app/models/activity.rb

* Update plantings_spec.rb

* Update plantings_spec.rb

* We are now rendering an extra event, so check the next one for the old behaviour
2024-03-10 11:36:24 +10:30
Daniel O'Connor
008667515e Swap from ugifier to terser 2024-01-27 01:28:55 +00:00
Daniel O'Connor
f338274611 Rails 7.1 (#3590)
* Rails 7.1

* Update application.rb

* Bump searchkick

* Bump to 7.0.0

* Fix

* Fix crop search

* Sync translation

* Drop required from form group

* Loosen specs further

* Fix Gemfile

* Update seeds_request_spec.rb

* Update test.rb

* Rename
2024-01-27 10:06:47 +10:30
Daniel O'Connor
ad4a6e17e2 iCalendar feed of plantings (#3588)
* Register mime type

* Add rough first pass

* Index predictions, and add links

* Trailing space

* Fix implementation

* Fix names, make public

* Fix names, make public

* Fix

* Fix tyyos

* Add date

* If there are no predictions, keep growing

* Add a todo

* Fix factories

* Specs
2024-01-27 00:38:33 +10: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
4435407b95 Suppress Time.to_s warning until next rails (#3548)
* Fix warning

* Update config/application.rb
2024-01-07 13:27:57 +10:30
Daniel O'Connor
235109ccee Fix deprecation 2024-01-07 01:57:19 +00:00
Daniel O'Connor
4a07c46049 Set env var 2023-04-13 16:50:23 +01:00
Daniel O'Connor
763a547613 Add elasticsearch config 2023-04-13 16:50:23 +01:00
Daniel O'Connor
ac61ae3a56 Update database.yml 2023-04-13 16:50:23 +01:00
Cesy
a4098e9a59 Another attempt at postgres for codespaces 2023-04-13 16:50:23 +01:00
Cesy
3820b01769 Adding codespace host so you can view things in the browser 2023-04-13 16:50:23 +01:00
Daniel O'Connor
e1fb08707a Issue/2419: Limit map to the most recent plantings only (#3191)
* For now, drop mapbox for OSM tiles

* For now, drop mapbox for OSM tiles

* Use OSM tiles

* Remove mapbox secrets for now. If we bring back mapbox; we should re-enstate

* Only show up to 200 plantings

* Update app/assets/javascripts/members.js.erb

* [CodeFactor] Apply fixes

* Update production.rb

---------

Co-authored-by: codefactor-io <support@codefactor.io>
2023-03-13 15:13:28 +10:30
Daniel O'Connor
b3179a8f2d Add missing migration for #3247 [Stacked PR] (#3275)
* Add missing migration for #3247

* [CodeFactor] Apply fixes

* Update 20230313015323_create_active_storage_tables.active_storage.rb

* Rubocop

* Permit a number of safe classes to serialise as YAML

---------

Co-authored-by: codefactor-io <support@codefactor.io>
2023-03-13 13:48:25 +10:30
Daniel O'Connor
449c6c4487 Issue/3189: Fix map displays by dropping mapbox (#3190)
* For now, drop mapbox for OSM tiles

* For now, drop mapbox for OSM tiles

* Use OSM tiles

* Remove mapbox secrets for now. If we bring back mapbox; we should re-enstate

* Update members.js.erb

* Change placeholder
2023-03-13 13:04:16 +10:30
Cesy
60608411ed Merge branch 'dev' into issue/1642 2022-12-17 10:41:35 +00:00
Cesy
59c212ecf5 Switching from SendGrid to Mailgun for sending emails 2022-12-15 10:35:52 +00:00
Daniel O'Connor
28d550d67f Drop test 2022-12-10 15:55:57 +10:30
Daniel O'Connor
07feb1cd85 Drop tests 2022-12-10 15:54:58 +10:30
Daniel O'Connor
d3df63912c Typo 2022-11-07 23:56:37 +10:30
Daniel O'Connor
55ccf8e1af Bump defaults 2022-11-06 16:44:06 +10:30
Daniel O'Connor
b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
Daniel O'Connor
89bb30011c Fixes #3402 (#3043) 2022-05-01 17:10:05 +09:30
Brenda Wallace
60c74ddff3 Reconnecting stale flickr auth tokens 2021-01-05 19:46:07 +13:00
Brenda Wallace
958ee66e79 Apply suggestions from code review 2020-08-26 12:36:58 +12:00
Brenda Wallace
8a5a19f0c6 Removing deprecated commented out parts of application.rb 2020-08-26 12:36:58 +12:00
Brenda Wallace
9dbf8b7c8f New robocops 2020-08-26 12:36:58 +12:00
Brenda Wallace
59efe92648 Upgrade to rails 6 2020-08-26 12:36:58 +12:00
Brenda Wallace
92f8a84369 Remove figaro gem and use rails-dotenv 2020-08-01 20:24:21 +12:00
Brenda
a4afeea025 Updated test stubs to support geocoder 1.6
https://github.com/alexreisner/geocoder/issues/1258
2020-06-20 10:57:03 +12:00
codefactor-io
0577dce474 [CodeFactor] Apply fixes 2020-06-01 14:02:34 +12:00
Brenda Wallace
cdd00e7372 Only allow get 2020-06-01 14:02:34 +12:00
Brenda Wallace
5600670fef Only allow open CORS on the api 2020-06-01 14:02:34 +12:00
Brenda Wallace
32972a90fd Removed commented out code 2020-06-01 14:02:34 +12:00
Brenda Wallace
048ec7791f Increase max records on jsonapi to 100 2020-06-01 14:02:34 +12:00
Brenda Wallace
7482095894 CORS headers for an open api 2020-06-01 14:02:34 +12:00
Awesome Code
8cd0628ba6 Auto corrected by following Lint Ruby Layout/EmptyLineAfterMagicComment 2020-04-16 13:59:48 +12:00
Awesome Code
f570557ddb Auto corrected by following Lint Ruby Lint/RedundantCopEnableDirective 2020-04-16 13:59:32 +12:00
Awesome Code
c764b0a28f Auto corrected by following Lint Ruby Lint/RedundantCopDisableDirective 2020-04-14 10:49:54 +12:00
Brenda
9dfd6dbc73 Tidy up index pages 2020-02-10 14:21:03 +13:00
codefactor-io
34ddf8e98f [CodeFactor] Apply fixes 2020-01-21 13:12:28 +13:00