function saveTags()
{
/* extract all #hastags */
- $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match);
+ $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/u', strtolower($this->content), $match);
if (!$count) {
return true;
}
function blowOnInsert($conversation = false)
{
self::blow('profile:notice_ids:%d', $this->profile_id);
- self::blow('public');
+
+ if ($this->isPublic()) {
+ self::blow('public');
+ }
// XXX: Before we were blowing the casche only if the notice id
// was not the root of the conversation. What to do now?
$this->blowOnInsert();
self::blow('profile:notice_ids:%d;last', $this->profile_id);
- self::blow('public;last');
+
+ if ($this->isPublic()) {
+ self::blow('public;last');
+ }
}
/** save all urls in the notice to the db
$groups = array();
/* extract all !group */
- $count = preg_match_all('/(?:^|\s)!([A-Za-z0-9]{1,64})/',
+ $count = preg_match_all('/(?:^|\s)!(' . Nickname::DISPLAY_FMT . ')/',
strtolower($this->content),
$match);
if (!$count) {
$reply->notice_id = $this->id;
$reply->profile_id = $profile->id;
+ $reply->modified = $this->created;
common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $profile->id");
$reply->notice_id = $this->id;
$reply->profile_id = $mentioned->id;
+ $reply->modified = $this->created;
$id = $reply->insert();
* @return Activity activity object representing this Notice.
*/
- function asActivity()
+ function asActivity($cur)
{
$act = self::cacheGet(Cache::codeKey('notice:as-activity:'.$this->id));
if (!empty($act)) {
return $act;
}
-
$act = new Activity();
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
$profile = $this->getProfile();
- $act->actor = ActivityObject::fromProfile($profile);
- $act->verb = ActivityVerb::POST;
- $act->objects[] = ActivityObject::fromNotice($this);
+ $act->actor = ActivityObject::fromProfile($profile);
+ $act->actor->extra[] = $profile->profileInfo($cur);
+ $act->verb = ActivityVerb::POST;
+ $act->objects[] = ActivityObject::fromNotice($this);
// XXX: should this be handled by default processing for object entry?
$groups = $this->getGroups();
foreach ($groups as $group) {
- $ctx->attention[] = $group->uri;
+ $ctx->attention[] = $group->getUri();
}
// XXX: deprecated; use ActivityVerb::SHARE instead
$author=true,
$cur=null)
{
- $act = $this->asActivity();
+ $act = $this->asActivity($cur);
$act->extra[] = $this->noticeInfo($cur);
return $act->asString($namespace, $author, $source);
}
$obj->whereAdd($max);
}
}
+
+ function isPublic()
+ {
+ if (common_config('public', 'localonly')) {
+ return ($this->is_local == Notice::LOCAL_PUBLIC);
+ } else {
+ return (($this->is_local != Notice::LOCAL_NONPUBLIC) &&
+ ($this->is_local != Notice::GATEWAY));
+ }
+ }
}