mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-08-26 02:35 am

[dw-free] Lacks function to return a list of sorted trust groups

[commit: http://hg.dwscoalition.org/dw-free/rev/4dc79f56badd]

http://bugs.dwscoalition.org/show_bug.cgi?id=1616

Rename poorly named method (my bad) so it's actually apparent what it does.

Patch by [personal profile] kareila.

Files modified:
  • bin/test/test-wtf
  • cgi-bin/DW/User/Edges/WatchTrust.pm
  • cgi-bin/DW/User/Edges/WatchTrust/Loader.pm
  • cgi-bin/ljfeed.pl
--------------------------------------------------------------------------------
diff -r 9c549d858e22 -r 4dc79f56badd bin/test/test-wtf
--- a/bin/test/test-wtf	Tue Aug 25 20:16:15 2009 -0500
+++ b/bin/test/test-wtf	Wed Aug 26 02:35:41 2009 +0000
@@ -376,7 +376,7 @@ push @tests, [ 'validate trustmask == 1'
 ################################################################################
 push @tests, [ 'validate nobody in group 1', sub
 {
-    my $ids = $u1->trust_group_list( id => 1 );
+    my $ids = $u1->trust_group_members( id => 1 );
     return ( scalar ( keys %$ids ) == 0 ) ? 1 : 0;
 } ];
 
@@ -390,7 +390,7 @@ push @tests, [ 'add to group, validate t
 ################################################################################
 push @tests, [ 'validate in group 1', sub
 {
-    my $ids = $u1->trust_group_list( id => 1 );
+    my $ids = $u1->trust_group_members( id => 1 );
     return ( scalar ( keys %$ids ) == 1 ) ? 1 : 0;
 } ];
 
diff -r 9c549d858e22 -r 4dc79f56badd cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm	Tue Aug 25 20:16:15 2009 -0500
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm	Wed Aug 26 02:35:41 2009 +0000
@@ -603,7 +603,7 @@ sub trust_list {
 #    memcache_only => 1,     if set, never hit database
 #    force_database => 1,    if set, ALWAYS hit database (DANGER)
 #
-sub trust_group_list {
+sub trust_group_members {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or confess 'invalid user object';
     my $memc_only = delete $args{memcache_only} || 0;
@@ -627,7 +627,7 @@ sub trust_group_list {
 
     # attempt memcache if allowed
     unless ( $db_only ) {
-        my $memc = DW::User::Edges::WatchTrust::Loader::_trust_group_list_memc( $mask, $u );
+        my $memc = DW::User::Edges::WatchTrust::Loader::_trust_group_members_memc( $mask, $u );
         return $memc if $memc;
     }
 
@@ -636,9 +636,9 @@ sub trust_group_list {
     return {} if $memc_only;
 
     # damn you memcache for not having our data
-    return DW::User::Edges::WatchTrust::Loader::_trust_group_list_db( $mask, $u, force_database => $db_only );
+    return DW::User::Edges::WatchTrust::Loader::_trust_group_members_db( $mask, $u, force_database => $db_only );
 }
-*LJ::User::trust_group_list = \&trust_group_list;
+*LJ::User::trust_group_members = \&trust_group_members;
 
 
 # returns hashref;
@@ -855,7 +855,7 @@ sub delete_trust_group {
         or return 0;
 
     # iterate over everybody in this group and remove the bit
-    my $tglist = $u->trust_group_list( id => $bit, force_database => 1 );
+    my $tglist = $u->trust_group_members( id => $bit, force_database => 1 );
     foreach my $tid ( keys %{ $tglist || {} } ) {
         $dbh->do(
             q{UPDATE wt_edges SET groupmask = groupmask & ~(1 << ?) WHERE from_userid = ? AND to_userid = ?},
diff -r 9c549d858e22 -r 4dc79f56badd cgi-bin/DW/User/Edges/WatchTrust/Loader.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust/Loader.pm	Tue Aug 25 20:16:15 2009 -0500
+++ b/cgi-bin/DW/User/Edges/WatchTrust/Loader.pm	Wed Aug 26 02:35:41 2009 +0000
@@ -133,12 +133,12 @@ sub _filter_wt_list {
 
 
 # helper, simply passes down to _wt_list_memc and filters
-sub _watch_list_memc       { return _filter_wt_list( 1 << 61, _wt_list_memc( @_ ) ); }
-sub _watch_list_db         { return _filter_wt_list( 1 << 61, _wt_list_db( @_ ) );   }
-sub _trust_list_memc       { return _filter_wt_list( 1,       _wt_list_memc( @_ ) ); }
-sub _trust_list_db         { return _filter_wt_list( 1,       _wt_list_db( @_ ) );   }
-sub _trust_group_list_memc { return _filter_wt_list( shift(), _wt_list_memc( @_ ) ); }
-sub _trust_group_list_db   { return _filter_wt_list( shift(), _wt_list_db( @_ ) );   }
+sub _watch_list_memc          { return _filter_wt_list( 1 << 61, _wt_list_memc( @_ ) ); }
+sub _watch_list_db            { return _filter_wt_list( 1 << 61, _wt_list_db( @_ ) );   }
+sub _trust_list_memc          { return _filter_wt_list( 1,       _wt_list_memc( @_ ) ); }
+sub _trust_list_db            { return _filter_wt_list( 1,       _wt_list_db( @_ ) );   }
+sub _trust_group_members_memc { return _filter_wt_list( shift(), _wt_list_memc( @_ ) ); }
+sub _trust_group_members_db   { return _filter_wt_list( shift(), _wt_list_db( @_ ) );   }
 
 
 # attempt to load a user's watch list from memcache
diff -r 9c549d858e22 -r 4dc79f56badd cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl	Tue Aug 25 20:16:15 2009 -0500
+++ b/cgi-bin/ljfeed.pl	Wed Aug 26 02:35:41 2009 +0000
@@ -776,7 +776,7 @@ sub create_view_foaf {
     # now information on who you know, limited to a certain maximum number of users
     my @ids;
     if ( $has_foaf_group ) {
-        @ids = keys %{ $u->trust_group_list( name => 'FOAF-knows' ) };
+        @ids = keys %{ $u->trust_group_members( name => 'FOAF-knows' ) };
     } else {
         @ids = $u->trusted_userids;
     }
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org