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

UX: Improve email testing admin tool. #6308

Merged
merged 1 commit into from
Aug 29, 2018
Merged

Conversation

nbianca
Copy link
Member

@nbianca nbianca commented Aug 24, 2018

Fixes this.

@discoursebot
Copy link

You've signed the CLA, nbianca. Thank you! This pull request is ready for review.

function() {
self.set("sentTestEmail", true);
function(response) {
self.set("sentTestEmailMessage", response.sentTestEmailMessage);
Copy link
Contributor

Choose a reason for hiding this comment

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

While you're in there, you could improve this to use the (response) => form of functions, which would mean you could use this instead of self. I'd like to remove the self pattern from our code.

@@ -11,7 +11,13 @@ def test
params.require(:email_address)
begin
Jobs::TestEmail.new.execute(to_address: params[:email_address])
render body: nil
if SiteSetting.disable_emails == "yes"
render json: { sentTestEmailMessage: 'admin.email.sent_test_disabled' }
Copy link
Member

@ZogStriP ZogStriP Aug 24, 2018

Choose a reason for hiding this comment

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

It would be better to directly respond with the translated string instead of the name of the string

@nbianca nbianca force-pushed the send_email branch 2 times, most recently from 68e2efc to d448ac9 Compare August 24, 2018 22:20
elsif SiteSetting.disable_emails == "non-staff" && !User.find_by_email(params[:email_address])&.staff?
render json: { sentTestEmailMessage: I18n.t("admin.email.sent_test_disabled_for_non_staff") }
else
render json: { sentTestEmailMessage: I18n.t("admin.email.sent_test") }
Copy link
Contributor

Choose a reason for hiding this comment

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

Our convention is to use snake_case instead of camelCase on the server side even for keys in the payload. We should add a spec for this as well 😸

@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/email-test-area-should-warn-if-emails-are-disabled/95269/6

@nbianca nbianca deleted the send_email branch October 9, 2018 09:35
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/send-test-email-doesnt-show-a-status/109272/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants