Needs review
Project:
Buddylist
Version:
master
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Nov 2008 at 01:47 UTC
Updated:
12 Jan 2009 at 19:00 UTC
The function buddylist_get_buddy_actions contains a simple flip in logic that almost doubles the load of each user's profile page when viewed by a logged in user.
There is no need to grab the viewing user's buddy list, since if the viewing user *is* a buddy already, the viewing
user's id should be in the viewed user's buddy list, since the lists are reciprocal. This should give a big boost to busy sites.
The attached patch simply flips the logic from this:
else if (in_array($viewed_user->uid, array_keys(buddylist_get_buddies($viewing_user->uid)))) {
$actions[] = theme('remove_from_buddylist_link', $viewed_user);
}
to this:
else if (in_array($viewing_user->uid, array_keys(buddylist_get_buddies($viewed_user->uid)))) {
$actions[] = theme('remove_from_buddylist_link', $viewed_user);
}
We can't for the life of us figure out why this was done in the first place, or are we missing something?
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| buddylist_improve_actions_performance.patch | 755 bytes | apotek |
Comments
Comment #1
apotek commentedTitle edit.
Comment #2
apotek commentedBouncing. Anybody there?