ploi / roadmap

Open source roadmapping software
https://roadmap.ploi.io
MIT License
418 stars 84 forks source link

Ability to like (vote) on changelogs #264

Closed Autive closed 7 months ago

Autive commented 8 months ago

This adds the ability to like/vote on changelogs as suggested in #205.

Cannonb4ll commented 8 months ago

So while this is great, it is double work. We already have a votes table that is polymorphic.

You can see that here: https://github.com/ploi/roadmap/blob/main/app/Traits/HasUpvote.php#L17

It's just a matter of applying the trait to your model (in this case Changelog.php) and using the available methods from that trait.

It saves another table creation, and everything else is already saved in that table automatically by calling the toggleUpvote() method. (https://github.com/ploi/roadmap/blob/main/app/Traits/HasUpvote.php#L31)

Item.php model has this: https://github.com/ploi/roadmap/blob/main/app/Models/Item.php#L25 Comment.php model has this: https://github.com/ploi/roadmap/blob/main/app/Models/Comment.php#L15

Autive commented 8 months ago

Didn't notice that, Changed the PR to move this to the Upvote Trait.

Cannonb4ll commented 7 months ago

🥰