]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge commit 'refs/merge-requests/25' of https://gitorious.org/social/mainline into...
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 10 Dec 2014 11:42:19 +0000 (12:42 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 10 Dec 2014 11:42:19 +0000 (12:42 +0100)
14 files changed:
actions/apitimelineuser.php
actions/deletegroup.php
classes/Notice.php
lib/activityobject.php
lib/queuemanager.php
lib/searchaction.php
lib/util.php
plugins/Directory/lib/sortablegrouplist.php
plugins/EmailSummary/lib/useremailsummaryhandler.php
plugins/EmailSummary/scripts/sendemailsummary.php
plugins/MobileProfile/mp-screen.css
plugins/OStatus/classes/Ostatus_profile.php
plugins/OStatus/scripts/update-profile-data.php
theme/base/css/display.css

index aa6cfca45858c2a4d293248f161d5e737446a580..26c960fa0429b9e1d176713cd4e65e60be43ddfa 100644 (file)
@@ -134,12 +134,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
                                           'id' => $this->target->id),
                                     array('max_id' => $this->next_id))
                     : null;
-        $lastNotice = $this->notices[0];
-        $lastId     = $lastNotice->id;
+
+        $prevExtra = array();
+        if (!empty($this->notices)) {
+            assert($this->notices[0] instanceof Notice);
+            $prevExtra['since_id'] = $this->notices[0]->id;
+        }
+
         $prevUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id),
-                                    array('since_id' => $lastId));
+                                    $prevExtra);
         $firstUrl = common_local_url('ApiTimelineUser',
                                     array('format' => $this->format,
                                           'id' => $this->target->id));
@@ -252,11 +257,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
             }
         }
 
-        if (empty($notices)) {
-            // TRANS: When no posts were found with specific or default parameters
-            $this->clientError(_('Did not find any posts within search parameters'), 404);
-        }
-
         return $notices;
     }
 
index 6d9d66d30e1f61ec86c8397373a63106b24414ab..c64bc1d8e90fd47fb91cfd4d0cd4743b358f8ad0 100644 (file)
@@ -171,6 +171,8 @@ class DeletegroupAction extends RedirectingAction
 
     function showContent() {
         $this->areYouSureForm();
+        $block = new GroupProfileBlock($this, $this->group);
+        $block->show();
     }
 
     /**
index 9328a76bb876b54b647c5a367cf1aa9161c2eb02..20374e0e2e06233ed03c9298aedb58d51f0ff27f 100644 (file)
@@ -608,7 +608,7 @@ class Notice extends Managed_DataObject
             if (empty($notice->conversation) and !empty($options['conversation'])) {
                 $conv = Conversation::getKV('uri', $options['conversation']);
                 if ($conv instanceof Conversation) {
-                    common_debug('Conversation stitched together from (probably) reply to unknown remote user. Activity creation time ('.$activity->time.') should maybe be compared to conversation creation time ('.$conv->created.').');
+                    common_debug('Conversation stitched together from (probably) reply to unknown remote user. Activity creation time ('.$notice->created.') should maybe be compared to conversation creation time ('.$conv->created.').');
                     $notice->conversation = $conv->id;
                 } else {
                     // Conversation URI was not found, so we must create it. But we can't create it
@@ -1271,10 +1271,16 @@ class Notice extends Managed_DataObject
         }
 
         // If this isn't a reply to anything, then it's its own
-        // root.
+        // root if it's the earliest notice in the conversation:
 
         if (empty($this->reply_to)) {
-            return $this;
+            $root = new Notice;
+            $root->conversation = $this->conversation;
+            $root->orderBy('notice.created ASC');
+            $root->find();
+            $root->fetch();
+            $root->free();
+            return $root;
         }
         
         if (is_null($profile)) {
index 7fe5c4850ca723105e4bfb82efb56d03450699f7..9a6218de3af9e954a97d7cd92a0e509c2f88fd24 100644 (file)
@@ -195,15 +195,22 @@ class ActivityObject
             $this->type = self::PERSON; // XXX: is this fair?
         }
 
-        // start with <atom:title>
 
-        $title = ActivityUtils::childHtmlContent($element, self::TITLE);
+        // Start with <poco::displayName>
 
-        if (!empty($title)) {
-            $this->title = common_strip_html($title);
+        $this->title = ActivityUtils::childContent($element, PoCo::DISPLAYNAME, PoCo::NS);
+
+        // try falling back to <atom:title>
+
+        if (empty($this->title)) {
+            $title = ActivityUtils::childHtmlContent($element, self::TITLE);
+
+            if (!empty($title)) {
+                $this->title = common_strip_html($title);
+            }
         }
 
-        // fall back to <atom:name>
+        // fall back to <atom:name> as a last resort
 
         if (empty($this->title)) {
             $this->title = $this->_childContent($element, self::NAME);
index bc18e1fc56fe9e39ca6a769c8eec9dcdd46ff599..d42e4b4b57e88ac31f7b35ddd6f22e46088ea467 100644 (file)
@@ -181,7 +181,10 @@ abstract class QueueManager extends IoManager
 
         // If it is a string, we really store a JSON object in there
         // except if it begins with '<', because then it is XML.
-        if (is_string($object) && substr($object, 0, 1) != '<') {
+        if (is_string($object) &&
+            substr($object, 0, 1) != '<' &&
+            !is_numeric($object))
+        {
             $json = json_decode($object);
             if ($json === null) {
                 throw new Exception('Bad frame in queue item');
index b994e20296b895078722ad028fe8b36defdf507b..f8acf34f072d69b5ca8f88cbdf4b2b9c96c409f6 100644 (file)
@@ -135,11 +135,11 @@ class SearchAction extends Action
             // TRANS: Standard search suggestions shown when a search does not give any results.
             $message .= sprintf(_("You can also try your search on other engines:
 
-* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=%%%%site.server%%%%)
-* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
-* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
-* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
-* [Collecta](http://collecta.com/#q=%s)"), $qe, $qe, $qe, $qe, $qe);
+* [DuckDuckGo](https://duckduckgo.com/?q=site%%3A%%%%site.server%%%%+%s)
+* [Ixquick](https://ixquick.com/do/search?query=site%%3A%%%%site.server%%%%+%s)
+* [Google](https://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
+* [Yahoo!](https://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
+"), $qe, $qe, $qe, $qe);
             $message .= "\n";
         }
         $this->elementStart('div', 'help instructions');
index 08a0cdea2fac9f736e164ac0e01e0a3f1bccd2c9..e18e1991ff5f3c2df0c470a6b3d79866fbc78a2a 100644 (file)
@@ -1261,6 +1261,7 @@ function common_path($relative, $ssl=false, $addSession=true)
     $pathpart = (common_config('site', 'path')) ? common_config('site', 'path')."/" : '';
 
     if (($ssl && (common_config('site', 'ssl') === 'sometimes'))
+        || StatusNet::isHTTPS()
         || common_config('site', 'ssl') === 'always') {
         $proto = 'https';
         if (is_string(common_config('site', 'sslserver')) &&
index 2849e75eba6fb69c5e8fc8f84dac17218d966d1c..7474d0daa608f9cfa9a037a8da1b4f71bf11e13a 100644 (file)
@@ -221,6 +221,23 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         $this->endProfile();
     }
 
+    function endActions()
+    {
+        // delete button
+        $cur = common_current_user();
+        list($action, $r2args) = $this->out->returnToArgs();
+        $r2args['action'] = $action;
+        if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
+            $this->out->elementStart('li', 'entity_delete');
+            $df = new DeleteGroupForm($this->out, $this->profile, $r2args);
+            $df->show();
+            $this->out->elementEnd('li');
+        }
+
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('td');
+    }
+
     function showActions()
     {
         $this->startActions();
index fe814a3fb5ba0610b5547a980f4ae63381c1b263..f900d93595108d3238493e419b96a08e1d0739fe 100644 (file)
@@ -103,7 +103,7 @@ class UserEmailSummaryHandler extends QueueHandler
         }
 
         // An InboxNoticeStream for a certain user, scoped to its own view
-        $stream = new InboxNoticeStream($profile, $profile);
+        $stream = new InboxNoticeStream($profile);
 
         $notice = $stream->getNotices(0, self::MAX_NOTICES, $since_id);
 
@@ -117,8 +117,8 @@ class UserEmailSummaryHandler extends QueueHandler
 
         $new_top = null;
 
-        if ($notice instanceof ArrayWrapper) {
-            $new_top = $notice->_items[0]->id;
+        if ($notice->fetch()) {
+            $new_top = $notice->id;
         }
 
         // TRANS: Subject for e-mail.
@@ -145,7 +145,7 @@ class UserEmailSummaryHandler extends QueueHandler
         $out->elementStart('table', array('width' => '550px',
                                           'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
 
-        while ($notice->fetch()) {
+        do {
             $profile = Profile::getKV('id', $notice->profile_id);
 
             if (empty($profile)) {
@@ -173,7 +173,7 @@ class UserEmailSummaryHandler extends QueueHandler
             $out->text(' ');
             $out->raw($notice->rendered);
             $out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
-            $noticeurl = $notice->getUrl();
+            $noticeurl = $notice->getLocalUrl();
             // above should always return an URL
             assert(!empty($noticeurl));
             $out->elementStart('a', array('rel' => 'bookmark',
@@ -189,7 +189,7 @@ class UserEmailSummaryHandler extends QueueHandler
             $out->elementEnd('div');
             $out->elementEnd('td');
             $out->elementEnd('tr');
-        }
+        } while ($notice->fetch());
 
         $out->elementEnd('table');
 
index 01c11a210a009c6edbba4cf2a752c6966ca0db48..06a5327f619560e7d65cc2cd473dfdb11509af59 100644 (file)
@@ -17,7 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
+define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
 
 $shortoptions = 'i:n:au';
 $longoptions = array('id=', 'nickname=', 'all', 'universe');
index 7a5a616f8cf7dfc81f1dab21e0ab71b37072a635..d25d3ebfe3f6219562179698fcc3807e71edd316 100644 (file)
@@ -351,7 +351,3 @@ label[for=blog-entry-content] {
 .notice .addressees:before {
     content: '\003E';
 }
-
-.user_in .notice div.e-content {
-  max-width: 150px;
-}
index 96ab7f6be72ab4cef7bb78d83ec2f183ab4d5b69..cf5e3f90edbdb86eb76523ef1c0b601d94c370dc 100644 (file)
@@ -985,7 +985,7 @@ class Ostatus_profile extends Managed_DataObject
      * @throws Exception on various error conditions
      * @throws OStatusShadowException if this reference would obscure a local user/group
      */
-    public static function ensureProfileURL($profile_url, $hints=array())
+    public static function ensureProfileURL($profile_url, array $hints=array())
     {
         $oprofile = self::getFromProfileURL($profile_url);
 
@@ -1118,7 +1118,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return Ostatus_profile
      * @throws Exception
      */
-    public static function ensureFeedURL($feed_url, $hints=array())
+    public static function ensureFeedURL($feed_url, array $hints=array())
     {
         $discover = new FeedDiscovery();
 
@@ -1161,7 +1161,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return Ostatus_profile
      * @throws Exception
      */
-    public static function ensureAtomFeed($feedEl, $hints)
+    public static function ensureAtomFeed(DOMElement $feedEl, array $hints)
     {
         $author = ActivityUtils::getFeedAuthor($feedEl);
 
@@ -1187,7 +1187,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return Ostatus_profile
      * @throws Exception
      */
-    public static function ensureRssChannel($feedEl, $hints)
+    public static function ensureRssChannel(DOMElement $feedEl, array $hints)
     {
         // Special-case for Posterous. They have some nice metadata in their
         // posterous:author elements. We should use them instead of the channel.
@@ -1296,7 +1296,7 @@ class Ostatus_profile extends Managed_DataObject
      * @param array $hints
      * @return mixed URL string or false
      */
-    public static function getActivityObjectAvatar($object, $hints=array())
+    public static function getActivityObjectAvatar(ActivityObject $object, array $hints=array())
     {
         if ($object->avatarLinks) {
             $best = false;
@@ -1325,7 +1325,7 @@ class Ostatus_profile extends Managed_DataObject
      * @param DOMElement $feed
      * @return string
      */
-    protected static function getAvatar($actor, $feed)
+    protected static function getAvatar(ActivityObject $actor, DOMElement $feed)
     {
         $url = '';
         $icon = '';
@@ -1376,7 +1376,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return Ostatus_profile
      * @throws Exception
      */
-    public static function ensureActorProfile($activity, $hints=array())
+    public static function ensureActorProfile(Activity $activity, array $hints=array())
     {
         return self::ensureActivityObjectProfile($activity->actor, $hints);
     }
@@ -1392,7 +1392,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return Ostatus_profile
      * @throws Exception
      */
-    public static function ensureActivityObjectProfile($object, $hints=array())
+    public static function ensureActivityObjectProfile(ActivityObject $object, array $hints=array())
     {
         $profile = self::getActivityObjectProfile($object);
         if ($profile instanceof Ostatus_profile) {
@@ -1408,7 +1408,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return mixed matching Ostatus_profile or false if none known
      * @throws ServerException if feed info invalid
      */
-    public static function getActorProfile($activity)
+    public static function getActorProfile(Activity $activity)
     {
         return self::getActivityObjectProfile($activity->actor);
     }
@@ -1418,7 +1418,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return mixed matching Ostatus_profile or false if none known
      * @throws ServerException if feed info invalid
      */
-    protected static function getActivityObjectProfile($object)
+    protected static function getActivityObjectProfile(ActivityObject $object)
     {
         $uri = self::getActivityObjectProfileURI($object);
         return Ostatus_profile::getKV('uri', $uri);
@@ -1433,7 +1433,7 @@ class Ostatus_profile extends Managed_DataObject
      * @return string
      * @throws ServerException if feed info invalid
      */
-    protected static function getActivityObjectProfileURI($object)
+    protected static function getActivityObjectProfileURI(ActivityObject $object)
     {
         if ($object->id) {
             if (ActivityUtils::validateUri($object->id)) {
@@ -1466,7 +1466,7 @@ class Ostatus_profile extends Managed_DataObject
      *
      * @return Ostatus_profile
      */
-    protected static function createActivityObjectProfile($object, $hints=array())
+    protected static function createActivityObjectProfile(ActivityObject $object, array $hints=array())
     {
         $homeuri = $object->id;
         $discover = false;
@@ -1631,7 +1631,7 @@ class Ostatus_profile extends Managed_DataObject
      * @param ActivityObject $object
      * @param array $hints
      */
-    public function updateFromActivityObject($object, $hints=array())
+    public function updateFromActivityObject(ActivityObject $object, array $hints=array())
     {
         if ($this->isGroup()) {
             $group = $this->localGroup();
@@ -1654,7 +1654,7 @@ class Ostatus_profile extends Managed_DataObject
         }
     }
 
-    public static function updateProfile($profile, $object, $hints=array())
+    public static function updateProfile(Profile $profile, ActivityObject $object, array $hints=array())
     {
         $orig = clone($profile);
 
@@ -1719,7 +1719,7 @@ class Ostatus_profile extends Managed_DataObject
         }
     }
 
-    protected static function updateGroup(User_group $group, $object, $hints=array())
+    protected static function updateGroup(User_group $group, ActivityObject $object, array $hints=array())
     {
         $orig = clone($group);
 
@@ -1743,7 +1743,7 @@ class Ostatus_profile extends Managed_DataObject
         }
     }
 
-    protected static function updatePeopletag($tag, $object, $hints=array()) {
+    protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array()) {
         $orig = clone($tag);
 
         $tag->tag = $object->title;
@@ -1764,7 +1764,7 @@ class Ostatus_profile extends Managed_DataObject
         }
     }
 
-    protected static function getActivityObjectHomepage($object, $hints=array())
+    protected static function getActivityObjectHomepage(ActivityObject $object, array $hints=array())
     {
         $homepage = null;
         $poco     = $object->poco;
@@ -1781,7 +1781,7 @@ class Ostatus_profile extends Managed_DataObject
         return $homepage;
     }
 
-    protected static function getActivityObjectLocation($object, $hints=array())
+    protected static function getActivityObjectLocation(ActivityObject $object, array $hints=array())
     {
         $location = null;
 
@@ -1803,7 +1803,7 @@ class Ostatus_profile extends Managed_DataObject
         return $location;
     }
 
-    protected static function getActivityObjectBio($object, $hints=array())
+    protected static function getActivityObjectBio(ActivityObject $object, array $hints=array())
     {
         $bio  = null;
 
@@ -1827,7 +1827,7 @@ class Ostatus_profile extends Managed_DataObject
         return $bio;
     }
 
-    public static function getActivityObjectNickname($object, $hints=array())
+    public static function getActivityObjectNickname(ActivityObject $object, array $hints=array())
     {
         if ($object->poco) {
             if (!empty($object->poco->preferredUsername)) {
index 116061a7c3bc626183a4a74d163da67bc558af5d..e024ed95a780f3b09b8771f0d7360671b7303320 100644 (file)
@@ -26,7 +26,8 @@ $helptext = <<<END_OF_HELP
 update-profile-data.php [options] [http://example.com/profile/url]
 
 Rerun profile discovery for the given OStatus remote profile, and save the
-updated profile data (nickname, avatar, bio, etc). Doesn't touch feed state.
+updated profile data (nickname, fullname, avatar, bio, etc).
+Doesn't touch feed state.
 Can be used to clean up after breakages.
 
 Options:
@@ -44,7 +45,7 @@ function showProfileInfo(Ostatus_profile $oprofile) {
     } else {
         $profile = $oprofile->localProfile();
         try {
-            foreach (array('nickname', 'bio', 'homepage', 'location') as $field) {
+            foreach (array('nickname', 'fullname', 'bio', 'homepage', 'location') as $field) {
                 print "  $field: {$profile->$field}\n";
             }
         } catch (NoProfileException $e) {
index 37f04eb62b84f48375e0026a2e1235a878889c4d..631a62ea5dca35ad81d80bae3bb14fed0c4e291b 100644 (file)
@@ -1363,9 +1363,6 @@ float:left;
 }
 
 
-.form_settings .form_data input {
-width:39%;
-}
 .form_settings .form_data input.submit,
 .form_settings .form_data input.checkbox,
 .form_settings .form_data input.radio {