turn into canonical terms before checking for unique-ness of a tag in a notice
This commit is contained in:
parent
76dd061a34
commit
d95f45f070
@ -102,8 +102,16 @@ class Notice extends Memcached_DataObject
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//turn each into their canonical tag
|
||||||
|
//this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
|
||||||
|
$hashtags = array();
|
||||||
|
for($i=0; $i<count($match[1]); $i++) {
|
||||||
|
$hashtags[] = common_canonical_tag($match[1][$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add them to the database */
|
/* Add them to the database */
|
||||||
foreach(array_unique($match[1]) as $hashtag) {
|
foreach(array_unique($hashtags) as $hashtag) {
|
||||||
/* elide characters we don't want in the tag */
|
/* elide characters we don't want in the tag */
|
||||||
$this->saveTag($hashtag);
|
$this->saveTag($hashtag);
|
||||||
}
|
}
|
||||||
@ -112,8 +120,6 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
function saveTag($hashtag)
|
function saveTag($hashtag)
|
||||||
{
|
{
|
||||||
$hashtag = common_canonical_tag($hashtag);
|
|
||||||
|
|
||||||
$tag = new Notice_tag();
|
$tag = new Notice_tag();
|
||||||
$tag->notice_id = $this->id;
|
$tag->notice_id = $this->id;
|
||||||
$tag->tag = $hashtag;
|
$tag->tag = $hashtag;
|
||||||
|
Loading…
Reference in New Issue
Block a user