[Bps-public-commit] App-Changeloggr branch, master, updated. 3e23e07b54292840e511083f568632bd6eb56a59

sartak at bestpractical.com sartak at bestpractical.com
Tue Jun 9 11:27:46 EDT 2009


The branch, master has been updated
       via  3e23e07b54292840e511083f568632bd6eb56a59 (commit)
      from  0ae2f9e1ca83bdb8467bcfb5d6bfa8356c4d75e7 (commit)

Summary of changes:
 lib/App/Changeloggr/Model/Vote.pm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 3e23e07b54292840e511083f568632bd6eb56a59
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Jun 9 11:27:35 2009 -0400

    Allow voters to delete their own votes

diff --git a/lib/App/Changeloggr/Model/Vote.pm b/lib/App/Changeloggr/Model/Vote.pm
index f162c54..692434e 100644
--- a/lib/App/Changeloggr/Model/Vote.pm
+++ b/lib/App/Changeloggr/Model/Vote.pm
@@ -48,6 +48,10 @@ sub current_user_can {
     # anyone can vote
     return 1 if $right eq 'create';
 
+    # a voter can delete own votes
+    return 1 if $right eq 'delete'
+             && $self->__value('user_id') == $self->current_user->id;
+
     # but votes are immutable
     return $self->SUPER::current_user_can($right, %args);
 }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list