Merge pull request #3859 from annando/diaspora-dislike

Issue 3857: There is the possibility of a bad handling of dislikes
This commit is contained in:
Hypolite Petovan 2017-11-02 16:35:01 -04:00 committed by GitHub
commit e03f11b49e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3569,11 +3569,11 @@ class Diaspora {
// Split the signed text // Split the signed text
$signed_parts = explode(";", $signature['signed_text']); $signed_parts = explode(";", $signature['signed_text']);
if ($item["deleted"]) if ($item["deleted"]) {
$message = array("author" => $signature['signer'], $message = array("author" => $signature['signer'],
"target_guid" => $signed_parts[0], "target_guid" => $signed_parts[0],
"target_type" => $signed_parts[1]); "target_type" => $signed_parts[1]);
elseif ($item['verb'] === ACTIVITY_LIKE) } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
$message = array("author" => $signed_parts[4], $message = array("author" => $signed_parts[4],
"guid" => $signed_parts[1], "guid" => $signed_parts[1],
"parent_guid" => $signed_parts[3], "parent_guid" => $signed_parts[3],
@ -3581,7 +3581,7 @@ class Diaspora {
"positive" => $signed_parts[0], "positive" => $signed_parts[0],
"author_signature" => $signature['signature'], "author_signature" => $signature['signature'],
"parent_author_signature" => ""); "parent_author_signature" => "");
else { } else {
// Remove the comment guid // Remove the comment guid
$guid = array_shift($signed_parts); $guid = array_shift($signed_parts);
@ -3616,12 +3616,13 @@ class Diaspora {
*/ */
public static function send_relay($item, $owner, $contact, $public_batch = false) { public static function send_relay($item, $owner, $contact, $public_batch = false) {
if ($item["deleted"]) if ($item["deleted"]) {
return self::send_retraction($item, $owner, $contact, $public_batch, true); return self::send_retraction($item, $owner, $contact, $public_batch, true);
elseif ($item['verb'] === ACTIVITY_LIKE) } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
$type = "like"; $type = "like";
else } else {
$type = "comment"; $type = "comment";
}
logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG); logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
@ -3688,7 +3689,7 @@ class Diaspora {
if ($item['id'] == $item['parent']) { if ($item['id'] == $item['parent']) {
$target_type = "Post"; $target_type = "Post";
} elseif ($item["verb"] == ACTIVITY_LIKE) { } elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
$target_type = "Like"; $target_type = "Like";
} else { } else {
$target_type = "Comment"; $target_type = "Comment";