Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timezone_id not being set #1842

Merged
merged 3 commits into from
Sep 25, 2023
Merged

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Sep 18, 2023

Description

One Line Summary

This fixes an issue where timezone_id was not being set as a property on users.

Details

This issue resulted in scheduled notifications being received at the wrong time.
In order to send the timezone_id we are adding a properties map in the createUser call. The properties set there (only timezone_id) will be hydrated to the properties model when the response is received.
fixes #1829

Motivation

Fix scheduled notifications

Scope

user properties during createUser

Testing

Unit testing

Added properties object to existing unit tests

Manual testing

Tested scheduled notifications on a physical device.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

@emawby emawby changed the title WiP Fix timezone_id not being set Fix timezone_id not being set Sep 18, 2023
@emawby emawby linked an issue Sep 18, 2023 that may be closed by this pull request
1 task
@jennantilla jennantilla mentioned this pull request Sep 21, 2023
18 tasks
Copy link
Contributor

@nan-li nan-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, noting we don't save the timezone_id to the properties model locally until the next session via hydration from a fetch user.

@nan-li nan-li self-requested a review September 22, 2023 20:06
@@ -99,6 +93,8 @@ internal class LoginUserOperationExecutor(
private suspend fun createUser(createUserOperation: LoginUserOperation, operations: List<Operation>): ExecutionResponse {
var identities = mapOf<String, String>()
var subscriptions = mapOf<String, SubscriptionObject>()
val properties = mutableMapOf<String, String>()
properties["timezone_id"] = TimeUtils.getTimeZoneId()!!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to remove !! and change TimeUtils.getTimeZoneId() to return a non-optional String. That method seems like it should always return a String.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Ya that method always returns a string so I changed its return type to be non-optional

@emawby emawby requested a review from nan-li September 22, 2023 21:27
@emawby emawby merged commit 6839f4c into user-model/main Sep 25, 2023
1 of 3 checks passed
@emawby emawby deleted the fix/timezone_id_not_set branch September 25, 2023 17:30
@jennantilla jennantilla mentioned this pull request Sep 25, 2023
jinliu9508 pushed a commit that referenced this pull request Jan 31, 2024
jinliu9508 pushed a commit that referenced this pull request Jan 31, 2024
jinliu9508 pushed a commit that referenced this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Timed Push Notifications are not received at the correct hour
2 participants