]> git.mxchange.org Git - friendica.git/commitdiff
Retraction and reshares work
authorMichael Vogel <icarus@dabo.de>
Sun, 13 Mar 2016 20:11:48 +0000 (21:11 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 13 Mar 2016 20:11:48 +0000 (21:11 +0100)
include/diaspora2.php

index b031651675e2a39d779605a6f75ad0b7e8fdc4c1..f6b8b9a704165e976f9d05a8a97c22ca06ec0f0c 100644 (file)
@@ -1628,6 +1628,8 @@ class diaspora {
                if (!$original_item)
                        return false;
 
+               $orig_url = App::get_baseurl()."/display/".$original_item["guid"];
+
                $datarray = array();
 
                $datarray["uid"] = $importer["uid"];
@@ -1651,7 +1653,7 @@ class diaspora {
                $datarray["object"] = json_encode($data);
 
                $prefix = share_header($original_item["author-name"], $original_item["author-link"], $original_item["author-avatar"],
-                                       $original_item["guid"], $original_item["created"], $original_item["uri"]);
+                                       $original_item["guid"], $original_item["created"], $orig_url);
                $datarray["body"] = $prefix.$original_item["body"]."[/share]";
 
                $datarray["tag"] = $original_item["tag"];
@@ -1691,16 +1693,20 @@ class diaspora {
                        return false;
 
                // Only delete it if the author really fits
-               if (!link_compare($r[0]["author-link"],$person["url"]))
+               if (!link_compare($r[0]["author-link"], $person["url"])) {
+                       logger("Item author ".$r[0]["author-link"]." doesn't fit to expected contact ".$person["url"], LOGGER_DEBUG);
                        return false;
+               }
 
                // Check if the sender is the thread owner
                $p = q("SELECT `author-link`, `origin` FROM `item` WHERE `id` = %d",
                        intval($r[0]["parent"]));
 
                // Only delete it if the parent author really fits
-               if (!link_compare($p[0]["author-link"], $contact["url"]))
+               if (!link_compare($p[0]["author-link"], $contact["url"]) AND !link_compare($r[0]["author-link"], $contact["url"])) {
+                       logger("Thread author ".$p[0]["author-link"]." and item author ".$r[0]["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
                        return false;
+               }
 
                // Currently we don't have a central deletion function that we could use in this case. The function "item_drop" doesn't work for that case
                q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' WHERE `id` = %d",
@@ -1736,6 +1742,8 @@ class diaspora {
                        return false;
                }
 
+               logger("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
+
                switch ($target_type) {
                        case "Comment":
                        case "Like":