-
Notifications
You must be signed in to change notification settings - Fork 1
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: broken invitation link #1729
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Motivation ---------- It took me a while to debug the 404 error when clicking on the link to: ``` http://localhost:3000/onboarding/whats-app?jwt=eyJhbGc ``` I was expecting to see a problem in `config/routes.rb` but couldn't find anything. It was surprising to me that we programmatically throw a 404 in one of the controllers. How to test ----------- 1. `bin/rspec ./spec/adapters/signal_adapter/api_spec.rb` 2. Tests pass Requested changes ----------------- @mattwr18 asked me to implement this consistently across our codebase. I have seen this only once, here's the commit that introduced it: 9a541d6. Thankfully there is already a test (that still fails if you remove conditional routing). In the tests there was: ``` unless Setting.signal_server_phone_number allow(Setting).to receive(:signal_server_phone_number).and_return('SIGNAL_SERVER_PHONE_NUMBER') # .. end ``` from 07694a6. @mattwr18 this looks intentional, why was that? Did I miss anything?
merge after #1728 Motivation ---------- So this is a follow up for #1728. It will prevent rendering the whatsapp link unless activated. We still have an inconsistency, because the channel links depend on `Setting.channels` whereas the routing depends on `Setting.whatsapp_configured?`. Ie. `Setting.channels` can be activated for whatsapp although `Setting.whatsapp_configured?` is false. How to test ----------- 1. `bin/rspec spec/system/onboarding/index.spec.rb` 2. See: ``` Onboarding visit /onboarding/ if WhatsApp was explicitly activated or activated by configuration renders invitation link for WhatsApp but if WhatsApp is deactivated renders no invitation link for WhatsApp ```
roschaefer
force-pushed
the
fix-broken-link-if-whatsapp-not-configured
branch
from
December 13, 2023 15:49
e8cc810
to
c65a5c1
Compare
roschaefer
added a commit
that referenced
this pull request
Dec 13, 2023
Motivation ---------- Also this took me way too long to fix. #1729 suffers under some unrelated failing spec. On my machine, even when I `git switch main` on the 07694a6 I will see sometimes a failing spec, sometimes it passes. Here is an example: ``` 1) Configuring Onboarding Channels allows activating and deactivating onboarding channels Failure/Error: expect(page).to have_current_path(settings_path(as: admin)) expected "/settings" to equal "/settings?as=177" [Screenshot Image]: tmp/screenshots/failures_r_spec_example_groups_configuring_onboarding_channels_allows_activating_and_deactivating_onboarding_channels_617.png # ./spec/system/settings/onboarding_channels_spec.rb:26:in `block (2 levels) in <main>' # ./spec/support/better_rails_system_tests.rb:26:in `block (2 levels) in <main>' # -e:1:in `<main>' ``` I don't think it is necessary to check the query params here, maybe it was even an oversight. What I still don't understand: What is `some_route_path(as: some_user)` even doing? And why did it work in the past? How to test ----------- 1. `git switch main` 2. `bin/rspec spec/system/settings/onboarding_channels_spec.rb` multiple (!) times 3. Sometims green, sometimes red This should not happen on this branch anymore.
Merged
roschaefer
added a commit
that referenced
this pull request
Jan 9, 2024
Motivation ---------- Also this took me way too long to fix. #1729 suffers under some unrelated failing spec. On my machine, even when I `git switch main` on the 07694a6 I will see sometimes a failing spec, sometimes it passes. Here is an example: ``` 1) Configuring Onboarding Channels allows activating and deactivating onboarding channels Failure/Error: expect(page).to have_current_path(settings_path(as: admin)) expected "/settings" to equal "/settings?as=177" [Screenshot Image]: tmp/screenshots/failures_r_spec_example_groups_configuring_onboarding_channels_allows_activating_and_deactivating_onboarding_channels_617.png # ./spec/system/settings/onboarding_channels_spec.rb:26:in `block (2 levels) in <main>' # ./spec/support/better_rails_system_tests.rb:26:in `block (2 levels) in <main>' # -e:1:in `<main>' ``` I don't think it is necessary to check the query params here, maybe it was even an oversight. What I still don't understand: What is `some_route_path(as: some_user)` even doing? And why did it work in the past? How to test ----------- 1. `git switch main` 2. `bin/rspec spec/system/settings/onboarding_channels_spec.rb` multiple (!) times 3. Sometims green, sometimes red This should not happen on this branch anymore.
roschaefer
added a commit
that referenced
this pull request
Jan 9, 2024
Motivation ---------- Also this took me way too long to fix. #1729 suffers under some unrelated failing spec. On my machine, even when I `git switch main` on the 07694a6 I will see sometimes a failing spec, sometimes it passes. Here is an example: ``` 1) Configuring Onboarding Channels allows activating and deactivating onboarding channels Failure/Error: expect(page).to have_current_path(settings_path(as: admin)) expected "/settings" to equal "/settings?as=177" [Screenshot Image]: tmp/screenshots/failures_r_spec_example_groups_configuring_onboarding_channels_allows_activating_and_deactivating_onboarding_channels_617.png # ./spec/system/settings/onboarding_channels_spec.rb:26:in `block (2 levels) in <main>' # ./spec/support/better_rails_system_tests.rb:26:in `block (2 levels) in <main>' # -e:1:in `<main>' ``` I don't think it is necessary to check the query params here, maybe it was even an oversight. What I still don't understand: What is `some_route_path(as: some_user)` even doing? And why did it work in the past? How to test ----------- 1. `git switch main` 2. `bin/rspec spec/system/settings/onboarding_channels_spec.rb` multiple (!) times 3. Sometims green, sometimes red This should not happen on this branch anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
merge after #1728
Motivation
So this is a follow up for #1728.
It will prevent rendering the whatsapp link unless activated.
We still have an inconsistency, because the channel links depend on
Setting.channels
whereas the routing depends onSetting.whatsapp_configured?
. Ie.Setting.channels
can be activatedfor whatsapp although
Setting.whatsapp_configured?
is false.How to test
bin/rspec spec/system/onboarding/index.spec.rb