Retraction and reshares work

This commit is contained in:
Michael Vogel 2016-03-13 21:11:48 +01:00 committed by Roland Haeder
parent d176fff214
commit 77dbb4bfbc
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -1628,6 +1628,8 @@ class diaspora {
if (!$original_item) if (!$original_item)
return false; return false;
$orig_url = App::get_baseurl()."/display/".$original_item["guid"];
$datarray = array(); $datarray = array();
$datarray["uid"] = $importer["uid"]; $datarray["uid"] = $importer["uid"];
@ -1651,7 +1653,7 @@ class diaspora {
$datarray["object"] = json_encode($data); $datarray["object"] = json_encode($data);
$prefix = share_header($original_item["author-name"], $original_item["author-link"], $original_item["author-avatar"], $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["body"] = $prefix.$original_item["body"]."[/share]";
$datarray["tag"] = $original_item["tag"]; $datarray["tag"] = $original_item["tag"];
@ -1691,16 +1693,20 @@ class diaspora {
return false; return false;
// Only delete it if the author really fits // 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; return false;
}
// Check if the sender is the thread owner // Check if the sender is the thread owner
$p = q("SELECT `author-link`, `origin` FROM `item` WHERE `id` = %d", $p = q("SELECT `author-link`, `origin` FROM `item` WHERE `id` = %d",
intval($r[0]["parent"])); intval($r[0]["parent"]));
// Only delete it if the parent author really fits // 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; 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 // 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", q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' WHERE `id` = %d",
@ -1736,6 +1742,8 @@ class diaspora {
return false; return false;
} }
logger("Got retraction for ".$target_type.", sender ".$sender." and user ".$importer["uid"], LOGGER_DEBUG);
switch ($target_type) { switch ($target_type) {
case "Comment": case "Comment":
case "Like": case "Like":