Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -67,7 +67,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
|
||||
/**
|
||||
* GET /cms/reviews/{database_id}
|
||||
* Get list of comments
|
||||
* Get list of review
|
||||
*
|
||||
* @note For requests using an OAuth Access Token for a particular member, only reviews the authorized user can view will be included
|
||||
* @param int $database Database ID
|
||||
@@ -106,7 +106,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
|
||||
/**
|
||||
* GET /cms/reviews/{database_id}/{id}
|
||||
* View information about a specific comment
|
||||
* View information about a specific review
|
||||
*
|
||||
* @param int $database Database ID
|
||||
* @param int $review Comment ID
|
||||
@@ -153,7 +153,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
|
||||
/**
|
||||
* POST /cms/reviews/{database_id}
|
||||
* Create a comment
|
||||
* Create a review
|
||||
*
|
||||
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authenticated user has permission to hide content).
|
||||
* @param int $database Database ID
|
||||
@@ -164,6 +164,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
* @apiparam datetime date The date/time that should be used for the comment date. If not provided, will use the current date/time. Ignored for requests using an OAuth Access Token for a particular member
|
||||
* @apiparam string ip_address The IP address that should be stored for the comment. If not provided, will use the IP address from the API request. Ignored for requests using an OAuth Access Token for a particular member
|
||||
* @apiparam int hidden 0 = unhidden; 1 = hidden, pending moderator approval; -1 = hidden (as if hidden by a moderator)
|
||||
* @apiparam bool anonymous If 1, the item will be posted anonymously.
|
||||
* @reqapiparam int rating Star rating
|
||||
* @throws 2T312/4 INVALID_DATABASE The database ID does not exist or the authorized user does not have permission to view it
|
||||
* @throws 2T312/5 INVALID_ID The comment ID does not exist
|
||||
@@ -222,8 +223,15 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
}
|
||||
else
|
||||
{
|
||||
$author = new \IPS\Member;
|
||||
$author->name = \IPS\Request::i()->author_name;
|
||||
if ( \IPS\Request::i()->author === 0 )
|
||||
{
|
||||
$author = new \IPS\Member;
|
||||
$author->name = \IPS\Request::i()->author_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'NO_AUTHOR', '1T312/6', 400 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +253,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
|
||||
/**
|
||||
* POST /cms/reviews/{database_id}/{review_id}
|
||||
* Edit a comment
|
||||
* Edit a review
|
||||
*
|
||||
* @note For requests using an OAuth Access Token for a particular member, any parameters the user doesn't have permission to use are ignored (for example, hidden will only be honoured if the authenticated user has permission to hide content).
|
||||
* @param int $database Database ID
|
||||
@@ -255,6 +263,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
* @apiparam string content The comment content as HTML (e.g. "<p>This is a comment.</p>"). Will be sanatized for requests using an OAuth Access Token for a particular member; will be saved unaltered for requests made using an API Key or the Client Credentials Grant Type.
|
||||
* @apiparam int hidden 1/0 indicating if the topic should be hidden
|
||||
* @apiparam int rating Star rating
|
||||
* @apiparam bool anonymous If 1, the item will be posted anonymously.
|
||||
* @throws 2T312/9 INVALID_DATABASE The database ID does not exist or the authorized user does not have permission to view it
|
||||
* @throws 2T312/A INVALID_ID The comment ID does not exist or the authorized user does not have permission to view it
|
||||
* @throws 1T312/B NO_AUTHOR The author ID does not exist
|
||||
@@ -311,7 +320,7 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
|
||||
/**
|
||||
* DELETE /cms/reviews/{database_id}/{review_id}
|
||||
* Deletes a comment
|
||||
* Deletes a review
|
||||
*
|
||||
* @param int $database Database ID
|
||||
* @param int $review Comment ID
|
||||
@@ -355,4 +364,107 @@ class _reviews extends \IPS\Content\Api\CommentController
|
||||
throw new \IPS\Api\Exception( 'INVALID_ID', '2T312/D', 404 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /cms/reviews/{database_id}/{comment_id}/react
|
||||
* Add a reaction
|
||||
*
|
||||
* @param int $database Database ID
|
||||
* @param int $comment Comment ID
|
||||
* @apiparam int id ID of the reaction to add
|
||||
* @apiparam int author ID of the member reacting
|
||||
* @return \IPS\cms\Records\Review
|
||||
* @throws 1S425/2 NO_REACTION The reaction ID does not exist
|
||||
* @throws 1S425/3 NO_AUTHOR The author ID does not exist
|
||||
* @throws 1S425/4 REACT_ERROR Error adding the reaction
|
||||
* @throws 1S425/5 INVALID_ID Object ID does not exist
|
||||
* @throws 2T312/E INVALID_DATABASE The database ID does not exist or the authorized user does not have permission to view it
|
||||
* @note If the author has already reacted to this content, any existing reaction will be removed first
|
||||
*/
|
||||
public function POSTitem_react( $database, $comment )
|
||||
{
|
||||
/* Load database */
|
||||
try
|
||||
{
|
||||
$database = \IPS\cms\Databases::load( $database );
|
||||
if ( $this->member and !$database->can( 'view', $this->member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
$this->class = 'IPS\cms\Records\Comment' . $database->id;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_DATABASE', '2T312/E', 404 );
|
||||
}
|
||||
|
||||
return $this->_reactAdd( $comment );
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE /cms/reviews/{database_id}/{comment_id}/react
|
||||
* Delete a reaction
|
||||
*
|
||||
* @param int $database Database ID
|
||||
* @param int $comment Comment ID
|
||||
* @apiparam int author ID of the member who reacted
|
||||
* @return \IPS\cms\Records\Review
|
||||
* @throws 1S425/6 NO_AUTHOR The author ID does not exist
|
||||
* @throws 1S425/7 REACT_ERROR Error adding the reaction
|
||||
* @throws 1S425/8 INVALID_ID Object ID does not exist
|
||||
* @throws 2T312/F INVALID_DATABASE The database ID does not exist or the authorized user does not have permission to view it
|
||||
* @note If the author has already reacted to this content, any existing reaction will be removed first
|
||||
*/
|
||||
public function DELETEitem_react( $database, $comment )
|
||||
{
|
||||
/* Load database */
|
||||
try
|
||||
{
|
||||
$database = \IPS\cms\Databases::load( $database );
|
||||
if ( $this->member and !$database->can( 'view', $this->member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
$this->class = 'IPS\cms\Records\Comment' . $database->id;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_DATABASE', '2T312/F', 404 );
|
||||
}
|
||||
|
||||
return $this->_reactRemove( $comment );
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /cms/reviews/{database_id}/{comment_id}/report
|
||||
* Reports a post
|
||||
*
|
||||
* @param int $database Database ID
|
||||
* @param int $comment Comment ID
|
||||
* @apiparam int author ID of the member reporting
|
||||
* @apiparam int report_type Report type (0 is default and is for letting CMGR team know, more options via core_automatic_moderation_types)
|
||||
* @apiparam string message Optional message
|
||||
* @return \IPS\cms\Records\Review
|
||||
* @throws 1S425/B NO_AUTHOR The author ID does not exist
|
||||
* @throws 1S425/C REPORTED_ALREADY The member has reported this item in the past 24 hours
|
||||
*/
|
||||
public function POSTitem_report( $database, $comment )
|
||||
{
|
||||
/* Load database */
|
||||
try
|
||||
{
|
||||
$database = \IPS\cms\Databases::load( $database );
|
||||
if ( $this->member and !$database->can( 'view', $this->member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
$this->class = 'IPS\cms\Records\Comment' . $database->id;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Api\Exception( 'INVALID_DATABASE', '2T311/D', 404 );
|
||||
}
|
||||
|
||||
return $this->_report( $comment );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user