mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:15:14 +00:00
recent updated timestamp issues
This commit is contained in:
parent
7931f052bf
commit
27c1dedb7a
3 changed files with 25 additions and 21 deletions
|
@ -3070,13 +3070,6 @@ class Activity
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(array_key_exists('created', $item) && $item['created'])) {
|
||||
$item['created'] = datetime_convert();
|
||||
}
|
||||
if (!(array_key_exists('edited', $item) && $item['edited'])) {
|
||||
$item['edited'] = $item['created'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set item 'replyto' to the attributedTo field of a target Collection or alternatively to
|
||||
|
@ -3265,6 +3258,15 @@ class Activity
|
|||
}
|
||||
}
|
||||
|
||||
// Set default date and time if no date fields were found (including within response activities).
|
||||
|
||||
if (!(array_key_exists('created', $item) && $item['created'])) {
|
||||
$item['created'] = datetime_convert();
|
||||
}
|
||||
if (!(array_key_exists('edited', $item) && $item['edited'])) {
|
||||
$item['edited'] = $item['created'];
|
||||
}
|
||||
|
||||
$item['comment_policy'] = 'authenticated';
|
||||
|
||||
if ($item['mid'] === $item['parent_mid']) {
|
||||
|
|
|
@ -182,11 +182,11 @@ class Enotify
|
|||
return;
|
||||
}
|
||||
|
||||
if (activity_match($params['verb'], ACTIVITY_LIKE)) {
|
||||
if (activity_match($params['item']['verb'], ACTIVITY_LIKE)) {
|
||||
$action = t('liked');
|
||||
}
|
||||
|
||||
if (activity_match($params['verb'], ACTIVITY_DISLIKE)) {
|
||||
if (activity_match($params['item']['verb'], ACTIVITY_DISLIKE)) {
|
||||
$action = t('disliked');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1605,13 +1605,13 @@ class Libzot
|
|||
* @param ActivityStreams object $act
|
||||
* @param array $msg_arr
|
||||
* @param array $deliveries
|
||||
* @param bool $relay
|
||||
* @param bool $isGoingUpstream
|
||||
* @param bool $public (optional) default false
|
||||
* @param bool $request (optional) default false - message was fetched, not posted
|
||||
* @return array|false|void
|
||||
*/
|
||||
|
||||
public static function process_delivery($sender, $act, $msg_arr, $deliveries, $relay, $public = false, $request = false, $isCollectionOperation = false)
|
||||
public static function process_delivery($sender, $act, $msg_arr, $deliveries, $isGoingUpstream, $public = false, $request = false, $isCollectionOperation = false)
|
||||
{
|
||||
|
||||
$result = [];
|
||||
|
@ -1666,7 +1666,9 @@ class Libzot
|
|||
|
||||
$DR->set_name($channel['channel_name'] . ' <' . Channel::get_webfinger($channel) . '>');
|
||||
|
||||
if (str_contains($arr['tgt_type'], 'Collection') && !$relay && !$isCollectionOperation) {
|
||||
$conversationOperation = $isCollectionOperation && in_array($arr['target'], 'attributedTo');
|
||||
|
||||
if (str_contains($arr['tgt_type'], 'Collection') && !$isGoingUpstream && !$conversationOperation) {
|
||||
$DR->update('not a collection activity');
|
||||
$result[] = $DR->get();
|
||||
continue;
|
||||
|
@ -1715,7 +1717,7 @@ class Libzot
|
|||
// for comments travelling upstream. Wait and catch them on the way down.
|
||||
// They may have been blocked by the owner.
|
||||
|
||||
if (intval($channel['channel_system']) && (!$arr['item_private']) && (!$relay)) {
|
||||
if (intval($channel['channel_system']) && (!$arr['item_private']) && (!$isGoingUpstream)) {
|
||||
$local_public = true;
|
||||
|
||||
$public_stream_mode = (int) Config::Get('system', 'public_stream_mode', PUBLIC_STREAM_NONE);
|
||||
|
@ -1773,7 +1775,7 @@ class Libzot
|
|||
|
||||
$perm = 'send_stream';
|
||||
if ($arr['mid'] !== $arr['parent_mid']) {
|
||||
if ($relay) {
|
||||
if ($isGoingUpstream) {
|
||||
$perm = 'post_comments';
|
||||
}
|
||||
}
|
||||
|
@ -1871,7 +1873,7 @@ class Libzot
|
|||
}
|
||||
|
||||
if ($arr['mid'] !== $arr['parent_mid']) {
|
||||
if ((perm_is_allowed($channel['channel_id'], $sender, 'moderated') || $allowed === 'moderated') && $relay) {
|
||||
if ((perm_is_allowed($channel['channel_id'], $sender, 'moderated') || $allowed === 'moderated') && $isGoingUpstream) {
|
||||
$arr['item_blocked'] = ITEM_MODERATED;
|
||||
}
|
||||
|
||||
|
@ -1914,7 +1916,7 @@ class Libzot
|
|||
// this is just an exercise in futility.
|
||||
|
||||
if (
|
||||
(!$relay) && (!$request) && (!$local_public)
|
||||
(!$isGoingUpstream) && (!$request) && (!$local_public)
|
||||
&& perm_is_allowed($channel['channel_id'], $sender, 'send_stream')
|
||||
&& perm_is_allowed($channel['channel_id'], $sender, 'hyperdrive')
|
||||
) {
|
||||
|
@ -1974,11 +1976,11 @@ class Libzot
|
|||
$arr['aid'] = $channel['channel_account_id'];
|
||||
$arr['uid'] = $channel['channel_id'];
|
||||
|
||||
$item_id = self::delete_imported_item($sender, $act, $arr, $channel['channel_id'], $relay);
|
||||
$item_id = self::delete_imported_item($sender, $act, $arr, $channel['channel_id'], $isGoingUpstream);
|
||||
$DR->update(($item_id) ? 'deleted' : 'delete_failed');
|
||||
$result[] = $DR->get();
|
||||
|
||||
if ($relay && $item_id) {
|
||||
if ($isGoingUpstream && $item_id) {
|
||||
logger('process_delivery: invoking relay');
|
||||
Run::Summon(['Notifier', 'relay', intval($item_id)]);
|
||||
$DR->update('relayed');
|
||||
|
@ -2034,7 +2036,7 @@ class Libzot
|
|||
$DR->update('updated');
|
||||
$result[] = $DR->get();
|
||||
}
|
||||
if ($relay && $channel['channel_hash'] === $item_result['item']['owner_xchan'] && $item_result['item']['verb'] !== 'Add' && !$isCollectionOperation) {
|
||||
if ($isGoingUpstream && $channel['channel_hash'] === $item_result['item']['owner_xchan'] && $item_result['item']['verb'] !== 'Add' && !$isCollectionOperation) {
|
||||
$approval = Activity::addToCollection($channel, $act->data, $item_result['item']['parent_mid'], $item_result['item'], deliver: false);
|
||||
}
|
||||
|
||||
|
@ -2108,7 +2110,7 @@ class Libzot
|
|||
//logger('owner_xchan: ' . $item_result['item']['owner_xchan']);
|
||||
//logger('verb: ' . $arr['verb']);
|
||||
|
||||
if ($relay && $channel['channel_hash'] === $item_result['item']['owner_xchan'] && $item_result['item']['verb'] !== 'Add' && !$isCollectionOperation) {
|
||||
if ($isGoingUpstream && $channel['channel_hash'] === $item_result['item']['owner_xchan'] && $item_result['item']['verb'] !== 'Add' && !$isCollectionOperation) {
|
||||
$approval = Activity::addToCollection($channel, $act->data, $item_result['item']['parent_mid'], $item_result['item'], deliver: false);
|
||||
}
|
||||
$parr = [
|
||||
|
@ -2140,7 +2142,7 @@ class Libzot
|
|||
retain_item($stored['item']['parent']);
|
||||
}
|
||||
|
||||
if ($relay && $item_id) {
|
||||
if ($isGoingUpstream && $item_id) {
|
||||
logger('Invoking relay');
|
||||
Run::Summon(['Notifier', 'relay', intval($item_id)]);
|
||||
if (!empty($approval) && $approval['item_id']) {
|
||||
|
|
Loading…
Reference in a new issue