function pleio_rest_created_river_async($river_id) { $ia = elgg_set_ignore_access(true); $river = elgg_get_river(array('id' => $river_id, 'site_guid' => null)); if (count($river) === 1) { $river = $river[0]; $notHandler = new \PleioRest\Services\PushNotificationHandler(); $notHandler->fanOutNotifications($river); } elgg_set_ignore_access($ia); }
/** * @SWG\Post( * path="/api/users/me/deregister_push", * security={{"oauth2": {"all"}}}, * tags={"user"}, * summary="Deregister application for push notifications.", * description="Deregister an application to receive push notifications of activities.", * produces={"application/json"}, * @SWG\Parameter( * name="service", * in="query", * description="The service (gcm, apns or wns)", * required=true, * type="string", * @SWG\Items(type="string") * ), * @SWG\Parameter( * name="device_id", * in="query", * description="The unique device ID registered with register_push.", * required=true, * type="string", * @SWG\Items(type="string") * ), * @SWG\Response( * response=200, * description="Succesful operation." * ) * ) */ public function deregisterPush($request, $response, $args) { $factory = new \PleioRest\AuthenticationServerFactory(); $server = $factory->getServer(); $accessData = $server->getAccessTokenData(\OAuth2\Request::createFromGlobals()); $vars = $request->getParsedBody(); $service = $vars['service']; $device_id = $vars['device_id']; if (!in_array($service, array('gcm', 'apns', 'wns'))) { return $response->withStatus(404); } $handler = new \PleioRest\Services\PushNotificationHandler(); $handler->removeSubscription(elgg_get_logged_in_user_entity(), $accessData['client_id'], $service, $device_id); }
/** * @SWG\Post( * path="/api/groups/{guid}/activities/mark_read", * security={{"oauth2": {"all"}}}, * tags={"activities"}, * summary="Mark the activities in the specific group as read.", * description="Mark the activities in the specific group as read till the most recent activity.", * produces={"application/json"}, * @SWG\Parameter( * name="guid", * in="path", * description="The guid of the specific group", * required=true, * type="integer", * @SWG\Items(type="integer") * ), * @SWG\Response( * response=200, * description="Succesful operation." * ), * @SWG\Response( * response="404", * description="Could not find the requested group." * ) * ) */ public function markRead($request, $response, $args) { $currentUser = elgg_get_logged_in_user_entity(); $guid = (int) $args['guid']; if (!$guid) { return $response->withStatus(404); } $container = get_entity($guid); if (!$container instanceof \ElggGroup) { return $response->withStatus(404); } $handler = new \PleioRest\Services\PushNotificationHandler(); $handler->markContainerAsRead($currentUser, $container); }