-
Notifications
You must be signed in to change notification settings - Fork 19
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: fix error when updating Telegram ID for an existing phone number #1178
Conversation
I thought of one additional edge case when thinking about the fix. However, given that it sounds like a really rare scenario, it might not be worth handling it. Imagine this scenario: There are 2 rows in the
What if a user tries to update with the following parameters: I couldn't think of a clear cut answer. One solution would be to delete one of the rows and update the other. Another would be to treat both rows as the same and merge them. Steps to achieve this scenario:
Decision |
1be2302
to
8c5ec1a
Compare
I think this seem reasonably rare that we don't have to handle it. |
Split the update into 4 cases: 1. same phone number and telegram ID 2. same phone number, different telegram ID 3. different phone number, same telegram ID <-- broken since phone_number is a primary key, and sequelize doesn't allow updates for primary keys 4. different phone number, different telegram ID Minor improvements: 1. Make the bot replies more granular based on what actually happened in the backend.
Split into 2 scenarios instead.
8c5ec1a
to
3cd28fc
Compare
* develop: fix: fix error when updating Telegram ID for an existing phone number (#1178) chore: upgrade React; use new JSX transform; sort imports (#1129) fix(backend): docker build and tsc output directory structure (#1177) feat: refactor msg template components; add telegram character limit (#1148) refactor: use shared function to initialize models (#1172) chore: setup scaffolding for backend tests (#940) 1.23.0 fix(frontend): fix frontend test flakiness (#1162) fix: update successful delivery status only if error does not exist (#1150) chore: upgrade dependencies (#1153)
Problem
Closes issue #1143
Solution
Bug Fixes:
Tests
These tests have been verified on staging.
Users should be able to update telegram ID for an existing phone number
telegram_id
to a different number in thetelegram_subscribers
table./updatenumber
command on the Telegram botYour phone number and Telegram ID have been updated.
andtelegram_id
should be updated in thetelegram_subscribers
table.Users should be able to update phone number for an existing telegram ID
phone_number
to a different number in thetelegram_subscribers
table./updatenumber
command on the Telegram botYour phone number and Telegram ID have been updated.
andphone_number
should be updated in thetelegram_subscribers
table.Users should be able to create a new
telegram_subscribers
rowtelegram_subscribers
table./updatenumber
command on the Telegram botYour phone number and Telegram ID have been updated.
and there should be a new row reflecting yourphone_number
andtelegram_id
in the table.