Live: prepend orgId when publishing from HTTP (#38775)

This commit is contained in:
Ryan McKinley 2021-09-01 08:54:34 -07:00 committed by GitHub
parent e980f8531a
commit e461c722bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -65,5 +65,5 @@ func (b *BroadcastRunner) OnPublish(_ context.Context, u *models.SignedInUser, e
if err := b.liveMessageStore.SaveLiveMessage(query); err != nil {
return models.PublishReply{}, 0, err
}
return models.PublishReply{}, backend.PublishStreamStatusOK, nil
return models.PublishReply{Data: e.Data}, backend.PublishStreamStatusOK, nil
}

View File

@ -81,5 +81,5 @@ func TestBroadcastRunner_OnPublish(t *testing.T) {
)
require.NoError(t, err)
require.Equal(t, backend.PublishStreamStatusOK, status)
require.Nil(t, reply.Data)
require.Equal(t, data, reply.Data)
}

View File

@ -746,7 +746,7 @@ func (g *GrafanaLive) HandleHTTPPublish(ctx *models.ReqContext, cmd dtos.LivePub
return response.Error(code, text, nil)
}
if reply.Data != nil {
_, err = g.node.Publish(cmd.Channel, cmd.Data)
err = g.Publish(ctx.OrgId, cmd.Channel, cmd.Data)
if err != nil {
logger.Error("Error publish to channel", "error", err, "channel", cmd.Channel)
return response.Error(http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), nil)