Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Remove encoding from mentions in comment retrieval in API

Matt Robertsf941a56657ca
diff --git a/app/handlers/apiv1/post.go b/app/handlers/apiv1/post.go
index 3718315ff..68eb4e167 100644
--- a/app/handlers/apiv1/post.go
+++ b/app/handlers/apiv1/post.go
@@ -8,6 +8,7 @@ import (
"github.com/getfider/fider/app/models/enum"
"github.com/getfider/fider/app/models/query"
"github.com/getfider/fider/app/pkg/bus"
+ "github.com/getfider/fider/app/pkg/markdown"
"github.com/getfider/fider/app/pkg/web"
"github.com/getfider/fider/app/tasks"
)
@@ -197,6 +198,11 @@ func ListComments() web.HandlerFunc {
return c.Failure(err)
}
+ // the content of the comment needs to be sanitized before it is returned
+ for _, comment := range getComments.Result {
+ comment.Content = markdown.StripMentionMetaData(comment.Content)
+ }
+
return c.Ok(getComments.Result)
}
}
@@ -214,6 +220,8 @@ func GetComment() web.HandlerFunc {
return c.Failure(err)
}
+ commentByID.Result.Content = markdown.StripMentionMetaData(commentByID.Result.Content)
+
return c.Ok(commentByID.Result)
}
}