Skip to content

Commit 96f6767

Browse files
Updated chatGptPermission check caused to throwing an exception corrupted it
1 parent 4d46176 commit 96f6767

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Listener/ReplyToCommentPost.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public function handle(Posted $event): void
3838
}
3939
}
4040

41-
$actor->assertCan('discussion.useChatGPTAssistant', $discussion);
42-
41+
if($actor->can('discussion.useChatGPTAssistant', $discussion) === false) {
42+
return;
43+
}
4344

4445
if (!$enabled) {
4546
$this->agent->repliesToCommentPost($event->post);

src/Listener/ReplyToPost.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public function handle(Started $event): void
3838
}
3939
}
4040

41-
$actor->assertCan('discussion.useChatGPTAssistant', $discussion);
41+
if($actor->can('discussion.useChatGPTAssistant', $discussion) === false) {
42+
return;
43+
}
4244

4345
if (!$enabled) {
4446
$this->agent->repliesTo($event->discussion);

0 commit comments

Comments
 (0)