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

Add helper text for "server URL" with link to documentation #595

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VatsalBhesaniya
Copy link

@VatsalBhesaniya VatsalBhesaniya commented Mar 27, 2024

Add helper text below the "server URL" field that, when tapped, opens relevant Zulip documentation explaining what a server URL is and how to find theirs. It will help users understand the "server URL" field during login.

Fixes: #109

Screen.Recording.2024-03-29.at.10.53.04.AM.mov

Simulator Screenshot - iPhone 15 Pro Max - 2024-03-29 at 10 55 02

Screen.Recording.2024-03-28.at.7.06.06.PM.mov

Screenshot_1711685963

@abelaba
Copy link
Contributor

abelaba commented Mar 27, 2024

Hey, so one thing I would say is that your commit message should have a description. As stated here
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-description

@abelaba
Copy link
Contributor

abelaba commented Mar 27, 2024

You must also add new tests for your code so that maintainers will review your code in detail.
https://github.com/zulip/zulip-flutter?tab=readme-ov-file#writing-tests

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks @VatsalBhesaniya, I'm looking forward to this! This will help people get what they need to start using the app.

Small comments below. Also, this will need tests. Here are the things I would test:

  • Basic happy case: When the text is tapped, the URL is opened. For this, see our uses of testBinding.takeLaunchUrlCalls().
  • Error case: When the URL fails to be opened, we show an error dialog. For this, see our uses of testBinding.launchUrlResult and checkErrorDialog.

Also, please mark the commit with a Fixes line. I see you've already done this in the GitHub PR description. 🙂

lib/widgets/login.dart Outdated Show resolved Hide resolved
assets/l10n/app_en.arb Outdated Show resolved Hide resolved
lib/widgets/login.dart Outdated Show resolved Hide resolved
lib/widgets/login.dart Show resolved Hide resolved
lib/widgets/login.dart Outdated Show resolved Hide resolved
@VatsalBhesaniya VatsalBhesaniya force-pushed the login-server-url-doc-link branch 4 times, most recently from 130093f to 3d0f90a Compare March 28, 2024 13:25
@VatsalBhesaniya
Copy link
Author

Hey, so one thing I would say is that your commit message should have a description. As stated here https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-description

@abelaba Thank you for your feedback. 🙂

@VatsalBhesaniya
Copy link
Author

VatsalBhesaniya commented Mar 28, 2024

Thanks @VatsalBhesaniya, I'm looking forward to this! This will help people get what they need to start using the app.

Small comments below. Also, this will need tests. Here are the things I would test:

  • Basic happy case: When the text is tapped, the URL is opened. For this, see our uses of testBinding.takeLaunchUrlCalls().
  • Error case: When the URL fails to be opened, we show an error dialog. For this, see our uses of testBinding.launchUrlResult and checkErrorDialog.

Also, please mark the commit with a Fixes line. I see you've already done this in the GitHub PR description. 🙂

Thanks for the positive feedback! 🙂
I appreciate your suggestions on tests. I've added tests covering the success and the error cases.

I've also updated the commit message to include the Fixes line.

Please let me know if you have any further feedback or require any additional changes to the tests.

@chrisbobbe
Copy link
Collaborator

Hi! One small comment I meant to leave last time, and I think Greg intends to do the next full review. 🙂

There's still a TODO(#109) in the code that should be removed in the commit that's marked as fixing #109. I've proposed an automated way to catch things like this:

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @VatsalBhesaniya for adding this (and for the upstream PR flutter/flutter#145157 that added this helper field!) See comments below.

lib/widgets/login.dart Outdated Show resolved Hide resolved
lib/widgets/login.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
assets/l10n/app_en.arb Outdated Show resolved Hide resolved
@VatsalBhesaniya VatsalBhesaniya force-pushed the login-server-url-doc-link branch 12 times, most recently from 3585ecd to 98f2e2f Compare March 29, 2024 07:46
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @VatsalBhesaniya for the revision!

In this version, the first commit introduces a duplicate _launchUrl function which is missing the mode logic, much like in the previous revision as discussed at #595 (comment) . Then the second commit deduplicates the two functions into one combined place.

As part of writing clear and coherent commits, we want to avoid that intermediate step where we're adding a _launchUrl function that has the wrong behavior. So instead a good commit sequence would be:

After that's done it'll again be possible to do a fine-grained review. In the meantime, here's a couple of comments from a high-level look.

lib/widgets/launch_url.dart Outdated Show resolved Hide resolved
lib/widgets/launch_url.dart Outdated Show resolved Hide resolved
@VatsalBhesaniya VatsalBhesaniya force-pushed the login-server-url-doc-link branch 4 times, most recently from fbbcc13 to a683136 Compare April 2, 2024 11:57
@VatsalBhesaniya
Copy link
Author

Thanks @VatsalBhesaniya for the revision!

In this version, the first commit introduces a duplicate _launchUrl function which is missing the mode logic, much like in the previous revision as discussed at #595 (comment) . Then the second commit deduplicates the two functions into one combined place.

As part of writing clear and coherent commits, we want to avoid that intermediate step where we're adding a _launchUrl function that has the wrong behavior. So instead a good commit sequence would be:

After that's done it'll again be possible to do a fine-grained review. In the meantime, here's a couple of comments from a high-level look.

Thank you for your detailed feedback and guidance!

I have followed your suggested approach and updated the commits accordingly. Let me know if you have any further suggestions.

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks @VatsalBhesaniya! Small comments below.

Also, please wrap the body text of each commit message; some lines have gotten too long: https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#formatting-guidelines

lib/widgets/launch_url.dart Outdated Show resolved Hide resolved
lib/widgets/launch_url.dart Outdated Show resolved Hide resolved
assets/l10n/app_en.arb Outdated Show resolved Hide resolved
lib/widgets/launch_url.dart Outdated Show resolved Hide resolved
lib/widgets/login.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
test/widgets/login_test.dart Outdated Show resolved Hide resolved
lib/widgets/content.dart Show resolved Hide resolved
assets/l10n/app_en.arb Show resolved Hide resolved
assets/l10n/app_en.arb Show resolved Hide resolved
@VatsalBhesaniya VatsalBhesaniya force-pushed the login-server-url-doc-link branch 9 times, most recently from 1f6de5b to f5efcb1 Compare April 10, 2024 10:36
- Move the existing launchUrl logic from content.dart to a new file
  named launch_url.dart.
- Split function into pieces to handle realm-based and non-realm
  URLs.
- Refactor error handling into a private  function.
@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Apr 10, 2024

Hi @VatsalBhesaniya, it looks like you've updated the PR branch. Is it ready for another review? When you push updates and it's ready for another review, it's helpful if you post a comment saying so, for explicitness; that way reviewers don't have to guess. 🙂

@VatsalBhesaniya
Copy link
Author

VatsalBhesaniya commented Apr 11, 2024

Hi @VatsalBhesaniya, it looks like you've updated the PR branch. Is it ready for another review? When you push updates and it's ready for another review, it's helpful if you post a comment saying so, for explicitness; that way reviewers don't have to guess. 🙂

Hi @chrisbobbe, Yes, the PR branch is ready for another review! I apologize for the confusion. I made updates locally, but for some reason, they weren't reflecting on GitHub 🤔. This hasn't happened to me before, so I hesitated to request another review until I was certain everything was pushed correctly.
Now I can see all of my updates. 🙂

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks @VatsalBhesaniya! This is very close. Small comments below, and also #595 (comment) (which doesn't appear below for some reason).

lib/widgets/login.dart Show resolved Hide resolved

final internalNarrow = parseInternalLink(url, store);
if (internalNarrow != null) {
Navigator.push(context, MessageListPage.buildRoute(context: context, narrow: internalNarrow));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Navigator.push(context, MessageListPage.buildRoute(context: context, narrow: internalNarrow));
Navigator.push(context,
MessageListPage.buildRoute(context: context, narrow: internalNarrow));

nit: break very long line with important information at the end

@@ -61,7 +64,48 @@ void main() {
expectErrorFromText('email@example.com', ServerUrlValidationError.noUseEmail);
});

// TODO test AddAccountPage
group('AddAccountPage Server URL Helper Text', () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
group('AddAccountPage Server URL Helper Text', () {
group('AddAccountPage server URL helper text', () {

nit: match capitalization to other groups

Comment on lines +84 to +85
final helper = await findHelperText(tester);
await tester.tap(helper);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
final helper = await findHelperText(tester);
await tester.tap(helper);
await tester.tap(await findHelperText(tester));

nit: could save a line by inlining this expression (here and in the other test)

Comment on lines +100 to +106
await tester.tap(find.byWidget(checkErrorDialog(
tester,
expectedTitle: zulipLocalizations.errorUnableToOpenLinkTitle,
expectedMessage: zulipLocalizations.errorUnableToOpenLinkMessage(
AddAccountPage.serverUrlHelpUrl.toString(),
),
)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
await tester.tap(find.byWidget(checkErrorDialog(
tester,
expectedTitle: zulipLocalizations.errorUnableToOpenLinkTitle,
expectedMessage: zulipLocalizations.errorUnableToOpenLinkMessage(
AddAccountPage.serverUrlHelpUrl.toString(),
),
)));
await tester.tap(find.byWidget(checkErrorDialog(tester,
expectedTitle: zulipLocalizations.errorUnableToOpenLinkTitle,
expectedMessage: zulipLocalizations.errorUnableToOpenLinkMessage(
AddAccountPage.serverUrlHelpUrl.toString(),
))));

nit: could be denser here, using fewer lines

@gnprice gnprice added the completion candidate PR with reviews that may unblock merging label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completion candidate PR with reviews that may unblock merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

login: Link to doc to help users understand what a "server URL" is and how to find theirs
4 participants