hide group name and aliases in group tag cloud section

This commit is contained in:
Evan Prodromou 2009-06-17 15:20:44 -07:00
parent 420e8994f8
commit 2187ec7056

View File

@ -32,7 +32,7 @@ if (!defined('LACONICA')) {
} }
/** /**
* Personal tag cloud section * Group tag cloud section
* *
* @category Widget * @category Widget
* @package Laconica * @package Laconica
@ -64,12 +64,27 @@ class GroupTagCloudSection extends TagCloudSection
$weightexpr='sum(exp(-(now() - notice_tag.created) / %s))'; $weightexpr='sum(exp(-(now() - notice_tag.created) / %s))';
} }
$names = $this->group->getAliases();
$names = array_merge(array($this->group->nickname), $names);
// XXX This is dumb.
$quoted = array();
foreach ($names as $name) {
$quoted[] = "\"$name\"";
}
$namestring = implode(',', $quoted);
$qry = 'SELECT notice_tag.tag, '. $qry = 'SELECT notice_tag.tag, '.
$weightexpr . ' as weight ' . $weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' . 'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' . 'ON notice_tag.notice_id = notice.id ' .
'JOIN group_inbox on group_inbox.notice_id = notice.id ' . 'JOIN group_inbox on group_inbox.notice_id = notice.id ' .
'WHERE group_inbox.group_id = %d ' . 'WHERE group_inbox.group_id = %d ' .
'AND notice_tag.tag not in (%s) '.
'GROUP BY notice_tag.tag ' . 'GROUP BY notice_tag.tag ' .
'ORDER BY weight DESC '; 'ORDER BY weight DESC ';
@ -85,9 +100,9 @@ class GroupTagCloudSection extends TagCloudSection
$tag = Memcached_DataObject::cachedQuery('Notice_tag', $tag = Memcached_DataObject::cachedQuery('Notice_tag',
sprintf($qry, sprintf($qry,
common_config('tag', 'dropoff'), common_config('tag', 'dropoff'),
$this->group->id), $this->group->id,
$namestring),
3600); 3600);
return $tag; return $tag;
} }
} }