Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an API endpoint to post comments to wiki requests #516

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
redbluegreenhat committed May 2, 2024
commit dfaf560667df22334727eae039310f29aefefb2c
6 changes: 3 additions & 3 deletions includes/RequestWiki/Handler/RestWikiRequestComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function run( $requestID ) {
return $this->getResponseFactory()->createLocalizedHttpError( 404, new MessageValue( 'requestwiki-unknown' ) );
}
// Must be logged in to use this API
if ( !$this->getAuthority->isNamed() ) {
if ( !$this->getAuthority()->isNamed() ) {
return $this->getResponseFactory()->createLocalizedHttpError( 403, new MessageValue( 'createwiki-rest-mustlogin' ) );
}
// Only allow users with (createwiki) the creator of the request to post comments
if ( !$this->getAuthority->isAllowed( 'createwiki' ) || $this->getAuthority()->getUser()->getId() !== $wikiRequest->requester->getId() )
if ( !$this->getAuthority()->isAllowed( 'createwiki' ) || $this->getAuthority()->getUser()->getId() !== $wikiRequest->requester->getId() )
return $this->getResponseFactory()->createLocalizedHttpError( 403, new MessageValue( 'createwiki-rest-notallowed' ) );
}
// Do not allow blocked users to post comments
if ( $this->getAuthority->getBlock() ) {
if ( $this->getAuthority()->getBlock() ) {
return $this->getResponseFactory()->createLocalizedHttpError( 403, new MessageValue( 'createwiki-rest-notallowed' ) );
}

Expand Down
Loading