]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' of gitorious.org:statusnet/mainline into testing
authorBrion Vibber <brion@pobox.com>
Tue, 18 May 2010 20:21:23 +0000 (13:21 -0700)
committerBrion Vibber <brion@pobox.com>
Tue, 18 May 2010 20:21:23 +0000 (13:21 -0700)
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/lib/discoveryhints.php
plugins/Realtime/README
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/realtimeupdate.js

index f183bc7aea81f15332f68bd4212756158d532ad5..5167842ca94719d2f9221cecd34ac8cf77c849de 100644 (file)
@@ -257,7 +257,7 @@ class OStatusPlugin extends Plugin
         $matches = array();
 
         // 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,
                        $wmatches,
                        PREG_OFFSET_CAPTURE)) {
index 80cfbbf15e589698e5903fcf1f02763516ed4e01..ca54a0f5f5547079a551efe9e97e40a34ee15729 100644 (file)
@@ -30,6 +30,7 @@ class DiscoveryHints {
             case Discovery::PROFILEPAGE:
                 $hints['profileurl'] = $link['href'];
                 break;
+            case Salmon::NS_MENTIONS:
             case Salmon::NS_REPLIES:
                 $hints['salmon'] = $link['href'];
                 break;
index 524382696b05f2a21a1cfb6ddf3738b24305f53a..99c79cfab541d8b5b5e2076321d6c8f35eb90883 100644 (file)
@@ -1,6 +1,5 @@
 == TODO ==
 * i18n
-* Change in context URL to conversation (try not to construct the URL in JS)
 * Update mark behaviour (on notice send)
 * Pause, Send a notice ~ should not update counter
 * Pause ~ retain up to 50-100 most recent notices
index b559d80c605a540aa333299fb3e25deb998a0f35..352afcf7853ff4a76eb3fb858954ebc22f3bcfa4 100644 (file)
@@ -250,14 +250,7 @@ class RealtimePlugin extends Plugin
         $arr['url'] = $notice->bestUrl();
         $arr['html'] = htmlspecialchars($notice->rendered);
         $arr['source'] = htmlspecialchars($arr['source']);
-
-        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;
-        }
+        $arr['conversation_url'] = $this->getConversationUrl($notice);
 
         $profile = $notice->getProfile();
         $arr['user']['profile_url'] = $profile->profileurl;
@@ -272,10 +265,7 @@ class RealtimePlugin extends Plugin
                 $arr['retweeted_status']['source'] = htmlspecialchars($original->source);
                 $originalProfile = $original->getProfile();
                 $arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
-                if (!empty($original->reply_to)) {
-                    $originalReply = Notice::staticGet('id', $original->reply_to);
-                    $arr['retweeted_status']['in_reply_to_status_url'] = $originalReply->bestUrl();
-                }
+                $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
             }
             $original = null;
         }
@@ -303,6 +293,34 @@ class RealtimePlugin extends Plugin
         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()
     {
         return array('plugins/Realtime/realtimeupdate.js');
index 2e5851ae531e539dc07f85a0d0eab80915a87fc8..25dc12d584617adc11eae223a6de2e17962696a4 100644 (file)
@@ -149,8 +149,8 @@ RealtimeUpdate = {
                "from "+
                 "<span class=\"device\">"+source+"</span>"+ // may have a link
                "</span>";
-          if (data['in_reply_to_status_id']) {
-               ni = ni+" <a class=\"response\" href=\""+data['in_reply_to_status_url']+"\">in context</a>";
+          if (data['conversation_url']) {
+               ni = ni+" <a class=\"response\" href=\""+data['conversation_url']+"\">in context</a>";
           }
 
           if (repeat) {