MM-30822: Change to idiomatic receiver names for model.PushNotification (#16347)
Automatic Merge
Этот коммит содержится в:
@@ -70,23 +70,23 @@ type PushNotification struct {
|
|||||||
IsIdLoaded bool `json:"is_id_loaded"`
|
IsIdLoaded bool `json:"is_id_loaded"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *PushNotification) ToJson() string {
|
func (pn *PushNotification) ToJson() string {
|
||||||
b, _ := json.Marshal(me)
|
b, _ := json.Marshal(pn)
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *PushNotification) DeepCopy() *PushNotification {
|
func (pn *PushNotification) DeepCopy() *PushNotification {
|
||||||
copy := *me
|
copy := *pn
|
||||||
return ©
|
return ©
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *PushNotification) SetDeviceIdAndPlatform(deviceId string) {
|
func (pn *PushNotification) SetDeviceIdAndPlatform(deviceId string) {
|
||||||
|
|
||||||
index := strings.Index(deviceId, ":")
|
index := strings.Index(deviceId, ":")
|
||||||
|
|
||||||
if index > -1 {
|
if index > -1 {
|
||||||
me.Platform = deviceId[:index]
|
pn.Platform = deviceId[:index]
|
||||||
me.DeviceId = deviceId[index+1:]
|
pn.DeviceId = deviceId[index+1:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ func PushNotificationFromJson(data io.Reader) (*PushNotification, error) {
|
|||||||
if data == nil {
|
if data == nil {
|
||||||
return nil, errors.New("push notification data can't be nil")
|
return nil, errors.New("push notification data can't be nil")
|
||||||
}
|
}
|
||||||
var me *PushNotification
|
var pn *PushNotification
|
||||||
if err := json.NewDecoder(data).Decode(&me); err != nil {
|
if err := json.NewDecoder(data).Decode(&pn); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return me, nil
|
return pn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushNotificationAckFromJson(data io.Reader) (*PushNotificationAck, error) {
|
func PushNotificationAckFromJson(data io.Reader) (*PushNotificationAck, error) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user