*/
const EMOJIREACT = ActivityNamespace::LITEPUB . '/emojireact';
+ /**
+ * View notification from Peertube
+ *
+ * @var string
+ */
+ const VIEW = ActivityNamespace::PEERTUBE . '/view';
+
/**
* likes (etc.) can apply to other things besides posts. Check if they are post children,
* in which case we handle them specially
self::FOLLOW,
self::ANNOUNCE,
self::EMOJIREACT,
+ self::VIEW,
];
/**
} else {
$object_data['directmessage'] = JsonLD::fetchElement($activity, 'litepub:directMessage');
}
- } elseif (in_array($type, array_merge(self::ACTIVITY_TYPES, ['as:Follow', 'litepub:EmojiReact'])) && in_array($object_type, self::CONTENT_TYPES)) {
+ } elseif (in_array($type, array_merge(self::ACTIVITY_TYPES, ['as:Follow', 'litepub:EmojiReact', 'as:View'])) && in_array($object_type, self::CONTENT_TYPES)) {
// Create a mostly empty array out of the activity data (instead of the object).
// This way we later don't have to check for the existence of each individual array element.
$object_data = self::processObject($activity);
break;
case 'as:View':
- if (in_array($object_data['object_type'], ['as:Note', 'as:Video'])) {
- // Unhandled Peertube activity
+ if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
+ ActivityPub\Processor::createActivity($object_data, Activity::VIEW);
+ } elseif ($object_data['object_type'] == '') {
+ // The object type couldn't be determined. Most likely we don't have it here. We ignore this activity.
} else {
self::storeUnhandledActivity(true, $type, $object_data, $activity, $body, $uid, $trust_source, $push, $signer);
}