Fix for regression with OStatus mention processing (duplicated new and old style lead to trying to save a reply entry twice).

This commit is contained in:
Brion Vibber 2010-08-10 13:36:38 -07:00
parent 4fdfc6b1ce
commit 08fc6053ec
3 changed files with 9 additions and 6 deletions

View File

@ -485,7 +485,7 @@ class Notice extends Memcached_DataObject
function saveKnownUrls($urls)
{
// @fixme validation?
foreach ($urls as $url) {
foreach (array_unique($urls) as $url) {
File::processNew($url, $this->id);
}
}
@ -893,7 +893,7 @@ class Notice extends Memcached_DataObject
}
$groups = array();
foreach ($group_ids as $id) {
foreach (array_unique($group_ids) as $id) {
$group = User_group::staticGet('id', $id);
if ($group) {
common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname");
@ -1016,7 +1016,7 @@ class Notice extends Memcached_DataObject
}
$sender = Profile::staticGet($this->profile_id);
foreach ($uris as $uri) {
foreach (array_unique($uris) as $uri) {
$user = User::staticGet('uri', $uri);
@ -1029,6 +1029,7 @@ class Notice extends Memcached_DataObject
$reply->notice_id = $this->id;
$reply->profile_id = $user->id;
common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $user->id");
$id = $reply->insert();
}

View File

@ -71,6 +71,7 @@ class ActivityContext
$links = $element->getElementsByTagNameNS(ActivityUtils::ATOM, ActivityUtils::LINK);
$attention = array();
for ($i = 0; $i < $links->length; $i++) {
$link = $links->item($i);
@ -80,11 +81,12 @@ class ActivityContext
// XXX: Deprecate this in favour of "mentioned" from Salmon spec
// http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html#SALR
if ($linkRel == self::ATTENTION) {
$this->attention[] = $link->getAttribute(self::HREF);
$attention[] = $link->getAttribute(self::HREF);
} elseif ($linkRel == self::MENTIONED) {
$this->attention[] = $link->getAttribute(self::HREF);
$attention[] = $link->getAttribute(self::HREF);
}
}
$this->attention = array_unique($attention);
}
/**

View File

@ -681,7 +681,7 @@ class Ostatus_profile extends Memcached_DataObject
common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', $attention_uris));
$groups = array();
$replies = array();
foreach ($attention_uris as $recipient) {
foreach (array_unique($attention_uris) as $recipient) {
// Is the recipient a local user?
$user = User::staticGet('uri', $recipient);
if ($user) {