summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php27
-rw-r--r--classes/Profile.php22
2 files changed, 35 insertions, 14 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 6f1ef81fc..a12839d72 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -333,8 +333,15 @@ class Notice extends Memcached_DataObject
# Clear the cache for subscribed users, so they'll update at next request
# XXX: someone clever could prepend instead of clearing the cache
+
$notice->blowOnInsert();
+ if (isset($replies)) {
+ $notice->saveKnownReplies($replies);
+ } else {
+ $notice->saveReplies();
+ }
+
$notice->distribute();
return $notice;
@@ -817,6 +824,26 @@ class Notice extends Memcached_DataObject
return true;
}
+ function saveKnownReplies($uris)
+ {
+ foreach ($uris as $uri) {
+
+ $user = User::staticGet('uri', $uri);
+
+ if (!empty($user)) {
+
+ $reply = new Reply();
+
+ $reply->notice_id = $this->id;
+ $reply->profile_id = $user->id;
+
+ $id = $reply->insert();
+ }
+ }
+
+ return;
+ }
+
/**
* @return array of integer profile IDs
*/
diff --git a/classes/Profile.php b/classes/Profile.php
index 4f67fc0bc..1ba3281ff 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -882,28 +882,22 @@ class Profile extends Memcached_DataObject
{
$uri = null;
- // check for a local user first
- $user = User::staticGet('id', $this->id);
+ // give plugins a chance to set the URI
+ if (Event::handle('StartGetProfileUri', array($this, &$uri))) {
- if (!empty($user)) {
- $uri = common_local_url(
- 'userbyid',
- array('id' => $user->id)
- );
- } else {
-
- // give plugins a chance to set the URI
- if (Event::handle('StartGetProfileUri', array($this, &$uri))) {
+ // check for a local user first
+ $user = User::staticGet('id', $this->id);
+ if (!empty($user)) {
+ $uri = $user->uri;
+ } else {
// return OMB profile if any
$remote = Remote_profile::staticGet('id', $this->id);
-
if (!empty($remote)) {
$uri = $remote->uri;
}
-
- Event::handle('EndGetProfileUri', array($this, &$uri));
}
+ Event::handle('EndGetProfileUri', array($this, &$uri));
}
return $uri;