Add nil checks for cloud in case of air-gapped instances?
Этот коммит содержится в:
@@ -307,23 +307,21 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.App.Cloud() == nil {
|
|
||||||
c.Err = model.NewAppError("requestRenewalLink", "api.license.upgrade_needed.app_error", nil, "", http.StatusForbidden)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
license := c.App.Channels().License()
|
license := c.App.Channels().License()
|
||||||
if license == nil {
|
if license == nil {
|
||||||
http.Error(w, "A License is required to perform a true-up review", http.StatusBadRequest)
|
http.Error(w, "A License is required to perform a true-up review", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscription Data
|
var subscription *model.Subscription
|
||||||
userId := c.AppContext.Session().UserId
|
if c.App.Cloud() != nil {
|
||||||
subscription, err := c.App.Cloud().GetSubscription(userId)
|
// Subscription Data
|
||||||
if err != nil || subscription == nil {
|
userId := c.AppContext.Session().UserId
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
subscription, err := c.App.Cloud().GetSubscription(userId)
|
||||||
return
|
if err != nil || subscription == nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customer Info & Usage Analytics
|
// Customer Info & Usage Analytics
|
||||||
@@ -385,12 +383,16 @@ func requestTrueUpReview(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seats := 0
|
||||||
|
if subscription != nil {
|
||||||
|
seats = subscription.Seats
|
||||||
|
}
|
||||||
reviewProfile := model.TrueUpReviewProfile{
|
reviewProfile := model.TrueUpReviewProfile{
|
||||||
ServerId: c.App.TelemetryId(),
|
ServerId: c.App.TelemetryId(),
|
||||||
ServerVersion: model.CurrentVersion,
|
ServerVersion: model.CurrentVersion,
|
||||||
ServerInstallationType: os.Getenv(telemetry.EnvVarInstallType),
|
ServerInstallationType: os.Getenv(telemetry.EnvVarInstallType),
|
||||||
LicenseId: license.Id,
|
LicenseId: license.Id,
|
||||||
LicensedSeats: subscription.Seats,
|
LicensedSeats: seats,
|
||||||
LicensePlan: license.SkuName,
|
LicensePlan: license.SkuName,
|
||||||
CustomerName: license.Customer.Name,
|
CustomerName: license.Customer.Name,
|
||||||
ActiveUsers: activeUserCount,
|
ActiveUsers: activeUserCount,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user