Merge pull request #22078 from mattermost/MM-49474-add-downgrade-feedback
MM-49474 - Add Telemetry Event for Submitting Downgrade Feedback
Этот коммит содержится в:
@@ -135,6 +135,10 @@ func changeSubscription(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if subscriptionChange.DowngradeFeedback != nil {
|
||||||
|
c.App.Srv().GetTelemetryService().SendTelemetry("downgrade_feedback", subscriptionChange.DowngradeFeedback.ToMap())
|
||||||
|
}
|
||||||
|
|
||||||
json, err := json.Marshal(changedSub)
|
json, err := json.Marshal(changedSub)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Err = model.NewAppError("Api4.changeSubscription", "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
c.Err = model.NewAppError("Api4.changeSubscription", "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -260,9 +261,11 @@ type FailedPayment struct {
|
|||||||
type CloudWorkspaceOwner struct {
|
type CloudWorkspaceOwner struct {
|
||||||
UserName string `json:"username"`
|
UserName string `json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubscriptionChange struct {
|
type SubscriptionChange struct {
|
||||||
ProductID string `json:"product_id"`
|
ProductID string `json:"product_id"`
|
||||||
Seats int `json:"seats"`
|
Seats int `json:"seats"`
|
||||||
|
DowngradeFeedback *DowngradeFeedback `json:"downgrade_feedback"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BoardsLimits struct {
|
type BoardsLimits struct {
|
||||||
@@ -304,6 +307,11 @@ type CreateSubscriptionRequest struct {
|
|||||||
DiscountID string `json:"discount_id"`
|
DiscountID string `json:"discount_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DowngradeFeedback struct {
|
||||||
|
Reason string `json:"reason"`
|
||||||
|
Comments string `json:"comments"`
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Product) IsYearly() bool {
|
func (p *Product) IsYearly() bool {
|
||||||
return p.RecurringInterval == RecurringIntervalYearly
|
return p.RecurringInterval == RecurringIntervalYearly
|
||||||
}
|
}
|
||||||
@@ -311,3 +319,18 @@ func (p *Product) IsYearly() bool {
|
|||||||
func (p *Product) IsMonthly() bool {
|
func (p *Product) IsMonthly() bool {
|
||||||
return p.RecurringInterval == RecurringIntervalMonthly
|
return p.RecurringInterval == RecurringIntervalMonthly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (df *DowngradeFeedback) ToMap() map[string]any {
|
||||||
|
var res map[string]any
|
||||||
|
feedback, err := json.Marshal(df)
|
||||||
|
if err != nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(feedback, &res)
|
||||||
|
if err != nil {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user