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-03-07 07:16 am

[dw-free] Don't call watch_list once for every person on your watch_list.

[commit: http://hg.dwscoalition.org/dw-free/rev/6fc04d2deebe]

Don't call watch_list once for every person on your watch_list.

Patch by [staff profile] mark.

Files modified:
  • htdocs/manage/circle/edit.bml
--------------------------------------------------------------------------------
diff -r 035ff3532833 -r 6fc04d2deebe htdocs/manage/circle/edit.bml
--- a/htdocs/manage/circle/edit.bml	Sat Mar 07 07:10:16 2009 +0000
+++ b/htdocs/manage/circle/edit.bml	Sat Mar 07 07:16:02 2009 +0000
@@ -36,6 +36,9 @@ body<=
     return $print_with_ad->(LJ::bad_input($ML{'.error.badjournaltype'}))
         unless $u->is_person || $u->is_shared || $u->is_identity;
 
+    # used later, load it only once
+    my $watch_list = $u->watch_list;
+
     my $ret;
 
     # no post, show edit form
@@ -73,7 +76,6 @@ body<=
 
                 my ( $u_fg, $u_bg, $t_bg, $w_bg, $t_text, $w_text );
                 if ( $is_watched_userid{$uid} ) {
-                    my $watch_list = $u->watch_list;
                     $u_fg = $watch_list->{$uid}->{fgcolor};
                     $u_bg = $watch_list->{$uid}->{bgcolor};
                 }
@@ -136,7 +138,6 @@ body<=
 
                 my ( $u_fg, $u_bg );
                 if ( $is_watched_userid{$uid} ) {
-                    my $watch_list = $u->watch_list;
                     $u_fg = $watch_list->{$uid}->{fgcolor};
                     $u_bg = $watch_list->{$uid}->{bgcolor};
                 }
--------------------------------------------------------------------------------