Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Add comment id to the webhook for new comment.

Matt Roberts658b52fb4002
diff --git a/app/services/webhook/dummy_props.go b/app/services/webhook/dummy_props.go
index c33c4006d..c56b123c9 100644
--- a/app/services/webhook/dummy_props.go
+++ b/app/services/webhook/dummy_props.go
@@ -2,12 +2,13 @@ package webhook
import (
"context"
+ "time"
+
"github.com/getfider/fider/app"
"github.com/getfider/fider/app/models/entity"
"github.com/getfider/fider/app/models/enum"
"github.com/getfider/fider/app/pkg/web"
"github.com/getfider/fider/app/pkg/webhook"
- "time"
)
var dummyPost = &entity.Post{
@@ -55,6 +56,7 @@ func dummyTriggerProps(c context.Context, webhookType enum.WebhookType) webhook.
case enum.WebhookNewComment:
props.SetPost(dummyPost, "post", baseURL, true, true)
props["comment"] = "An example **comment** on a post."
+ props["comment_id"] = 12
case enum.WebhookChangeStatus:
props.SetPost(dummyPost, "post", baseURL, true, true)
props["post_old_status"] = enum.PostOpen.Name()
diff --git a/app/tasks/new_comment.go b/app/tasks/new_comment.go
index a44399a4f..05c1f4740 100644
--- a/app/tasks/new_comment.go
+++ b/app/tasks/new_comment.go
@@ -121,6 +121,8 @@ func NotifyAboutNewComment(comment *entity.Comment, post *entity.Post) worker.Ta
baseURL, logoURL := web.BaseURL(c), web.LogoURL(c)
webhookProps := webhook.Props{"comment": strippedContent}
+ webhookProps["comment_id"] = comment.ID
+
webhookProps.SetPost(post, "post", baseURL, true, true)
webhookProps.SetUser(author, "author")
webhookProps.SetTenant(tenant, "tenant", baseURL, logoURL)