Commit 54ea0c2b authored by Penny Leach's avatar Penny Leach
Browse files

Further fix to 659: mismatch in views in friends list page

parent 927e11ed
......@@ -92,13 +92,20 @@ foreach ($data as $d) {
}
json_headers();
$viewcount = array_map('count', $views);
// since php is so special and inconsistent, we can't use array_map for this because it breaks the top level indexes.
$cleanviews = array();
foreach ($views as $userindex => $viewarray) {
$cleanviews[$userindex] = array_slice($viewarray, 0, 5);
}
print json_encode(array(
'count' => $count,
'limit' => $limit,
'offset' => $offset,
'data' => $data,
'pending' => $pending,
'views' => array_map('array_values', $views),
'views' => $cleanviews,
'numviews' => $viewcount,
));
exit;
......
......@@ -74,8 +74,8 @@ var friendslist = new TableRenderer(
}
else {
var viewcol;
if (typeof(d.views) == 'object' && d.views[r.id] && countKeys(d.views[r.id]) > 0) {
var len = countKeys(d.views[r.id]);
if (typeof(d.views) == 'object' && d.views[r.id] && d.numviews[r.id] > 0) {
var len = d.numviews[r.id];
var views = '';
if (len == 1) {
views = len + ' {$viewavailable}';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment