order ratings friends first

This commit is contained in:
friendica 2015-02-03 22:55:01 -08:00
parent 4ead2cd79d
commit 0cc29af6d0
3 changed files with 18 additions and 6 deletions

View file

@ -619,10 +619,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$profile_link = zid($profile_link);
$normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
if(x($a->contacts,$normalised))
$profile_avatar = $a->contacts[$normalised]['thumb'];
else
$profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
$profile_name = $item['author']['xchan_name'];
$profile_link = $item['author']['xchan_url'];

View file

@ -8,6 +8,9 @@ function ratings_init(&$a) {
return;
}
if(local_channel())
load_contact_links(local_channel());
$dirmode = intval(get_config('system','directory_mode'));
$x = find_upstream_directory($dirmode);
@ -46,7 +49,20 @@ function ratings_init(&$a) {
}
$a->poi = $results['target'];
$a->data = $results['ratings'];
$friends = array();
$others = array();
if($results['ratings']) {
foreach($results['ratings'] as $n) {
if(array_key_exists($n['xchan_hash'],$a->contacts))
$friends[] = $n;
else
$others[] = $n;
}
}
$a->data = array_merge($friends,$others);
if(! $a->data) {
notice( t('No ratings') . EOL);

View file

@ -42,7 +42,7 @@ function ratingsearch_init(&$a) {
$ret['success'] = true;
$r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash
where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1",
where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 order by xchan_name asc",
dbesc($p[0]['xchan_hash'])
);