Merge pull request #8519 from annando/item-select

Fix: some selected item fields hadn't been selected
This commit is contained in:
Hypolite Petovan 2020-04-15 07:07:30 -04:00 committed by GitHub
commit 57cd063da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 31 deletions

View File

@ -342,10 +342,6 @@ class Item
}
}
if (array_key_exists('signed_text', $row) && array_key_exists('interaction', $row) && !is_null($row['interaction'])) {
$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'];
}
@ -672,7 +668,8 @@ class Item
{
$fields = [];
$fields['item'] = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', 'guid',
$fields['item'] = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent',
'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id',
'contact-id', 'owner-id', 'author-id', 'type', 'wall', 'gravity', 'extid',
'created', 'edited', 'commented', 'received', 'changed', 'psid',
'resource-id', 'event-id', 'tag', 'attach', 'post-type', 'file',
@ -714,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;
}
@ -852,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

@ -1072,7 +1072,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

@ -3941,30 +3941,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);