Version 5.0.0 beta 10
This commit is contained in:
1 parent
56979f8ee8
commit
264eeb97e0
325 files changed
+6442
-1849
No files matched your search
@@ -67,10 +67,10 @@ class DeleteAttachment
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return bool
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : bool
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : bool
|
||||
{
|
||||
/* Get the attachment */
|
||||
try
|
||||
|
||||
@@ -84,10 +84,10 @@ class UploadAttachment
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return array
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : array
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : array
|
||||
{
|
||||
$storageClass = File::getClass( 'core_Attachment' );
|
||||
$contents = base64_decode( $args['contents'] );
|
||||
|
||||
@@ -88,10 +88,10 @@ class Members
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return ActiveRecordIterator
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : ActiveRecordIterator
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : ActiveRecordIterator
|
||||
{
|
||||
$where = [];
|
||||
$sortBy = ( isset( $args['orderBy'] ) and in_array( $args['orderBy'], MemberType::getOrderByOptions() ) ) ? $args['orderBy'] : 'member_id';
|
||||
|
||||
@@ -58,10 +58,10 @@ class MessengerConversation
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return Conversation
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : Conversation
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : Conversation
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -107,10 +107,10 @@ class MessengerConversations
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return ActiveRecordIterator|array
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : ActiveRecordIterator|array
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : ActiveRecordIterator|array
|
||||
{
|
||||
// Start to build the query to fetch messages
|
||||
$where = array( array( 'core_message_topic_user_map.map_user_id=? AND core_message_topic_user_map.map_user_active=1', Member::loggedIn()->member_id ) );
|
||||
|
||||
@@ -59,10 +59,10 @@ class MessengerFolders
|
||||
* @param mixed $val Value passed into this resolver
|
||||
* @param array $args Arguments
|
||||
* @param array $context Context values
|
||||
* @param array $info
|
||||
* @param mixed $info
|
||||
* @return array|null
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context, array $info ) : ?array
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : ?array
|
||||
{
|
||||
if( !Member::loggedIn()->member_id || Member::loggedIn()->members_disable_pm )
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ class Search
|
||||
* @param array $context Context values
|
||||
* @return array
|
||||
*/
|
||||
public function resolve( mixed $val, array $args, array $context ) : array
|
||||
public function resolve( mixed $val, array $args, array $context, mixed $info ) : array
|
||||
{
|
||||
$where = array();
|
||||
$returnObject = array();
|
||||
@@ -149,27 +149,18 @@ class Search
|
||||
$query->filterByContent( array( $filter ) );
|
||||
}
|
||||
|
||||
$orderBy = $query->getDefaultSortMethod();
|
||||
$orderBy = $args['orderBy'] ?? $query->getDefaultSortMethod();
|
||||
|
||||
// Ordering
|
||||
if( isset( $args['orderBy'] ) )
|
||||
switch( $orderBy )
|
||||
{
|
||||
switch( $args['orderBy'] )
|
||||
{
|
||||
case 'newest':
|
||||
$query->setOrder( Query::ORDER_NEWEST_CREATED );
|
||||
case 'newest':
|
||||
$query->setOrder( Query::ORDER_NEWEST_CREATED );
|
||||
break;
|
||||
case 'relevancy':
|
||||
$query->setOrder( Query::ORDER_RELEVANCY );
|
||||
case 'relevancy':
|
||||
default:
|
||||
$query->setOrder( Query::ORDER_RELEVANCY );
|
||||
break;
|
||||
default:
|
||||
$query->setOrder( $orderBy );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->setOrder( $orderBy );
|
||||
}
|
||||
|
||||
// Get page
|
||||
|
||||
@@ -17,6 +17,7 @@ use IPS\Content\Comment;
|
||||
use IPS\Content\Item;
|
||||
use IPS\Content\Reaction;
|
||||
use IPS\Content\Search\Result;
|
||||
use IPS\Content\Search\SearchContent;
|
||||
use IPS\File;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -402,7 +403,8 @@ class ContentSearchResultType extends ObjectType
|
||||
|
||||
/* @var Item $itemClass */
|
||||
$itemClass = static::getItemClass( $asArray );
|
||||
$itemUrl = $itemClass::urlFromIndexData( $asArray['indexData'], $asArray['itemData'] );
|
||||
$extension = SearchContent::extension( $itemClass );
|
||||
$itemUrl = $extension::urlFromIndexData( $asArray['indexData'], $asArray['itemData'] );
|
||||
|
||||
/* Object URL */
|
||||
if ( in_array( 'IPS\Content\Comment', class_parents( $asArray['indexData']['index_class'] ) ) )
|
||||
@@ -519,10 +521,10 @@ class ContentSearchResultType extends ObjectType
|
||||
/**
|
||||
* Get the item class for the result
|
||||
*
|
||||
* @param Result $result Array representation of \IPS\Content\Search\Result
|
||||
* @param array $result Array representation of \IPS\Content\Search\Result
|
||||
* @return string
|
||||
*/
|
||||
protected static function getItemClass( Result $result ) : string
|
||||
protected static function getItemClass( array $result ) : string
|
||||
{
|
||||
$indexClass = $result['indexData']['index_class'];
|
||||
return ( in_array( 'IPS\Content\Comment', class_parents( $indexClass ) ) ) ? $indexClass::$itemClass : $indexClass;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace IPS\core\api\GraphQL\Types;
|
||||
use GraphQL\Type\Definition\ObjectType;
|
||||
use IPS\Api\GraphQL\TypeRegistry;
|
||||
use IPS\Content\Tag;
|
||||
use IPS\Http\Url;
|
||||
use function defined;
|
||||
|
||||
@@ -49,8 +50,7 @@ class TagType extends ObjectType
|
||||
'type' => TypeRegistry::string(),
|
||||
'description' => "Tag URL",
|
||||
'resolve' => function ($tag) {
|
||||
$_tag = urlencode($tag);
|
||||
return Url::internal( "app=core&module=discover&controller=tag&tag={$_tag}", 'front', 'tags' );
|
||||
return Tag::buildTagUrl( $tag );
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user