Skip to content

Commit

Permalink
Return false for empty comments, true if comment was added (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
redbluegreenhat committed May 4, 2024
1 parent 5cffb94 commit 00f1511
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions includes/RequestWiki/WikiRequest.php
Expand Up @@ -109,10 +109,10 @@ public function __construct( int $id = null, CreateWikiHookRunner $hookRunner =
}
}

public function addComment( string $comment, UserIdentity $user, string $type = 'comment', array $notifyUsers = [] ) {
public function addComment( string $comment, UserIdentity $user, string $type = 'comment', array $notifyUsers = [] ): bool {
// don't post empty comments
if ( !$comment || ctype_space( $comment ) ) {
return;
return false;
}

$this->dbw->insert(
Expand All @@ -134,6 +134,8 @@ public function addComment( string $comment, UserIdentity $user, string $type =
}

$this->sendNotification( $comment, $notifyUsers, $type );

return true;
}

private function sendNotification( string $comment, array $notifyUsers, string $type = 'comment' ) {
Expand Down

0 comments on commit 00f1511

Please sign in to comment.