only publish if no post existed before

This commit is contained in:
Asim Aslam
2021-03-02 09:22:21 +00:00
parent dd450ecb4a
commit 80ecacdc5d

View File

@@ -131,11 +131,11 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *proto.Post) error {
return err
}
// publish the post as an event
logger.Infof("Publishing post: '%v'", post.Title)
service.NewEvent("posts").Publish(ctx, post)
if oldPost == nil {
// publish the post as an event
logger.Infof("Publishing post: '%v'", post.Title)
service.NewEvent("posts").Publish(ctx, post)
for _, tagName := range post.Tags {
_, err := p.Tags.Add(ctx, &tags.AddRequest{
ResourceID: post.Id,