1
1
Fork 0

Merge pull request #9635 from MrPetovan/bug/notices

Batch of notice fixes
This commit is contained in:
Michael Vogel 2020-12-09 06:51:54 +01:00 committed by GitHub
commit 809035b872
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View file

@ -33,7 +33,7 @@ class Source extends BaseAdmin
{
parent::content($parameters);
$guid = basename($_REQUEST['guid'] ?? '') ?: $parameters['guid'];
$guid = basename($_REQUEST['guid'] ?? $parameters['guid'] ?? '');
$source = '';
$item_uri = '';

View file

@ -103,6 +103,10 @@ class Objects extends BaseModule
if (empty($parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
$activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
}
$activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type'];
// Only display "Create" activity objects here, no reshares or anything else

View file

@ -1003,10 +1003,10 @@ class Transmitter
* @param integer $item_id
* @param boolean $object_mode Is the activity item is used inside another object?
*
* @return array of activity
* @return false|array
* @throws \Exception
*/
public static function createActivityFromItem($item_id, $object_mode = false)
public static function createActivityFromItem(int $item_id, bool $object_mode = false)
{
Logger::info('Fetching activity', ['item' => $item_id]);
$item = Item::selectFirst([], ['id' => $item_id, 'parent-network' => Protocol::NATIVE_SUPPORT]);