Check if telemetry is disable, and only submit the true up profile if it is disabled.

This commit is contained in:
Conor Macpherson
2023-04-17 15:09:54 -04:00
parent 27d959485e
commit aa7939264f

View File

@@ -351,12 +351,15 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// True-up is only enabled when telemetry is disabled. When telemetry is enabled, we already have all the data necessary
// for true-up reviews to be completed.
err = c.App.Cloud().SubmitTrueUpReview(c.AppContext.Session().UserId, profileMap)
if err != nil {
c.Err = model.NewAppError("requestTrueUpReview", "api.license.true_up_review.failed_to_submit", nil, err.Error(), http.StatusInternalServerError)
return
// True-up is only enabled when telemetry is disabled.
// When telemetry is enabled, we already have all the data necessary for true-up reviews to be completed.
telemetryEnabled := c.App.Config().LogSettings.EnableDiagnostics
if telemetryEnabled != nil && !*telemetryEnabled {
err = c.App.Cloud().SubmitTrueUpReview(c.AppContext.Session().UserId, profileMap)
if err != nil {
c.Err = model.NewAppError("requestTrueUpReview", "api.license.true_up_review.failed_to_submit", nil, err.Error(), http.StatusInternalServerError)
return
}
}
// Update the review status to reflect the completion.