The post-reason / protocol is now filled in most cases
This commit is contained in:
parent
06a124338a
commit
b6da15557b
10 changed files with 69 additions and 29 deletions
|
|
@ -1535,13 +1535,7 @@ class Diaspora
|
|||
$datarray['owner-id'] = Contact::getIdForURL($contact['url'], 0);
|
||||
|
||||
// Will be overwritten for sharing accounts in Item::insert
|
||||
if (in_array($direction, [self::FETCHED, self::FORCED_FETCH])) {
|
||||
$datarray['post-reason'] = Item::PR_FETCHED;
|
||||
} elseif ($datarray['uid'] == 0) {
|
||||
$datarray['post-reason'] = Item::PR_GLOBAL;
|
||||
} else {
|
||||
$datarray['post-reason'] = Item::PR_COMMENT;
|
||||
}
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = self::getUriFromGuid($author, $guid);
|
||||
|
|
@ -1557,7 +1551,8 @@ class Diaspora
|
|||
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray['source'] = $xml;
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
$datarray['changed'] = $datarray['created'] = $datarray['edited'] = $created_at;
|
||||
|
||||
|
|
@ -1786,12 +1781,13 @@ class Diaspora
|
|||
$datarray = [];
|
||||
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $author_contact['cid'];
|
||||
$datarray['network'] = $author_contact['network'];
|
||||
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
$datarray['owner-link'] = $datarray['author-link'] = $person['url'];
|
||||
$datarray['owner-id'] = $datarray['author-id'] = Contact::getIdForURL($person['url'], 0);
|
||||
|
||||
|
|
@ -1965,12 +1961,13 @@ class Diaspora
|
|||
$datarray = [];
|
||||
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $author_contact['cid'];
|
||||
$datarray['network'] = $author_contact['network'];
|
||||
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
$datarray['owner-link'] = $datarray['author-link'] = $person['url'];
|
||||
$datarray['owner-id'] = $datarray['author-id'] = Contact::getIdForURL($person['url'], 0);
|
||||
|
||||
|
|
@ -2382,6 +2379,7 @@ class Diaspora
|
|||
$datarray['protocol'] = $item['protocol'];
|
||||
$datarray['source'] = $item['source'];
|
||||
$datarray['direction'] = $item['direction'];
|
||||
$datarray['post-reason'] = $item['post-reason'];
|
||||
|
||||
$datarray['plink'] = self::plink($author, $datarray['guid']);
|
||||
$datarray['private'] = $item['private'];
|
||||
|
|
@ -2468,7 +2466,8 @@ class Diaspora
|
|||
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray['source'] = $xml;
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
/// @todo Copy tag data from original post
|
||||
|
||||
|
|
@ -2690,6 +2689,29 @@ class Diaspora
|
|||
Post\Media::insert($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set direction and post reason
|
||||
*
|
||||
* @param array $datarray
|
||||
* @param integer $direction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function setDirection(array $datarray, int $direction): array
|
||||
{
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
if (in_array($direction, [self::FETCHED, self::FORCED_FETCH])) {
|
||||
$datarray['post-reason'] = Item::PR_FETCHED;
|
||||
} elseif ($datarray['uid'] == 0) {
|
||||
$datarray['post-reason'] = Item::PR_GLOBAL;
|
||||
} else {
|
||||
$datarray['post-reason'] = Item::PR_PUSHED;
|
||||
}
|
||||
|
||||
return $datarray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives status messages
|
||||
*
|
||||
|
|
@ -2780,13 +2802,8 @@ class Diaspora
|
|||
|
||||
$datarray['protocol'] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray['source'] = $xml;
|
||||
$datarray['direction'] = in_array($direction, [self::FETCHED, self::FORCED_FETCH]) ? Conversation::PULL : Conversation::PUSH;
|
||||
|
||||
if (in_array($direction, [self::FETCHED, self::FORCED_FETCH])) {
|
||||
$datarray['post-reason'] = Item::PR_FETCHED;
|
||||
} elseif ($datarray['uid'] == 0) {
|
||||
$datarray['post-reason'] = Item::PR_GLOBAL;
|
||||
}
|
||||
$datarray = self::setDirection($datarray, $direction);
|
||||
|
||||
$datarray['body'] = self::replacePeopleGuid($body, $contact['url']);
|
||||
$datarray['raw-body'] = self::replacePeopleGuid($raw_body, $contact['url']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue