From 4b8ee81ca90a5c1b49dd8224a2d6b2e7b6d813ed Mon Sep 17 00:00:00 2001 From: Shashi Gowda Date: Sun, 6 Mar 2011 23:33:39 +0530 Subject: [PATCH] Utility functions for people tags --- lib/default.php | 5 +++++ lib/framework.php | 1 + lib/util.php | 20 +++++++++++--------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/default.php b/lib/default.php index c612557d69..40372e756b 100644 --- a/lib/default.php +++ b/lib/default.php @@ -269,6 +269,11 @@ $default = 'group' => array('maxaliases' => 3, 'desclimit' => null), + 'peopletag' => + array('maxtags' => 100, // maximum number of tags a user can create. + 'maxpeople' => 500, // maximum no. of people with the same tag by the same user + 'allow_tagging' => array('all' => true), // equivalent to array('local' => true, 'remote' => true) + 'desclimit' => null), 'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/'), 'search' => array('type' => 'fulltext'), diff --git a/lib/framework.php b/lib/framework.php index 350a1c268d..b624e312e1 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -45,6 +45,7 @@ define('NOTICE_INBOX_SOURCE_SUB', 1); define('NOTICE_INBOX_SOURCE_GROUP', 2); define('NOTICE_INBOX_SOURCE_REPLY', 3); define('NOTICE_INBOX_SOURCE_FORWARD', 4); +define('NOTICE_INBOX_SOURCE_PROFILE_TAG', 5); define('NOTICE_INBOX_SOURCE_GATEWAY', -1); # append our extlib dir as the last-resort place to find libs diff --git a/lib/util.php b/lib/util.php index 9f84e3120a..2e6768f90e 100644 --- a/lib/util.php +++ b/lib/util.php @@ -753,17 +753,19 @@ function common_find_mentions($text, $notice) foreach ($hmatches[1] as $hmatch) { $tag = common_canonical_tag($hmatch[0]); + $plist = Profile_list::getByTaggerAndTag($sender->id, $tag); + if (!empty($plist) && !$plist->private) { + $tagged = $sender->getTaggedSubscribers($tag); - $tagged = Profile_tag::getTagged($sender->id, $tag); + $url = common_local_url('showprofiletag', + array('tagger' => $sender->nickname, + 'tag' => $tag)); - $url = common_local_url('subscriptions', - array('nickname' => $sender->nickname, - 'tag' => $tag)); - - $mentions[] = array('mentioned' => $tagged, - 'text' => $hmatch[0], - 'position' => $hmatch[1], - 'url' => $url); + $mentions[] = array('mentioned' => $tagged, + 'text' => $hmatch[0], + 'position' => $hmatch[1], + 'url' => $url); + } } Event::handle('EndFindMentions', array($sender, $text, &$mentions));