-
-
Notifications
You must be signed in to change notification settings - Fork 834
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
Send Test Mail Feature #2023
Send Test Mail Feature #2023
Conversation
Some high-level things before I dive deeper into the code:
|
Oh, one more thing... question for @flarum/core: |
Good idea about using the email address. And yeah I considered doing it through the queue, but we would need it to be synchronous, which is why so much logic is recreated. Updated to use the current user's email address. This is cleaner, and also prevents possible spamming abuse (if an admin's credentials leak and we have very very lazy hackers :D). Screenshots: As a side note, what's the 'mail' driver supposed to do? Looks like it always fails... I'm seeing it's the "NullDriver", but maybe we should call it something else in the frontend for clarity? |
Thanks, will update! I'm not super familiar with mithril so I appreciate the advice! Edit: Done! |
If you use dispatchNow just use the Bus instead of the queue. The bus has dispatchNow to fire off the job immediately. |
My point is, I don't think we should save incorrect settings, so while saving the settings reduces the amount of code, it's also un intuitive to the user and might break the system. That's why I don't want to call into the app's mailer. Right now, I'm essentially reconstructing a SwiftMailer and just using that, were y'all thinking of a different approach? |
How do other platforms do it ? I was under the impression most systems first save the email info, and then offer a way to test the currently saved configuration. IMO Sending the test email without saving the settings first could leave people believing everything is okay and closing the window without saving the settings they just entered. If you use the saved credentials, you're testing that the currently saved configuration is valid. Which I think is the most important. |
I modelled this off of what I remember while using Discourse. I also think that since the send test email button is before the send button, that should be clear to users. I could add additional text clarifying. From a UX perspective, I'd prefer to be able to test send until it works, then save. IMO it's better not to save credentials unless we know theyre valid. Yes it would make the code cleaner, but if our goal is to minimize incorrect configuration. Tbh, I'd prefer to go as far as disabling the save settings button until a test email has been sent |
I think saving credentials that are not yet valid is a perfectly valid use case, so requiring sending a test email would be problematic for that use case. Also from a development standpoint I might be offline while I configure email, this shouldn't prevent saving some settings. Usually when entering new email settings you don't yet have a valid setup. So saving or not saving the potentially invalid credentials wouldn't change a thing 🤷♂️ The only case where I might want to test before saving is when changing from one email provider to another. Seeing this makes the code more complex, I'd recommend not including that in core. An extension could provide a way to test email credentials without saving them if someone needs that feature. The test email button could simply be grayed out until you save credentials. My opinion of course. I would love to hear what other think. Random thought: how often do people enter wrong credentials ? It's been years since I had email problems. I always copy-paste the credentials from my provider and it just works. |
I totally agree with Clark. Also consider that the "Test Email" button can be useful to debug / confirm temporary problems with sending emails (rate limiting etc.) - no need for changing any settings there.
Exactly, I was going to suggest that as well. We already do the opposite for the "Save" button IIRC - it is grayed out until at least one value has been changed. |
P.S.: My suggestion was not primarily about simplifying the code - it's how I've always envisioned that feature. Sorry for not being clearer in the ticket. |
Ok, sounds good, I'll rework this |
Done! |
One nitpick. Not sure what the others think. Would it make more sense to use route test/mail instead, so that we can share this path for other logic? Or maybe even confirm-settings/mail? |
I think mail/test (what's being proposed here) only makes sense if we change mail-settings to mail/settings (which I think I have in this PR) (which on second thought I should split into a second PR, I'll do that later today). I'm not sure about confirm-settings/mail, since it's not really a confirmation (i see that more as a user action), but I'm fine with both test/mail and mail/test |
I feel like it'd be better to have them as |
c662438
to
ca0a961
Compare
Because we now auto-format our JS code with Prettier, this branch now has conflicts with Please take the steps outlined in the forum to resolve the conflicts. |
bf23934
to
fc0b163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things I noticed.
I like how there's less and less code after each review. Less code while retaining readability for the same feature is better :)
82db803
to
6911395
Compare
Thanks for the review, now simplified further! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, love the iterations to a clearer codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more observations
Oops I see you've taken my suggestions to the max. I actually think it's a bit too much now 😅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code clean up. I haven't looked at the whole thing yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still haven't tested it locally, but it's looking fine now.
To still nitpick, I see there's still a diff on lines 101-now-102 and 107-now-108 of MailPage
, were those edits actually required?
Fixes #1655
Changes proposed in this pull request:
Reviewers should focus on:
Confirmed
composer test
).