]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fix error storing uris of remote notices
authorEvan Prodromou <evan@prodromou.name>
Tue, 26 Aug 2008 21:11:08 +0000 (17:11 -0400)
committerEvan Prodromou <evan@prodromou.name>
Tue, 26 Aug 2008 21:11:08 +0000 (17:11 -0400)
darcs-hash:20080826211108-84dde-b277bdb1476b9cec0c0d93fa8d565c4642ba16c8.gz

actions/postnotice.php
classes/Notice.php
lib/stream.php

index 261593c8643abb7f0523d8344cbd48639a8c0552..e5a3919ad8d6bcd11279434338933b22840c01fc 100644 (file)
@@ -74,7 +74,7 @@ class PostnoticeAction extends Action {
                }
                $notice = Notice::staticGet('uri', $notice_uri);
                if (!$notice) {
-                       $notice = Notice::saveNew($remote_profile->id, $content, 'omb', 0);
+                       $notice = Notice::saveNew($remote_profile->id, $content, 'omb', 0, $notice_uri);
                        if (is_string($notice)) {
                                common_server_serror($notice, 500);
                                return false;
index 57adb7ef824d8eb269c53992be61742a7ba6d985..8c2097589856e1b939c34d2daa6752dc1ace046b 100644 (file)
@@ -75,8 +75,8 @@ class Notice extends DB_DataObject
                }
                return true;
        }
-       
-       static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL) {
+
+       static function saveNew($profile_id, $content, $source=NULL, $is_local=1, $reply_to=NULL, $uri=NULL) {
                
                $notice = new Notice();
                $notice->profile_id = $profile_id;
@@ -96,12 +96,18 @@ class Notice extends DB_DataObject
                }
 
                $orig = clone($notice);
-               $notice->uri = common_notice_uri($notice);
+               if ($uri) {
+                       $notice->uri = $uri;
+               } else {
+                       $notice->uri = common_notice_uri($notice);
+               }
 
                if (!$notice->update($orig)) {
                        return _('Problem saving notice.');
                }
 
+               # XXX: do we need to change this for remote users?
+               
                common_save_replies($notice);
                $notice->saveTags();
                
index b94033d6a0af3843c40ad1af220762e83482b929..fbdba91c9771280937f7b2417433874d92e26b70 100644 (file)
@@ -96,8 +96,8 @@ class StreamAction extends Action {
                }
                common_element_end('p');
                $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
-               # XXX: we need to figure this out better
-               if ($notice->uri != $noticeurl && preg_match('/^http/', $notice->uri)) {
+               # XXX: we need to figure this out better. Is this right?
+               if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
                        $noticeurl = $notice->uri;
                }
                common_element_start('p', 'time');