Previously, we relied on the built-in email feature of Gerrit, which provided a comprehensive representation of comment-added details, such as what the comment was, what the latest added comment was, and so on, all in great detail. It was also capable of indicating who was being replied to. However, the sheer volume of emails became overwhelming.
Therefore, we decided to handle comment-added notifications through custom hooks that we wrote ourselves. Nevertheless, we discovered that when querying comments using SSH, it was impossible to distinguish which comments were newly added. For instance, if I added 5 comments to patch 1 and then another 1 comment an hour later, SSH query would display all six comments, without differentiating between the newly added ones. Moreover, details like replies were also not displayed in the query results, whereas they were included in the emails.
Previously, we relied on the built-in email feature of Gerrit, which provided a comprehensive representation of comment-added details, such as what the comment was, what the latest added comment was, and so on, all in great detail. It was also capable of indicating who was being replied to. However, the sheer volume of emails became overwhelming.
Therefore, we decided to handle comment-added notifications through custom hooks that we wrote ourselves. Nevertheless, we discovered that when querying comments using SSH, it was impossible to distinguish which comments were newly added. For instance, if I added 5 comments to patch 1 and then another 1 comment an hour later, SSH query would display all six comments, without differentiating between the newly added ones. Moreover, details like replies were also not displayed in the query results, whereas they were included in the emails.
I've reviewed the Gerrit API documentation, specifically the sections on listing comments and revision comments at https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-comments. However, I'm still uncertain about how to efficiently capture newly added comment information and notify the relevant parties. Here's the process I'm dealing with:
Jack comments "a", "b", "c" on patch1 and clicks "send" on the Gerrit page. This triggers a "comment-added" event indicating that 3 new comments have been added. I can query this via the API or directly and notify the owner that Jack has commented "abc".
When Rose sees Jack's comments, she replies to comment "a" with her own view, let's call it "d". This again triggers a "comment-added" event for the addition of 1 new comment. However, at this point, I'm unable to determine which specific comment is the new one added based on the information provided.
The solution I've thought of so far is quite cumbersome: setting up a dedicated database where I write every time a "comment-added" event occurs. Then, during the next event, I would compare the same revision to identify the newly added comment. Clearly, this is not an optimal approach. I believe there must be a simpler way to achieve this, leveraging the native support for email notifications within Gerrit.
Is there a more efficient and built-in way to handle these comment notifications, perhaps through webhooks or stream events that provide more context about the newly added comments?
On 11 Jul 2024, at 04:48, 阮素芹 <susu.s...@gmail.com> wrote:Thanks , Matthias .😉I've reviewed the Gerrit API documentation, specifically the sections on listing comments and revision comments at https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-comments. However, I'm still uncertain about how to efficiently capture newly added comment information and notify the relevant parties. Here's the process I'm dealing with:
Jack comments "a", "b", "c" on patch1 and clicks "send" on the Gerrit page. This triggers a "comment-added" event indicating that 3 new comments have been added. I can query this via the API or directly and notify the owner that Jack has commented "abc". When Rose sees Jack's comments, she replies to comment "a" with her own view, let's call it "d". This again triggers a "comment-added" event for the addition of 1 new comment. However, at this point, I'm unable to determine which specific comment is the new one added based on the information provided.The solution I've thought of so far is quite cumbersome: setting up a dedicated database where I write every time a "comment-added" event occurs. Then, during the next event, I would compare the same revision to identify the newly added comment. Clearly, this is not an optimal approach. I believe there must be a simpler way to achieve this, leveraging the native support for email notifications within Gerrit.
Is there a more efficient and built-in way to handle these comment notifications, perhaps through webhooks or stream events that provide more context about the newly added comments?
在2024年7月10日星期三 UTC+8 23:43:50<Matthias Sohn> 写道:On Wed, Jul 10, 2024 at 4:00 PM 阮素芹 <susu.s...@gmail.com> wrote:Previously, we relied on the built-in email feature of Gerrit, which provided a comprehensive representation of comment-added details, such as what the comment was, what the latest added comment was, and so on, all in great detail. It was also capable of indicating who was being replied to. However, the sheer volume of emails became overwhelming.Therefore, we decided to handle comment-added notifications through custom hooks that we wrote ourselves. Nevertheless, we discovered that when querying comments using SSH, it was impossible to distinguish which comments were newly added. For instance, if I added 5 comments to patch 1 and then another 1 comment an hour later, SSH query would display all six comments, without differentiating between the newly added ones. Moreover, details like replies were also not displayed in the query results, whereas they were included in the emails.
you may consider to use the REST API to get more details:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-comments
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/da358c18-572e-41f8-95ff-baa0dd87289cn%40googlegroups.com.