Merge remote-tracking branch 'upstream/develop' into term2tag

This commit is contained in:
Michael 2020-04-15 11:31:52 +00:00
commit f52614e249
3 changed files with 16 additions and 30 deletions

View file

@ -342,10 +342,6 @@ class Item
}
}
if (array_key_exists('interaction', $row)) {
$row['signed_text'] = $row['interaction'];
}
if (array_key_exists('ignored', $row) && array_key_exists('internal-user-ignored', $row) && !is_null($row['internal-user-ignored'])) {
$row['ignored'] = $row['internal-user-ignored'];
}
@ -715,7 +711,7 @@ class Item
'nofinish' => 'event-nofinish','adjust' => 'event-adjust',
'ignore' => 'event-ignore', 'id' => 'event-id'];
$fields['diaspora-interaction'] = ['interaction'];
$fields['diaspora-interaction'] = ['interaction', 'interaction' => 'signed_text'];
return $fields;
}
@ -853,10 +849,6 @@ class Item
$selected[] = 'internal-user-ignored';
}
if (in_array('signed_text', $selected)) {
$selected[] = 'interaction';
}
$legacy_fields = array_merge(ItemDeliveryData::LEGACY_FIELD_LIST, self::MIXED_CONTENT_FIELDLIST);
$selection = [];

View file

@ -1070,7 +1070,7 @@ class DFRN
// The signed text contains the content in Markdown, the sender handle and the signatur for the content
// It is needed for relayed comments to Diaspora.
if ($item['signed_text']) {
$sign = base64_encode(json_encode(['signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer']]));
$sign = base64_encode(json_encode(['signed_text' => $item['signed_text'],'signature' => '','signer' => '']));
XML::addElement($doc, $entry, "dfrn:diaspora_signature", $sign);
}

View file

@ -4016,30 +4016,24 @@ class Diaspora
Logger::log("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", Logger::DEBUG);
// Old way - is used by the internal Friendica functions
/// @todo Change all signatur storing functions to the new format
if ($item['signed_text'] && $item['signature'] && $item['signer']) {
$message = self::messageFromSignature($item);
} else {// New way
$msg = json_decode($item['signed_text'], true);
$msg = json_decode($item['signed_text'], true);
$message = [];
if (is_array($msg)) {
foreach ($msg as $field => $data) {
if (!$item["deleted"]) {
if ($field == "diaspora_handle") {
$field = "author";
}
if ($field == "target_type") {
$field = "parent_type";
}
$message = [];
if (is_array($msg)) {
foreach ($msg as $field => $data) {
if (!$item["deleted"]) {
if ($field == "diaspora_handle") {
$field = "author";
}
if ($field == "target_type") {
$field = "parent_type";
}
$message[$field] = $data;
}
} else {
Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], Logger::DEBUG);
$message[$field] = $data;
}
} else {
Logger::log("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], Logger::DEBUG);
}
$message["parent_author_signature"] = self::signature($owner, $message);