Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -38,7 +38,7 @@ class _CreateTopic extends \IPS\Content\Api\GraphQL\ItemMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'forumID' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -64,7 +64,7 @@ class _CreateTopic extends \IPS\Content\Api\GraphQL\ItemMutator
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return \IPS\forums\Topic
|
||||
*/
|
||||
public function resolve($val, $args, $context, $info)
|
||||
{
|
||||
@@ -75,23 +75,23 @@ class _CreateTopic extends \IPS\Content\Api\GraphQL\ItemMutator
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_FORUM', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_FORUM', '1F294/2_graphl', 400 );
|
||||
}
|
||||
|
||||
/* Check permission */
|
||||
if ( !$forum->can( 'add', \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_PERMISSION', '2F294/9', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_PERMISSION', '2F294/9_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Check we have a title and a post */
|
||||
if ( !$args['title'] )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TITLE', '1F294/5', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TITLE', '1F294/5_graphl', 400 );
|
||||
}
|
||||
if ( !$args['content'] )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F294/4', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F294/4_graphl', 400 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user