mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-18 05:35:10 +00:00
only publish if no post existed before
This commit is contained in:
@@ -131,11 +131,11 @@ func (p *Posts) savePost(ctx context.Context, oldPost, post *proto.Post) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish the post as an event
|
|
||||||
logger.Infof("Publishing post: '%v'", post.Title)
|
|
||||||
service.NewEvent("posts").Publish(ctx, post)
|
|
||||||
|
|
||||||
if oldPost == nil {
|
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 {
|
for _, tagName := range post.Tags {
|
||||||
_, err := p.Tags.Add(ctx, &tags.AddRequest{
|
_, err := p.Tags.Add(ctx, &tags.AddRequest{
|
||||||
ResourceID: post.Id,
|
ResourceID: post.Id,
|
||||||
|
|||||||
Reference in New Issue
Block a user