novuhq / go-novu

GO SDK for Novu - The open-source notification infrastructure for engineers. 🚀
MIT License
57 stars 45 forks source link

Incomplete Subscriber Data Update #34

Closed kaptinlin closed 11 months ago

kaptinlin commented 11 months ago

Description

When updating a user's Name, I also attempt to update the corresponding novu subscriber. For example, if I change the user's Name value from foo1 to bar1, I expect the novu subscriber's Name and LastName to be updated accordingly.

However, only the name in the data field of the subscriber gets updated successfully. The LastName remains the same as it was when the subscriber was created.

Steps To Reproduce

  1. Update a user's Name value from foo1 to bar1.
  2. Use the following code to update the novu subscriber:
ctx := context.Background()
subscriberID := *user.ID
subscriber := novu.SubscriberPayload{
    Email:    *user.Email,
    Avatar:   *user.Avatar,
    LastName: *user.Name,
    Data: map[string]interface{}{
        "username":       *user.Username,
        "name":           *user.Name
    },
}
_, err := notifier.SubscriberApi.Update(ctx, subscriberID, subscriber)

Expected behavior

The LastName of the novu subscriber should be updated to the new user.Name value (bar1).

Actual behavior

The LastName remains unchanged, while the name in the Data field gets updated successfully.

Environment

Additional context

As seen in the code, I am setting the LastName field of the novu.SubscriberPayload object to the updated user.Name value. However, after the update operation, the LastName remains unchanged, while the name in the Data field gets updated successfully.

Screenshot

image

kaptinlin commented 11 months ago

I would like to add that when I attempt to change the email from foo1@gmail.com to bar1@gmail.com, the update is successful. It seems that the issue is specifically with the LastName field. This additional test indicates that the update functionality works correctly for the Email field but not for the LastName field. Please consider this information while investigating the issue. Thank you.

image

Sweetdevil144 commented 11 months ago

Hello @KaptinLin, I am reaching out to inquire about the current status of the mentioned issue. Is it still available for contribution? I appreciate your guidance on this matter.

kaptinlin commented 11 months ago

i'll check soon.

kaptinlin commented 11 months ago

it's fixed