66 Commits

Author SHA1 Message Date
Daniel O'Connor
ce946c3a83 Rubocop fixes 2025-09-20 09:45:56 +00:00
google-labs-jules[bot]
02db5b8130 Add API token generation, authentication, and CRUD for a number of the API resources (#4237)
* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* Mark as editable

* Refactor

* WIP - Authentication

* Implement more test coverage

* Split 401 and 403

* Before Create hooks

* Update harvest specs, defaulting to the first plant part - this may not be right

* Update coverage

* Update coverage

* Rubocop

* Rubocop

* Rubocop

* Fix coverage

* For now, mark photos immutable again

* Fix specs

* Fix specs

* Rubocop

* Fix specs

---------

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-09-10 19:50:06 +09:30
google-labs-jules[bot]
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
google-labs-jules[bot]
0b639d5940 Remove twitter authentication
This change removes the twitter authentication feature from the application.

It removes the `omniauth-twitter` gem and all related code from controllers, views, and tests. It also removes the twitter icon and environment variable settings.
2025-08-24 07:03:20 +00:00
Daniel O'Connor
91fa54fc06 Split CI into the core app, and then feature specs (#4022)
* Split feature tests off to own area

* Split up feature specs

* Split up feature specs

* Split up feature specs

* Split up pipeline

* Split up pipeline

* Split up pipeline

* Split up pipeline

* Split further

* Improve stability slightly

* Skip tagged flaky

* Split mroe
2025-03-29 16:10:33 +10:30
Daniel O'Connor
f1661c5f6e Improve reliability of test (#4021)
* Improve reliability of test

* Improve reliability of test

* Extra asserts

* Increase reliability by asserting the current path is right

* Comment out unreliable area
2025-03-29 14:20:52 +10:30
Daniel O'Connor
8b4f0771c5 Ruby 3.2: Rubocop - Fix Negation matcher (#3780)
* Ruby 3.2/Bundler 2.4

* Fix creation

* Upgrade to js-routes 2. Put all js routes into a global namespace.

* Remove js-routes

* Remove

* Adjust ownership

* Appease codeclimate for the nth time

* Fix deprecation warning by explicitly calling to_fs

* Fix deprecation warning by explicitly calling to_fs

* Fix deprecation warning by explicitly calling to_fs

* Swap to will paginate successor for bootstrap

* Update app/views/members/show.html.haml

* Update app/views/plantings/index.rss.haml

* Update .env

* Update .devcontainer/.env

* Fix spec

* Update spec

* Fix spec

* Pin to 2.4.22

* 3 space indent

* Regenerate

* Update rubocop

* Rubocop

* More rubocop

* Regenerate

* Fix Capybara/NegationMatcher
2024-07-13 15:20:11 +09:30
Daniel O'Connor
725c146e2d Improve profile page on mobile (#3711)
* Avoid showing when there are 0 things

* Styling

* Styling

* Collapse stats by default on small screens

* Add ARIA skip links

* Refactoring out of partial, and use CSS to set order on mobile

* Remove partial

* Update expectations

* Fix visual appearance on Ban button on your own profile for admins

* Typo

* Stale expectation
2024-04-07 21:43:52 +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
ee45b518ce Rubocop fixes (Stacked PR) (#3454)
* Fix todo

* Rubcop

* Rubocop

* Rubocop

* Rename harvests_routing_spec.rb to harvests_controller_routing_spec.rb

Making codeclimate happier

* Rename for CodeFactor: updates_routing_spec.rb to posts_controller_updates_routing_spec.rb

For codefactor

* Rename for CodeFactor: follows_routing_spec.rb to follows_controller_routing_spec.rb

* Rename for CodeFactor: forums_routing_spec.rb to forums_controller_routing_spec.rb

* Rename spec/routing/roles_routing_spec.rb to spec/routing/admin/roles_controller_routing_spec.rb

* Rename authentications_routing_spec.rb to authentications_controller_routing_spec.rb

* Rename for CodeFactor: plantings_routing_spec.rb to plantings_controller_routing_spec.rb

* Rename for CodeFactor: scientific_names_routing_spec.rb to scientific_names_controller_routing_spec.rb

* Rename for CodeFactor: seeds_routing_spec.rb to seeds_controller_routing_spec.rb

* Rename for CodeFactor: comments_routing_spec.rb to comments_controller_routing_spec.rb

* Rename for CodeFactor: garden_types_routing_spec.rb to garden_types_controller_routing_spec.rb

* Rename for CodeFactor: admin_routing_spec.rb to admin_controller_routing_spec.rb

* Rename for CodeFactor: gardens_routing_spec.rb to gardens_controller_routing_spec.rb

* Rename for CodeFactor: photos_routing_spec.rb to photos_controller_routing_spec.rb

* Rename for CodeFactor: plant_parts_routing_spec.rb to plant_parts_controller_routing_spec.rb

* Rename for CodeFactor: crops_routing_spec.rb to crops_controller_routing_spec.rb

* [CodeFactor] Apply fixes

* Rename

* Code factor bot

---------

Co-authored-by: Cesy <cesy.avon@gmail.com>
Co-authored-by: codefactor-io <support@codefactor.io>
2024-01-07 21:05:59 +10:30
Daniel O'Connor
d1f754a288 Rubocop 2022-11-08 00:23:38 +10:30
Daniel O'Connor
2db3d1bacc Various corrections 2022-11-08 00:21:23 +10:30
Daniel O'Connor
e2942f17c7 Rubocop corrections 2022-11-08 00:18:35 +10:30
Daniel O'Connor
06c5e4b8e8 to_s 2022-11-07 23:20:49 +10:30
Daniel O'Connor
b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
Daniel O'Connor
ea5486ffe1 Swap percy over (#2986)
* Swap percy over

* Swap require over

* Change API

* Update package.json
2022-03-27 11:44:18 +10:30
Brenda
36bad1cda0 Fix mobile display of member profiles 2020-02-23 11:42:07 +13:00
Brenda
7257b2ada1 Update with frozen literals 2020-01-10 16:50:52 +13:00
Brenda Wallace
34b399cd8e Use more signed in contexts in browse crops spec
More member role contexts on alt name spec

More member role contexts in crop feature specs

Don't wrap the shared_context
2019-08-18 16:10:03 +12:00
Brenda Wallace
756cf1fe3a Removing unused code in specs 2019-08-18 14:51:24 +12:00
Brenda Wallace
586bc21e93 Merge remote-tracking branch 'upstream/dev' into fix/feature-spec-sessions
Conflicts:
	spec/features/members/profile_spec.rb
	spec/features/notifications_spec.rb
	spec/features/percy/percy_spec.rb
2019-08-17 16:09:32 +12:00
Brenda Wallace
8936933251 Shared context for signing in (and then out) in feature specs 2019-08-17 14:10:56 +12:00
Brenda Wallace
82a3cc35a4 Fix member discarding to match specs 2019-08-10 15:43:06 +12:00
Brenda Wallace
36c4c1e971 use message path instead of notifications 2019-07-21 19:14:22 +12:00
Brenda Wallace
006c7f02f5 feature specs for banning a member 2019-07-16 18:31:53 +12:00
Brenda Wallace
9413d86b05 fixes percy error, running same snapshot more than once 2019-07-15 11:58:46 +00:00
Brenda Wallace
d4cfcb37ba more percy specs 2019-07-15 11:58:46 +00:00
Brenda Wallace
3d92cd1d1d fixes percy error, running same snapshot more than once 2019-07-11 15:12:16 +00:00
Brenda Wallace
ae1e48129c more percy specs 2019-07-11 15:12:16 +00:00
Brenda Wallace
8b47e277ec fixes percy error, running same snapshot more than once 2019-07-11 10:18:54 +00:00
Brenda Wallace
6383dbc19f more percy specs 2019-07-11 10:18:54 +00:00
Brenda Wallace
104e838448 Https in specs 2019-07-10 09:03:05 +00:00
Brenda Wallace
1427441163 No link to the planting with no date 2019-07-08 11:49:13 +12:00
Brenda Wallace
7054787870 fix up members#show spec 2019-07-08 11:04:23 +12:00
Brenda Wallace
e080407deb update spec to not have links to plantings with not dates 2019-07-08 10:08:26 +12:00
Brenda Wallace
b56771f9b7 specs for comments on profile pages 2019-07-02 04:52:39 +00:00
Brenda Wallace
4f59ef2e43 more profile page specs 2019-07-02 04:52:39 +00:00
Brenda Wallace
d37c4139a6 Fixes error displaying plantings with no planted_at date 2019-07-02 04:52:39 +00:00
Brenda Wallace
bf6cb5352d Test for displaying plantings on profile page 2019-07-02 04:52:39 +00:00
Brenda Wallace
97028bdf1d Refactoring member profile spec to use shared example
so we can test the page both signed in and not signed in
2019-07-02 04:52:39 +00:00
Brenda Wallace
391874e27e rubocop lint fixes 2019-06-16 10:30:09 +12:00
Brenda Wallace
6eea0c4a8e Restore message button 2019-06-15 21:42:41 +12:00
Brenda Wallace
70bfcabaec Add seeds to member profile, and update specs 2019-06-15 21:18:10 +12:00
Brenda Wallace
adb0a1043d Move gardens specs to gardens folder 2019-06-15 20:07:48 +12:00
Brenda Wallace
d2fdb499ed Move member specs to members folder 2019-06-15 20:05:18 +12:00
Brenda Wallace
e678cc3841 can't check status code - so check text instead 2019-06-15 19:40:02 +12:00
Brenda Wallace
4b7705fcad wrap a context link in before in specs 2019-06-12 09:20:32 +12:00
Awesome Code
4ba5319ba8 Auto corrected by following Lint Ruby Capybara/FeatureMethods 2019-04-01 23:02:50 +13:00
Awesome Code
ad470ede1d Auto corrected by following Lint Ruby RSpec/AlignRightLetBrace 2019-03-13 17:23:33 +13:00
Awesome Code
f90cc792bb Auto corrected by following Lint Ruby RSpec/AlignLeftLetBrace 2019-03-13 11:42:27 +13:00