]> git.mxchange.org Git - friendica.git/commitdiff
Replace "id = parent" checks with "gravity" checks
authorMichael <heluecht@pirati.ca>
Wed, 27 May 2020 12:19:06 +0000 (12:19 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 27 May 2020 12:19:06 +0000 (12:19 +0000)
13 files changed:
include/api.php
include/conversation.php
mod/display.php
mod/item.php
mod/network.php
mod/photos.php
mod/ping.php
src/Factory/Notification/Notification.php
src/Model/Item.php
src/Object/Post.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/OStatus.php

index 6f8c9524759414fa479ccc0e5b32383695fe89ed..f1a8e5ee94acf7ef8e2f07f489bd816bb6011dd4 100644 (file)
@@ -1559,7 +1559,7 @@ function api_search($type)
                $params['group_by'] = ['uri-id'];
        } else {
                $condition = ["`id` > ?
-                       " . ($exclude_replies ? " AND `id` = `parent` " : ' ') . "
+                       " . ($exclude_replies ? " AND `gravity` = " . GRAVITY_PARENT : ' ') . "
                        AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))
                        AND `body` LIKE CONCAT('%',?,'%')",
                        $since_id, api_user(), $_REQUEST['q']];
@@ -3028,7 +3028,7 @@ function api_format_item($item, $type = "json", $status_user = null, $author_use
        $retweeted_item = [];
        $quoted_item = [];
 
-       if ($item["id"] == $item["parent"]) {
+       if ($item['gravity'] == GRAVITY_PARENT) {
                $body = $item['body'];
                $retweeted_item = api_share_as_retweet($item);
                if ($body != $item['body']) {
index eb5e95d6db9f207ce3e6e7b59c8461ffb423102f..b163184af944144badc2a998ffa48020bc24c551 100644 (file)
@@ -671,7 +671,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
 
                                $item['pagedrop'] = $page_dropping;
 
-                               if ($item['id'] == $item['parent']) {
+                               if ($item['gravity'] == GRAVITY_PARENT) {
                                        $item_object = new Post($item);
                                        $conv->addParent($item_object);
                                }
@@ -948,7 +948,7 @@ function builtin_activity_puller($item, &$conv_responses) {
                                return;
                }
 
-               if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
+               if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['gravity'] != GRAVITY_PARENT)) {
                        $author = ['uid' => 0, 'id' => $item['author-id'],
                                'network' => $item['author-network'], 'url' => $item['author-link']];
                        $url = Contact::magicLinkByContact($author);
@@ -1218,7 +1218,7 @@ function get_item_children(array &$item_list, array $parent, $recursive = true)
 {
        $children = [];
        foreach ($item_list as $i => $item) {
-               if ($item['id'] != $item['parent']) {
+               if ($item['gravity'] != GRAVITY_PARENT) {
                        if ($recursive) {
                                // Fallback to parent-uri if thr-parent is not set
                                $thr_parent = $item['thr-parent'];
@@ -1366,7 +1366,7 @@ function conv_sort(array $item_list, $order)
 
        // Extract the top level items
        foreach ($item_array as $item) {
-               if ($item['id'] == $item['parent']) {
+               if ($item['gravity'] == GRAVITY_PARENT) {
                        $parents[] = $item;
                }
        }
index a06d8a72394fa3cd588e7f9f6346688faffc98ae..d3c0e024996d95fb37b512c339671b03e768c0eb 100644 (file)
@@ -54,7 +54,7 @@ function display_init(App $a)
        $item = null;
        $item_user = local_user();
 
-       $fields = ['id', 'parent', 'author-id', 'body', 'uid', 'guid'];
+       $fields = ['id', 'parent', 'author-id', 'body', 'uid', 'guid', 'gravity'];
 
        // If there is only one parameter, then check if this parameter could be a guid
        if ($a->argc == 2) {
@@ -101,12 +101,12 @@ function display_init(App $a)
        }
 
        if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
-               Logger::log('Directly serving XML for id '.$item["id"], Logger::DEBUG);
-               displayShowFeed($item["id"], false);
+               Logger::log('Directly serving XML for id '.$item['id'], Logger::DEBUG);
+               displayShowFeed($item['id'], false);
        }
 
-       if ($item["id"] != $item["parent"]) {
-               $parent = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
+       if ($item['gravity'] != GRAVITY_PARENT) {
+               $parent = Item::selectFirstForUser($item_user, $fields, ['id' => $item['parent']]);
                $item = $parent ?: $item;
        }
 
@@ -205,8 +205,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
                                $condition = ['guid' => $a->argv[1], 'uid' => local_user()];
                                $item = Item::selectFirstForUser(local_user(), $fields, $condition);
                                if (DBA::isResult($item)) {
-                                       $item_id = $item["id"];
-                                       $item_parent = $item["parent"];
+                                       $item_id = $item['id'];
+                                       $item_parent = $item['parent'];
                                        $item_parent_uri = $item['parent-uri'];
                                }
                        }
@@ -214,8 +214,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
                        if (($item_parent == 0) && remote_user()) {
                                $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => Item::PRIVATE, 'origin' => true]);
                                if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) {
-                                       $item_id = $item["id"];
-                                       $item_parent = $item["parent"];
+                                       $item_id = $item['id'];
+                                       $item_parent = $item['parent'];
                                        $item_parent_uri = $item['parent-uri'];
                                }
                        }
@@ -224,8 +224,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
                                $condition = ['private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $a->argv[1], 'uid' => 0];
                                $item = Item::selectFirstForUser(local_user(), $fields, $condition);
                                if (DBA::isResult($item)) {
-                                       $item_id = $item["id"];
-                                       $item_parent = $item["parent"];
+                                       $item_id = $item['id'];
+                                       $item_parent = $item['parent'];
                                        $item_parent_uri = $item['parent-uri'];
                                }
                        }
index ad3351dd4a38e242b2ea766ad1904093e5e33670..6671d9439335e8c91be42923fd189269e5fa32d4 100644 (file)
@@ -119,7 +119,7 @@ function item_post(App $a) {
                        // The URI and the contact is taken from the direct parent which needn't to be the top parent
                        $thr_parent_uri = $toplevel_item['uri'];
 
-                       if ($toplevel_item['id'] != $toplevel_item['parent']) {
+                       if ($toplevel_item['gravity'] != GRAVITY_PARENT) {
                                $toplevel_item = Item::selectFirst([], ['id' => $toplevel_item['parent']]);
                        }
                }
index 433d4079c1094475b37c591e80b6f0d9cdb9e334..16fde6c351970c0bdad12e468362f2afdc8e2367 100644 (file)
@@ -709,7 +709,7 @@ function networkThreadedView(App $a, $update, $parent)
                        }
                        if ($order === 'post') {
                                // Only show toplevel posts when updating posts in this order mode
-                               $sql_extra4 .= " AND `item`.`id` = `item`.`parent`";
+                               $sql_extra4 .= " AND `item`.`gravity` = " . GRAVITY_PARENT;
                        }
                }
 
index 7a647e06b94ef64f2440fe14802b2496375c0bb4..7b74a39dd8d3fb75b878f32cf38ac52861a8c3fc 100644 (file)
@@ -1456,7 +1456,7 @@ function photos_content(App $a)
 
                                        if (($activity->match($item['verb'], Activity::LIKE) ||
                                             $activity->match($item['verb'], Activity::DISLIKE)) &&
-                                           ($item['id'] != $item['parent'])) {
+                                           ($item['gravity'] != GRAVITY_PARENT)) {
                                                continue;
                                        }
 
index 168b508ea02468dac5761cf48f6613c0bcb57e79..73e759107b7f3eca0f1812e10bd4d0f39f3b627f 100644 (file)
@@ -467,13 +467,13 @@ function ping_get_notifications($uid)
 
                        if ($notification["visible"]
                                && !$notification["deleted"]
-                               && empty($result[$notification["parent"]])
+                               && empty($result[$notification['parent']])
                        ) {
                                // Should we condense the notifications or show them all?
                                if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
                                        $result[$notification["id"]] = $notification;
                                } else {
-                                       $result[$notification["parent"]] = $notification;
+                                       $result[$notification['parent']] = $notification;
                                }
                        }
                }
index 990d274a01cf183879d609de85d14ff9cb60c8a8..cedc0ad656813f71fc522a24b3e43489bb239637 100644 (file)
@@ -95,11 +95,11 @@ class Notification extends BaseFactory
                        $item['author-avatar'] = $item['contact-avatar'];
                }
 
-               $item['label'] = (($item['id'] == $item['parent']) ? 'post' : 'comment');
+               $item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment');
                $item['link']  = $this->baseUrl->get(true) . '/display/' . $item['parent-guid'];
                $item['image'] = Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO);
                $item['url']   = $item['author-link'];
-               $item['text']  = (($item['id'] == $item['parent'])
+               $item['text']  = (($item['gravity'] == GRAVITY_PARENT)
                        ? $this->l10n->t("%s created a new post", $item['author-name'])
                        : $this->l10n->t("%s commented on %s's post", $item['author-name'], $item['parent-author-name']));
                $item['when']  = DateTimeFormat::local($item['created'], 'r');
index 6b48acf4cbfa2437df93ba88a5e17d5f1fa7c608..a6036e6bdbe8c458e25f7e1dda44a948e331b294 100644 (file)
@@ -1047,7 +1047,7 @@ class Item
                $fields = ['id', 'uri', 'uri-id', 'uid', 'parent', 'parent-uri', 'origin',
                        'deleted', 'file', 'resource-id', 'event-id', 'attach',
                        'verb', 'object-type', 'object', 'target', 'contact-id',
-                       'icid', 'psid'];
+                       'icid', 'psid', 'gravity'];
                $item = self::selectFirst($fields, ['id' => $item_id]);
                if (!DBA::isResult($item)) {
                        Logger::info('Item not found.', ['id' => $item_id]);
@@ -1138,7 +1138,7 @@ class Item
                //}
 
                // If it's the parent of a comment thread, kill all the kids
-               if ($item['id'] == $item['parent']) {
+               if ($item['gravity'] == GRAVITY_PARENT) {
                        self::markForDeletion(['parent' => $item['parent'], 'deleted' => false], $priority);
                }
 
@@ -1494,7 +1494,7 @@ class Item
                                }
                        }
 
-                       $item["parent"]        = $parent['id'];
+                       $item['parent']        = $parent['id'];
                        $item["deleted"]       = $parent['deleted'];
                        $item["allow_cid"]     = $parent['allow_cid'];
                        $item['allow_gid']     = $parent['allow_gid'];
@@ -1529,8 +1529,8 @@ class Item
 
                        // If its a post that originated here then tag the thread as "mention"
                        if ($item['origin'] && $item['uid']) {
-                               DBA::update('thread', ['mention' => true], ['iid' => $item["parent"]]);
-                               Logger::info('tagged thread as mention', ['parent' => $item["parent"], 'uid' => $item['uid']]);
+                               DBA::update('thread', ['mention' => true], ['iid' => $item['parent']]);
+                               Logger::info('tagged thread as mention', ['parent' => $item['parent'], 'uid' => $item['uid']]);
                        }
 
                        // Update the contact relations
@@ -2246,7 +2246,7 @@ class Item
                }
 
                // Is it a toplevel post?
-               if ($item['id'] == $item['parent']) {
+               if ($item['gravity'] == GRAVITY_PARENT) {
                        self::addShadow($itemid);
                        return;
                }
@@ -2544,7 +2544,7 @@ class Item
 
                if (!$mention) {
                        if (($community_page || $prvgroup) &&
-                                 !$item['wall'] && !$item['origin'] && ($item['id'] == $item['parent'])) {
+                                 !$item['wall'] && !$item['origin'] && ($item['gravity'] == GRAVITY_PARENT)) {
                                Logger::info('Delete private group/communiy top-level item without mention', ['id' => $item_id, 'guid'=> $item['guid']]);
                                DBA::delete('item', ['id' => $item_id]);
                                return true;
@@ -2845,7 +2845,7 @@ class Item
                        return;
                }
 
-               $condition = ["`uid` = ? AND NOT `deleted` AND `id` = `parent` AND `gravity` = ?",
+               $condition = ["`uid` = ? AND NOT `deleted` AND `gravity` = ?",
                        $uid, GRAVITY_PARENT];
 
                /*
@@ -3227,9 +3227,9 @@ class Item
                        return DI::l10n()->t('event');
                } elseif (!empty($item['resource-id'])) {
                        return DI::l10n()->t('photo');
-               } elseif (!empty($item['verb']) && $item['verb'] !== Activity::POST) {
+               } elseif ($item['gravity'] == GRAVITY_ACTIVITY) {
                        return DI::l10n()->t('activity');
-               } elseif ($item['id'] != $item['parent']) {
+               } elseif ($item['gravity'] == GRAVITY_COMMENT) {
                        return DI::l10n()->t('comment');
                }
 
index 8488df000f5aa3d65d6ed72a498417c934f1e7c6..1ca02873d7f0d6b7a9144b53d5e46c98180c055c 100644 (file)
@@ -214,7 +214,7 @@ class Post
                        $pinned = DI::l10n()->t('pinned item');
                }
 
-               if ($origin && ($item['id'] != $item['parent']) && ($item['network'] == Protocol::ACTIVITYPUB)) {
+               if ($origin && ($item['gravity'] != GRAVITY_PARENT) && ($item['network'] == Protocol::ACTIVITYPUB)) {
                        // ActivityPub doesn't allow removal of remote comments
                        $delete = DI::l10n()->t('Delete locally');
                } else {
index 9ca23f1dcb71f41c5a1e9c6c346c24e809ab7564..54e44f5b9959dddf00029e89fb69ebb35a852266 100644 (file)
@@ -1059,7 +1059,7 @@ class DFRN
 
                if ($item['object-type'] != "") {
                        XML::addElement($doc, $entry, "activity:object-type", $item['object-type']);
-               } elseif ($item['id'] == $item['parent']) {
+               } elseif ($item['gravity'] == GRAVITY_PARENT) {
                        XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::NOTE);
                } else {
                        XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::COMMENT);
@@ -2110,7 +2110,7 @@ class DFRN
                                $author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
 
                                $parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => $importer["importer_uid"]]);
-                               $item["parent"] = $parent['id'];
+                               $item['parent'] = $parent['id'];
 
                                // send a notification
                                notification(
@@ -2129,7 +2129,7 @@ class DFRN
                                        "verb"         => $item["verb"],
                                        "otype"        => "person",
                                        "activity"     => $verb,
-                                       "parent"       => $item["parent"]]
+                                       "parent"       => $item['parent']]
                                );
                        }
                }
@@ -2634,7 +2634,7 @@ class DFRN
                }
 
                $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
-               $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted'], $condition);
+               $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file', 'deleted', 'gravity'], $condition);
                if (!DBA::isResult($item)) {
                        Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", Logger::DEBUG);
                        return;
@@ -2646,13 +2646,13 @@ class DFRN
                }
 
                // When it is a starting post it has to belong to the person that wants to delete it
-               if (($item['id'] == $item['parent']) && ($item['contact-id'] != $importer["id"])) {
+               if (($item['gravity'] == GRAVITY_PARENT) && ($item['contact-id'] != $importer["id"])) {
                        Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
                        return;
                }
 
                // Comments can be deleted by the thread owner or comment owner
-               if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) {
+               if (($item['gravity'] != GRAVITY_PARENT) && ($item['contact-id'] != $importer["id"])) {
                        $condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
                        if (!Item::exists($condition)) {
                                Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
index 243550862be8e93010f310318a87856288619955..c4e7d9fb87fcf5f16adfb456de50515c9876c458 100644 (file)
@@ -1517,7 +1517,7 @@ class Diaspora
        private static function parentItem($uid, $guid, $author, array $contact)
        {
                $fields = ['id', 'parent', 'body', 'wall', 'uri', 'guid', 'private', 'origin',
-                       'author-name', 'author-link', 'author-avatar',
+                       'author-name', 'author-link', 'author-avatar', 'gravity',
                        'owner-name', 'owner-link', 'owner-avatar'];
                $condition = ['uid' => $uid, 'guid' => $guid];
                $item = Item::selectFirst($fields, $condition);
@@ -2164,8 +2164,8 @@ class Diaspora
                $datarray["changed"] = $datarray["created"] = $datarray["edited"] = DateTimeFormat::utcNow();
 
                // like on comments have the comment as parent. So we need to fetch the toplevel parent
-               if ($parent_item["id"] != $parent_item["parent"]) {
-                       $toplevel = Item::selectFirst(['origin'], ['id' => $parent_item["parent"]]);
+               if ($parent_item['gravity'] != GRAVITY_PARENT) {
+                       $toplevel = Item::selectFirst(['origin'], ['id' => $parent_item['parent']]);
                        $origin = $toplevel["origin"];
                } else {
                        $origin = $parent_item["origin"];
@@ -2891,7 +2891,7 @@ class Diaspora
                        }
 
                        // Fetch the parent item
-                       $parent = Item::selectFirst(['author-link'], ['id' => $item["parent"]]);
+                       $parent = Item::selectFirst(['author-link'], ['id' => $item['parent']]);
 
                        // Only delete it if the parent author really fits
                        if (!Strings::compareLink($parent["author-link"], $contact["url"]) && !Strings::compareLink($item["author-link"], $contact["url"])) {
@@ -2901,7 +2901,7 @@ class Diaspora
 
                        Item::markForDeletion(['id' => $item['id']]);
 
-                       Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], Logger::DEBUG);
+                       Logger::log("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item['parent'], Logger::DEBUG);
                }
 
                return true;
@@ -3870,9 +3870,9 @@ class Diaspora
                        return $result;
                }
 
-               $toplevel_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]);
+               $toplevel_item = Item::selectFirst(['guid', 'author-id', 'author-link'], ['id' => $item['parent'], 'parent' => $item['parent']]);
                if (!DBA::isResult($toplevel_item)) {
-                       Logger::error('Missing parent conversation item', ['parent' => $item["parent"]]);
+                       Logger::error('Missing parent conversation item', ['parent' => $item['parent']]);
                        return false;
                }
 
@@ -4066,7 +4066,7 @@ class Diaspora
 
                $msg_type = "retraction";
 
-               if ($item['id'] == $item['parent']) {
+               if ($item['gravity'] == GRAVITY_PARENT) {
                        $target_type = "Post";
                } elseif (in_array($item["verb"], [Activity::LIKE, Activity::DISLIKE])) {
                        $target_type = "Like";
index 4cb27956bac2575ad77d2ba1a2e3586a3d554e5e..24decc000eda2ad2b41029c2ca4f29070bac3d56 100644 (file)
@@ -1675,7 +1675,7 @@ class OStatus
         */
        private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel)
        {
-               if (($item["id"] != $item["parent"]) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
+               if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
                        Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
                }
 
@@ -1740,7 +1740,7 @@ class OStatus
         */
        private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
        {
-               if (($item["id"] != $item["parent"]) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
+               if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
                        Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
                }
 
@@ -1824,7 +1824,7 @@ class OStatus
         */
        private static function followEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
        {
-               $item["id"] = $item["parent"] = 0;
+               $item["id"] = $item['parent'] = 0;
                $item["created"] = $item["edited"] = date("c");
                $item["private"] = Item::PRIVATE;
 
@@ -1889,7 +1889,7 @@ class OStatus
         */
        private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel, $feed_mode)
        {
-               if (($item["id"] != $item["parent"]) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
+               if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
                        Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
                }
 
@@ -2021,7 +2021,7 @@ class OStatus
                $mentioned = [];
 
                if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
-                       $parent = Item::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item["parent"]]);
+                       $parent = Item::selectFirst(['guid', 'author-link', 'owner-link'], ['id' => $item['parent']]);
                        $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
 
                        $thrparent = Item::selectFirst(['guid', 'author-link', 'owner-link', 'plink'], ['uid' => $owner["uid"], 'uri' => $parent_item]);
@@ -2047,7 +2047,7 @@ class OStatus
                        XML::addElement($doc, $entry, "link", "", $attributes);
                }
 
-               if (!$feed_mode && (intval($item["parent"]) > 0)) {
+               if (!$feed_mode && (intval($item['parent']) > 0)) {
                        $conversation_href = $conversation_uri = str_replace('/objects/', '/context/', $item['parent-uri']);
 
                        if (isset($parent_item)) {
@@ -2066,7 +2066,7 @@ class OStatus
 
                        $attributes = [
                                        "href" => $conversation_href,
-                                       "local_id" => $item["parent"],
+                                       "local_id" => $item['parent'],
                                        "ref" => $conversation_uri];
 
                        XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);