summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrenda Wallace <shiny@cpan.org>2009-07-20 14:18:48 +1200
committerBrenda Wallace <shiny@cpan.org>2009-07-20 14:18:48 +1200
commitd95f45f0705467cfc7e3650db932e43f0a20e45f (patch)
tree6c756903457fc5777b610759ee5fa15a8b6379fa /classes
parent76dd061a34782010d5650d5513bd4d4873e0045c (diff)
turn into canonical terms before checking for unique-ness of a tag in a notice
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 12b47f360..7f002d838 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -101,9 +101,17 @@ class Notice extends Memcached_DataObject
if (!$count) {
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 */
- foreach(array_unique($match[1]) as $hashtag) {
+ foreach(array_unique($hashtags) as $hashtag) {
/* elide characters we don't want in the tag */
$this->saveTag($hashtag);
}
@@ -112,8 +120,6 @@ class Notice extends Memcached_DataObject
function saveTag($hashtag)
{
- $hashtag = common_canonical_tag($hashtag);
-
$tag = new Notice_tag();
$tag->notice_id = $this->id;
$tag->tag = $hashtag;