[Bps-public-commit] App-Changeloggr branch, master, updated. 35fe332b7ecd68df7f0c351d0e9ec78d972b3cec

sartak at bestpractical.com sartak at bestpractical.com
Wed Apr 29 17:52:34 EDT 2009


The branch, master has been updated
       via  35fe332b7ecd68df7f0c351d0e9ec78d972b3cec (commit)
      from  24646f30bf1eb36b21a6aeaef49f384613db95f3 (commit)

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

- Log -----------------------------------------------------------------
commit 35fe332b7ecd68df7f0c351d0e9ec78d972b3cec
Author: Shawn M Moore <sartak at gmail.com>
Date:   Wed Apr 29 17:52:28 2009 -0400

    More session -> user munging

diff --git a/lib/App/Changeloggr/Model/Changelog.pm b/lib/App/Changeloggr/Model/Changelog.pm
index b8eb86c..9f0281d 100644
--- a/lib/App/Changeloggr/Model/Changelog.pm
+++ b/lib/App/Changeloggr/Model/Changelog.pm
@@ -92,6 +92,9 @@ sub commit_links {
 sub choose_change {
     my $self = shift;
 
+    my $user = App::Changeloggr::Model::User->new;
+    $user->load_or_create(session_id => Jifty->web->session_id);
+
     # This will become more advanced in the future, picking a change that
     # the current user has not voted on yet, ordered by the confidence of the
     # top tag. But for now.. an arbitrary change belonging to this changelog.
@@ -105,8 +108,8 @@ sub choose_change {
     );
     $changes->limit(
         leftjoin => $votes,
-        column => 'user_session_id',
-        value => Jifty->web->session->id,
+        column => 'user_id',
+        value => $user->id,
         case_sensitive => 1,
     );
     $changes->limit(
diff --git a/lib/App/Changeloggr/Model/Vote.pm b/lib/App/Changeloggr/Model/Vote.pm
index 1e28d9a..61934b7 100644
--- a/lib/App/Changeloggr/Model/Vote.pm
+++ b/lib/App/Changeloggr/Model/Vote.pm
@@ -44,8 +44,8 @@ sub current_user_can {
     my $right = shift;
     my %args  = @_;
 
-    # votes are not private except who submitted the vote
-    return 1 if $right eq 'read' && $args{column} ne 'user_session_id';
+    # votes are public except who submitted the vote
+    return 1 if $right eq 'read' && $args{column} ne 'user_id';
 
     # anyone can vote
     return 1 if $right eq 'create';

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



More information about the Bps-public-commit mailing list