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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MarkForumRead extends \IPS\Node\Api\GraphQL\NodeMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MarkTopicRead extends \IPS\Content\Api\GraphQL\ItemMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _MarkTopicSolved extends \IPS\Node\Api\GraphQL\NodeMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
|
||||
@@ -38,7 +38,7 @@ class _PostReaction extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'postID' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -61,7 +61,7 @@ class _PostReaction extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Forum
|
||||
* @return \IPS\forums\Topic\Post
|
||||
*/
|
||||
public function resolve($val, $args, $context, $info)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ class _PostReaction extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
|
||||
@@ -38,7 +38,7 @@ class _ReplyTopic extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'topicID' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -73,19 +73,19 @@ class _ReplyTopic extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TOPIC', '1F295/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TOPIC', '1F295/1_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Get author */
|
||||
if ( !$topic->canComment( \IPS\Member::loggedIn() ) )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_PERMISSION', '2F294/A', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_PERMISSION', '2F294/A_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Check we have a post */
|
||||
if ( !$args['content'] )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/3', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/3_graphl', 403 );
|
||||
}
|
||||
|
||||
$originalPost = NULL;
|
||||
|
||||
@@ -38,7 +38,7 @@ class _ReportPost extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -75,7 +75,7 @@ class _ReportPost extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
|
||||
@@ -38,7 +38,7 @@ class _RevokePostReport extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
@@ -71,7 +71,7 @@ class _RevokePostReport extends \IPS\Content\Api\GraphQL\CommentMutator
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_POST', '1F295/1_graphl', 403 );
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
|
||||
@@ -33,7 +33,7 @@ class _SetBestAnswer
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _VoteAnswer
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
|
||||
@@ -39,7 +39,7 @@ class _VoteInPoll extends \IPS\Poll\Api\GraphQL\PollMutator
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'itemID' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
|
||||
@@ -33,7 +33,7 @@ class _VoteQuestion
|
||||
/*
|
||||
* Mutation arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return [
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Forum
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() ),
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Forums
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::id()
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Post
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Topic
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'id' => TypeRegistry::nonNull( TypeRegistry::id() )
|
||||
@@ -64,12 +64,12 @@ class _Topic
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TOPIC', '1F294/2', 400 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'NO_TOPIC', '1F294/2_graphql', 400 );
|
||||
}
|
||||
|
||||
if( !$topic->can('read') )
|
||||
{
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_ID', '2F294/9', 403 );
|
||||
throw new \IPS\Api\GraphQL\SafeException( 'INVALID_ID', '2F294/9_graphql', 403 );
|
||||
}
|
||||
|
||||
return $topic;
|
||||
|
||||
@@ -33,7 +33,7 @@ class _Topics
|
||||
/*
|
||||
* Query arguments
|
||||
*/
|
||||
public function args()
|
||||
public function args(): array
|
||||
{
|
||||
return array(
|
||||
'forums' => TypeRegistry::listOf( TypeRegistry::int() ),
|
||||
@@ -82,7 +82,7 @@ class _Topics
|
||||
* @param mixed Value passed into this resolver
|
||||
* @param array Arguments
|
||||
* @param array Context values
|
||||
* @return \IPS\forums\Topic\Post
|
||||
* @return \IPS\forums\Topic
|
||||
*/
|
||||
public function resolve($val, $args, $context, $info)
|
||||
{
|
||||
|
||||
@@ -27,10 +27,33 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _TypeRegistry
|
||||
{
|
||||
/**
|
||||
* Returns the forum instance
|
||||
*
|
||||
* @var \IPS\forums\api\GraphQL\Types\ForumType
|
||||
*/
|
||||
protected static $forum;
|
||||
protected static $post;
|
||||
protected static $topic;
|
||||
protected static $vote;
|
||||
|
||||
/**
|
||||
* Returns the post instance
|
||||
*
|
||||
* @var \IPS\forums\api\GraphQL\Types\PostType
|
||||
*/
|
||||
protected static $post;
|
||||
|
||||
/**
|
||||
* Returns the topic instance
|
||||
*
|
||||
* @var \IPS\forums\api\GraphQL\Types\TopicType
|
||||
*/
|
||||
protected static $topic;
|
||||
|
||||
/**
|
||||
* Returns the vote instance
|
||||
*
|
||||
* @var \IPS\forums\api\GraphQL\Types\VoteType
|
||||
*/
|
||||
protected static $vote;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -43,7 +66,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return ForumType
|
||||
*/
|
||||
public static function forum()
|
||||
public static function forum() : \IPS\forums\api\GraphQL\Types\ForumType
|
||||
{
|
||||
return self::$forum ?: (self::$forum = new \IPS\forums\api\GraphQL\Types\ForumType());
|
||||
}
|
||||
@@ -51,15 +74,15 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return PostType
|
||||
*/
|
||||
public static function post()
|
||||
{
|
||||
return self::$post ?: (self::$post = new \IPS\forums\api\GraphQL\Types\PostType());
|
||||
}
|
||||
public static function post() : \IPS\forums\api\GraphQL\Types\PostType
|
||||
{
|
||||
return self::$post ?: (self::$post = new \IPS\forums\api\GraphQL\Types\PostType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TopicType
|
||||
*/
|
||||
public static function topic()
|
||||
public static function topic() : \IPS\forums\api\GraphQL\Types\TopicType
|
||||
{
|
||||
return self::$topic ?: (self::$topic = new \IPS\forums\api\GraphQL\Types\TopicType());
|
||||
}
|
||||
@@ -67,7 +90,7 @@ class _TypeRegistry
|
||||
/**
|
||||
* @return VoteType
|
||||
*/
|
||||
public static function vote()
|
||||
public static function vote() : \IPS\forums\api\GraphQL\Types\VoteType
|
||||
{
|
||||
return self::$vote ?: (self::$vote = new \IPS\forums\api\GraphQL\Types\VoteType());
|
||||
}
|
||||
|
||||
@@ -123,9 +123,6 @@ class _PostType extends \IPS\Content\Api\GraphQL\CommentType
|
||||
]
|
||||
);
|
||||
|
||||
// Duplicate fields that have different names in posts
|
||||
//$defaultFields['topic'] = $defaultFields['item'];
|
||||
|
||||
// Remove duplicated fields
|
||||
unset( $defaultFields['item'] );
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class _topics extends \IPS\Content\Api\ItemController
|
||||
*
|
||||
* @note For requests using an OAuth Access Token for a particular member, only topics the authorized user can view will be included
|
||||
* @apiparam string forums Comma-delimited list of forum IDs
|
||||
* @apiparam string ids Comma-delimited list of topic IDs
|
||||
* @apiparam string authors Comma-delimited list of member IDs - if provided, only topics started by those members are returned
|
||||
* @apiparam int hasBestAnswer If 1, only topics with a best answer are returned, if 0 only without
|
||||
* @apiparam int hasPoll If 1, only topics with a poll are returned, if 0 only without
|
||||
|
||||
Reference in new issue
Block a user