mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
deal with expiring peertube View activities which only exist for 2 minutes
This commit is contained in:
parent
262777b68d
commit
a655d11423
2 changed files with 5 additions and 3 deletions
|
@ -2955,6 +2955,7 @@ class Activity
|
|||
} elseif ($act->objprop('updated')) {
|
||||
$item['edited'] = datetime_convert('UTC', 'UTC', $act->obj['updated']);
|
||||
}
|
||||
|
||||
if (array_key_exists('expires', $act->data) && $act->data['expires']) {
|
||||
$item['expires'] = datetime_convert('UTC', 'UTC', $act->data['expires']);
|
||||
} elseif ($act->objprop('expires')) {
|
||||
|
@ -2966,8 +2967,9 @@ class Activity
|
|||
} elseif ($act->objprop('expiresAt')) {
|
||||
$item['expires'] = datetime_convert('UTC', 'UTC', $act->obj['expiresAt']);
|
||||
}
|
||||
|
||||
if ($item['expires'] > NULL_DATE && $item['expires'] < datetime_convert()) {
|
||||
// this will prevent peertube View activities which only exist for 2 minutes, but are like
|
||||
// scrobblers and seem to only put noise into your stream and then vanish abruptly.
|
||||
if ($item['expires'] > NULL_DATE && $item['expires'] < datetime_convert(datetime: 'now + 15 minutes')) {
|
||||
// We shouldn't even be seeing this activity.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -953,7 +953,7 @@ function encode_item($item,$mirror = false) {
|
|||
$x['created'] = $item['created'];
|
||||
$x['edited'] = $item['edited'];
|
||||
// always send 0's over the wire
|
||||
$x['expires'] = (($item['expires'] == '0001-01-01 00:00:00') ? '0000-00-00 00:00:00' : $item['expires']);
|
||||
$x['expires'] = (($item['expires'] === '0001-01-01 00:00:00') ? '0000-00-00 00:00:00' : $item['expires']);
|
||||
$x['commented'] = $item['commented'];
|
||||
$x['mimetype'] = $item['mimetype'];
|
||||
$x['title'] = $item['title'];
|
||||
|
|
Loading…
Reference in a new issue