Fix: processed commands not intended for ChatGPT
Resolved an issue where commands were being processed even when not
directed to ChatGPT, such as when mentioned in a comment to another
user.
Change-Id: Id3746686d9b2cda62c1f3a59d3143514c30538a4
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
index 96f9854..1aa9c70 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/api/gerrit/GerritClientComments.java
@@ -157,14 +157,14 @@
}
for (GerritComment latestComment : latestComments) {
String commentMessage = latestComment.getMessage();
- if (clientMessage.parseCommands(commentMessage, true)) {
- if (clientMessage.isContainingHistoryCommand()) {
- clientMessage.processHistoryCommand();
- }
- commentProperties.clear();
- return;
- }
if (clientMessage.isBotAddressed(commentMessage)) {
+ if (clientMessage.parseCommands(commentMessage, true)) {
+ if (clientMessage.isContainingHistoryCommand()) {
+ clientMessage.processHistoryCommand();
+ }
+ commentProperties.clear();
+ return;
+ }
commentProperties.add(latestComment);
}
}