Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -33,7 +33,7 @@ class _Follow
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'app' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -64,7 +64,7 @@ class _Follow
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
@@ -72,35 +72,14 @@ class _Follow
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_LOGGED_IN', 'GQL/0001/6', 403 );
|
||||
}
|
||||
|
||||
/* Get class */
|
||||
$class = NULL;
|
||||
foreach ( \IPS\Application::load( $args['app'] )->extensions( 'core', 'ContentRouter' ) as $ext )
|
||||
try
|
||||
{
|
||||
foreach ( $ext->classes as $classname )
|
||||
{
|
||||
if ( $classname == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $classname;
|
||||
break;
|
||||
}
|
||||
if ( isset( $classname::$containerNodeClass ) and $classname::$containerNodeClass == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $classname::$containerNodeClass;
|
||||
break;
|
||||
}
|
||||
if( isset( $classname::$containerFollowClasses ) )
|
||||
{
|
||||
foreach( $classname::$containerFollowClasses as $followClass )
|
||||
{
|
||||
if( $followClass == 'IPS\\' . $args['app'] . '\\' . mb_ucfirst( $args['area'] ) )
|
||||
{
|
||||
$class = $followClass;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$class = \IPS\core\Followed\Follow::getClassToFollow( $args['app'], $args['area'] );
|
||||
}
|
||||
catch( \InvalidArgumentException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_FOUND', 'GQL/0001/4', 404 );
|
||||
}
|
||||
|
||||
if( $args['app'] == 'core' and $args['area'] == 'member' )
|
||||
@@ -123,18 +102,6 @@ class _Follow
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANT_FOLLOW_MEMBER', 'GQL/0001/3', 403 );
|
||||
}
|
||||
|
||||
$class = 'IPS\\Member';
|
||||
}
|
||||
|
||||
if( $args['app'] == 'core' and $args['area'] == 'club' )
|
||||
{
|
||||
$class = 'IPS\Member\Club';
|
||||
}
|
||||
|
||||
if ( !$class or !array_key_exists( $args['app'], \IPS\Application::applications() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_FOUND', 'GQL/0001/4', 404 );
|
||||
}
|
||||
|
||||
/* Get our return info ready */
|
||||
|
||||
Reference in new issue
Block a user