Merge branch 'master' of gitorious.org:statusnet/mainline into testing

This commit is contained in:
Brion Vibber 2010-05-18 13:21:23 -07:00
commit d5b4df4097
5 changed files with 34 additions and 16 deletions

View File

@ -257,7 +257,7 @@ class OStatusPlugin extends Plugin
$matches = array(); $matches = array();
// Webfinger matches: @user@example.com // Webfinger matches: @user@example.com
if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!', if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\-?\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!',
$text, $text,
$wmatches, $wmatches,
PREG_OFFSET_CAPTURE)) { PREG_OFFSET_CAPTURE)) {

View File

@ -30,6 +30,7 @@ class DiscoveryHints {
case Discovery::PROFILEPAGE: case Discovery::PROFILEPAGE:
$hints['profileurl'] = $link['href']; $hints['profileurl'] = $link['href'];
break; break;
case Salmon::NS_MENTIONS:
case Salmon::NS_REPLIES: case Salmon::NS_REPLIES:
$hints['salmon'] = $link['href']; $hints['salmon'] = $link['href'];
break; break;

View File

@ -1,6 +1,5 @@
== TODO == == TODO ==
* i18n * i18n
* Change in context URL to conversation (try not to construct the URL in JS)
* Update mark behaviour (on notice send) * Update mark behaviour (on notice send)
* Pause, Send a notice ~ should not update counter * Pause, Send a notice ~ should not update counter
* Pause ~ retain up to 50-100 most recent notices * Pause ~ retain up to 50-100 most recent notices

View File

@ -250,14 +250,7 @@ class RealtimePlugin extends Plugin
$arr['url'] = $notice->bestUrl(); $arr['url'] = $notice->bestUrl();
$arr['html'] = htmlspecialchars($notice->rendered); $arr['html'] = htmlspecialchars($notice->rendered);
$arr['source'] = htmlspecialchars($arr['source']); $arr['source'] = htmlspecialchars($arr['source']);
$arr['conversation_url'] = $this->getConversationUrl($notice);
if (!empty($notice->reply_to)) {
$reply_to = Notice::staticGet('id', $notice->reply_to);
if (!empty($reply_to)) {
$arr['in_reply_to_status_url'] = $reply_to->bestUrl();
}
$reply_to = null;
}
$profile = $notice->getProfile(); $profile = $notice->getProfile();
$arr['user']['profile_url'] = $profile->profileurl; $arr['user']['profile_url'] = $profile->profileurl;
@ -272,10 +265,7 @@ class RealtimePlugin extends Plugin
$arr['retweeted_status']['source'] = htmlspecialchars($original->source); $arr['retweeted_status']['source'] = htmlspecialchars($original->source);
$originalProfile = $original->getProfile(); $originalProfile = $original->getProfile();
$arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl; $arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
if (!empty($original->reply_to)) { $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
$originalReply = Notice::staticGet('id', $original->reply_to);
$arr['retweeted_status']['in_reply_to_status_url'] = $originalReply->bestUrl();
}
} }
$original = null; $original = null;
} }
@ -303,6 +293,34 @@ class RealtimePlugin extends Plugin
return $tags; return $tags;
} }
function getConversationUrl($notice)
{
$convurl = null;
if ($notice->hasConversation()) {
$conv = Conversation::staticGet(
'id',
$notice->conversation
);
$convurl = $conv->uri;
if(empty($convurl)) {
$msg = sprintf(
"Couldn't find Conversation ID %d to make 'in context'"
. "link for Notice ID %d",
$notice->conversation,
$notice->id
);
common_log(LOG_WARNING, $msg);
} else {
$convurl .= '#notice-' . $notice->id;
}
}
return $convurl;
}
function _getScripts() function _getScripts()
{ {
return array('plugins/Realtime/realtimeupdate.js'); return array('plugins/Realtime/realtimeupdate.js');

View File

@ -149,8 +149,8 @@ RealtimeUpdate = {
"from "+ "from "+
"<span class=\"device\">"+source+"</span>"+ // may have a link "<span class=\"device\">"+source+"</span>"+ // may have a link
"</span>"; "</span>";
if (data['in_reply_to_status_id']) { if (data['conversation_url']) {
ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>"; ni = ni+" <a class=\"response\" href=\""+data['conversation_url']+"\">in context</a>";
} }
if (repeat) { if (repeat) {