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 _ChangeNotificationSetting
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -59,7 +59,7 @@ class _ChangeNotificationSetting
|
||||
* @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)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class _DeleteAttachment
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -58,7 +58,7 @@ class _DeleteAttachment
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return bool
|
||||
*/
|
||||
public function resolve($val, $args, $context, $info)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ class _DeleteAttachment
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_ATTACHMENT', '2C398/1', 404 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_ATTACHMENT', 'GQL/0004/1', 404 );
|
||||
}
|
||||
|
||||
/* Delete the maps - Only do this for attachments that have actually been saved (if they haven't been saved, there's nothing in core_attachments_map for us to delete */
|
||||
@@ -92,7 +92,7 @@ class _DeleteAttachment
|
||||
/* If the attachment hasn't been claimed yet, it should only be deletable by the person who uploaded it */
|
||||
if( $attachment['attach_member_id'] != \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANNOT_DELETE_OTHERS_ATTACHMENTS', '2C398/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'CANNOT_DELETE_OTHERS_ATTACHMENTS', 'GQL/0004/2', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -33,7 +33,7 @@ class _IgnoreUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'member' => TypeRegistry::nonNull( TypeRegistry::int() ),
|
||||
@@ -56,13 +56,13 @@ class _IgnoreUser
|
||||
* @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)
|
||||
{
|
||||
if ( !\in_array( $args['type'], \IPS\core\Ignore::types() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_TYPE', 'GQL/0001/4', 404 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_TYPE', 'GQL/0006/1', 404 );
|
||||
}
|
||||
|
||||
$type = $args['type'];
|
||||
@@ -70,17 +70,17 @@ class _IgnoreUser
|
||||
|
||||
if( !$member->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', 'GQL/0006/2', 403 );
|
||||
}
|
||||
|
||||
if ( $member->member_id == \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_SELF', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_SELF', 'GQL/0006/3', 403 );
|
||||
}
|
||||
|
||||
if ( !$member->canBeIgnored() )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_MEMBER', 'GQL/0001/4', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_IGNORE_MEMBER', 'GQL/0006/4', 403 );
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MarkNotificationRead
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::int()
|
||||
@@ -54,7 +54,7 @@ class _MarkNotificationRead
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return array|NULL
|
||||
*/
|
||||
public function resolve($val, $args)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class _AddConversationUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -70,14 +70,14 @@ class _AddConversationUser
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphql', 400 );
|
||||
}
|
||||
|
||||
// Fetch our new member
|
||||
$member = \IPS\Member::load( $args['memberId'] );
|
||||
|
||||
if( !$member->member_id ){
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', '1F294/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_MEMBER', '1F294/2_graphql', 403 );
|
||||
}
|
||||
|
||||
// Check member limit
|
||||
|
||||
@@ -33,7 +33,7 @@ class _LeaveConversation
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
@@ -70,7 +70,7 @@ class _LeaveConversation
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphl', 400 );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -33,7 +33,7 @@ class _RemoveConversationUser
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -70,7 +70,7 @@ class _RemoveConversationUser
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_MESSAGE', '1F294/2_graphl', 400 );
|
||||
}
|
||||
|
||||
if( $conversation->starter_id !== \IPS\Member::loggedIn()->member_id )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Unfollow
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'app' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -59,7 +59,7 @@ class _Unfollow
|
||||
* @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)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ class _UploadAttachment
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'name' => TypeRegistry::nonNull( TypeRegistry::string() ),
|
||||
@@ -89,7 +89,7 @@ class _UploadAttachment
|
||||
{
|
||||
if( !\in_array( mb_strtolower( $ext ), array_map( 'mb_strtolower', $allowedFileTypes ) ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_TYPE_NOT_ALLOWED', '2C399/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_TYPE_NOT_ALLOWED', '2C399/1_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +112,7 @@ class _UploadAttachment
|
||||
/* If this is the LAST chunk, finish the process */
|
||||
if ( $args['chunk'] === $args['totalChunks'] )
|
||||
{
|
||||
$url = $storageClass->chunkFinish( $ref );
|
||||
$file = \IPS\File::get( 'core_Attachment', $url );
|
||||
$file = $storageClass->chunkFinish( $ref, 'core_Attachment' );
|
||||
|
||||
/* If it's got an image extension, check it's actually a valid image */
|
||||
if ( \in_array( $ext, \IPS\Image::supportedExtensions() ) )
|
||||
@@ -124,7 +123,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_VALID_IMAGE', '2C399/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NOT_VALID_IMAGE', '2C399/2_graphql', 403 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +149,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \InvalidArgumentException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( $e->getMessage(), '2C399/2', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( $e->getMessage(), '2C399/2_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +160,7 @@ class _UploadAttachment
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_CREATION_FAILED', '2C399/3', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'FILE_CREATION_FAILED', '2C399/3_graphql', 403 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user