]> git.mxchange.org Git - friendica.git/blobdiff - include/ostatus.php
Revert unneeded changes in third-party libraries
[friendica.git] / include / ostatus.php
index 9b78495093e1b802767b0075b54ac3608d15e0ea..e0ed1df19a9f2a8123cddaa35978186e61432cb6 100644 (file)
@@ -355,6 +355,14 @@ class ostatus {
 
                        $item["body"] = add_page_info_to_body(html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue));
                        $item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
+                       $item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
+
+                       // Mastodon Content Warning
+                       if (($item["verb"] == ACTIVITY_POST) AND $xpath->evaluate('boolean(atom:summary)', $entry)) {
+                               $clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
+
+                               $item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
+                       }
 
                        if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) OR ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
                                $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
@@ -363,11 +371,10 @@ class ostatus {
                                $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
                        }
                        $item["object"] = $xml;
-                       $item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
 
                        /// @TODO
                        /// Delete a message
-                       if ($item["verb"] == "qvitter-delete-notice") {
+                       if ($item["verb"] == "qvitter-delete-notice" || $item["verb"] == ACTIVITY_DELETE) {
                                // ignore "Delete" messages (by now)
                                logger("Ignore delete message ".print_r($item, true));
                                continue;
@@ -713,11 +720,11 @@ class ostatus {
                        $conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term`
                                                STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid`
                                                WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention`
-                                               GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start));
+                                               GROUP BY `term`.`url`, `term`.`uid`, `term`.`oid`, `term`.`term` ORDER BY `term`.`term` DESC", dbesc($start));
                } else {
                        $conversations = q("SELECT `oid`, `url`, `uid` FROM `term`
                                                WHERE `type` = 7 AND `term` > '%s'
-                                               GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start));
+                                               GROUP BY `url`, `uid`, `oid`, `term` ORDER BY `term` DESC", dbesc($start));
                }
 
                foreach ($conversations AS $conversation) {
@@ -2052,7 +2059,7 @@ class ostatus {
 
                $mentioned = array();
 
-               if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
+               if (($item['parent'] != $item['id']) OR ($item['parent-uri'] !== $item['uri']) OR (($item['thr-parent'] !== '') AND ($item['thr-parent'] !== $item['uri']))) {
                        $parent = q("SELECT `guid`, `author-link`, `owner-link` FROM `item` WHERE `id` = %d", intval($item["parent"]));
                        $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);