Commit Graph

13 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
d1f754a288 Rubocop 2022-11-08 00:23:38 +10:30
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
8936933251 Shared context for signing in (and then out) in feature specs 2019-08-17 14:10:56 +12:00
Awesome Code
4ba5319ba8 Auto corrected by following Lint Ruby Capybara/FeatureMethods 2019-04-01 23:02:50 +13:00
brenda
2b8aac19dd Revert "Auto corrected by following Ruby Capybara/FeatureMethods"
This reverts commit b52763b7c2.
2018-09-07 10:40:09 +12:00
Awesome Code
b52763b7c2 Auto corrected by following Ruby Capybara/FeatureMethods 2018-09-05 12:06:58 +00: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
Cesy Avon
fc38e1edea Issue #476 test update 2016-06-02 14:58:10 +00:00
Anthony Atkinson
5a35a3da01 Initial rendition of feature test upgrade to Ruby 2.x and Rspec 3.x syntax. 2015-07-22 19:48:41 -04:00
Cjay
3fb9283ca7 Add tests for posts 2015-07-02 18:54:17 +08:00