MM-20347 Move ID Loaded Push Notifications to E20 (#13185)

* Move ID Loaded Push Notifications to E20

* Fix model tests
Этот коммит содержится в:
Elias Nahum
2019-11-21 19:35:19 -03:00
коммит произвёл GitHub
родитель 0b00a7870b
Коммит 3e9cd464de
16 изменённых файлов: 125 добавлений и 205 удалений

Просмотреть файл

@@ -60,6 +60,7 @@ type Features struct {
CustomPermissionsSchemes *bool `json:"custom_permissions_schemes"`
CustomTermsOfService *bool `json:"custom_terms_of_service"`
GuestAccountsPermissions *bool `json:"guest_accounts_permissions"`
IDLoadedPushNotifications *bool `json:"id_loaded"`
// after we enabled more features we'll need to control them with this
FutureFeatures *bool `json:"future_features"`
@@ -83,6 +84,7 @@ func (f *Features) ToMap() map[string]interface{} {
"message_export": *f.MessageExport,
"custom_permissions_schemes": *f.CustomPermissionsSchemes,
"guest_accounts_permissions": *f.GuestAccountsPermissions,
"id_loaded": *f.IDLoadedPushNotifications,
"future": *f.FutureFeatures,
}
}
@@ -171,6 +173,10 @@ func (f *Features) SetDefaults() {
if f.CustomTermsOfService == nil {
f.CustomTermsOfService = NewBool(*f.FutureFeatures)
}
if f.IDLoadedPushNotifications == nil {
f.IDLoadedPushNotifications = NewBool(*f.FutureFeatures)
}
}
func (l *License) IsExpired() bool {

Просмотреть файл

@@ -31,6 +31,7 @@ func TestLicenseFeaturesToMap(t *testing.T) {
CheckTrue(t, m["data_retention"].(bool))
CheckTrue(t, m["message_export"].(bool))
CheckTrue(t, m["custom_permissions_schemes"].(bool))
CheckTrue(t, m["id_loaded"].(bool))
CheckTrue(t, m["future"].(bool))
}
@@ -55,6 +56,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
CheckTrue(t, *f.MessageExport)
CheckTrue(t, *f.CustomPermissionsSchemes)
CheckTrue(t, *f.GuestAccountsPermissions)
CheckTrue(t, *f.IDLoadedPushNotifications)
CheckTrue(t, *f.FutureFeatures)
f = Features{}
@@ -78,6 +80,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
*f.CustomPermissionsSchemes = true
*f.GuestAccountsPermissions = true
*f.EmailNotificationContents = true
*f.IDLoadedPushNotifications = true
f.SetDefaults()
@@ -98,6 +101,7 @@ func TestLicenseFeaturesSetDefaults(t *testing.T) {
CheckTrue(t, *f.MessageExport)
CheckTrue(t, *f.CustomPermissionsSchemes)
CheckTrue(t, *f.GuestAccountsPermissions)
CheckTrue(t, *f.IDLoadedPushNotifications)
CheckFalse(t, *f.FutureFeatures)
}
@@ -173,6 +177,7 @@ func TestLicenseToFromJson(t *testing.T) {
CheckBool(t, *f1.MessageExport, *f.MessageExport)
CheckBool(t, *f1.CustomPermissionsSchemes, *f.CustomPermissionsSchemes)
CheckBool(t, *f1.GuestAccountsPermissions, *f.GuestAccountsPermissions)
CheckBool(t, *f1.IDLoadedPushNotifications, *f.IDLoadedPushNotifications)
CheckBool(t, *f1.FutureFeatures, *f.FutureFeatures)
invalid := `{"asdf`

Просмотреть файл

@@ -15,7 +15,6 @@ const (
PUSH_NOTIFY_APPLE_REACT_NATIVE = "apple_rn"
PUSH_NOTIFY_ANDROID_REACT_NATIVE = "android_rn"
PUSH_TYPE_ID_LOADED = "id_loaded"
PUSH_TYPE_MESSAGE = "message"
PUSH_TYPE_CLEAR = "clear"
PUSH_TYPE_UPDATE_BADGE = "update_badge"
@@ -41,6 +40,7 @@ type PushNotificationAck struct {
ClientPlatform string `json:"platform"`
NotificationType string `json:"type"`
PostId string `json:"post_id,omitempty"`
IsIdLoaded bool `json:"is_id_loaded"`
}
type PushNotification struct {
@@ -65,6 +65,7 @@ type PushNotification struct {
OverrideIconUrl string `json:"override_icon_url,omitempty"`
FromWebhook string `json:"from_webhook,omitempty"`
Version string `json:"version,omitempty"`
IsIdLoaded bool `json:"is_id_loaded"`
}
func (me *PushNotification) ToJson() string {