? ? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
31 Mar 2016

Summary of Changes

  • Adds the correct HTTP header mimetype for json in sendmail test response and changes the HTTP method from GET to POST so the smtp server details (host, port, user, password) doesn't appear in the server/proxies log files.
  • Catch HTTP or json failure errors and display error message when that happens.

Testing Instructions

Correct HTTP header mimetype and HTTP method
  1. Go to global config in the admin panel
  2. Open the console in the chrome (F12)
  3. Select "Network" tab, "XHR" separator in Chrome console
  4. Click the "Send Test Mail" button. You will see a new URI in the Chrome console, click on it. Check in the "Response headers" the "Content type" HTTP header is content-type:text/html; charset=UTF-8 and the HTTP method is GET
  5. Apply patch
  6. Repeat steps 1 (clear javascript cache Ctrl+F5) to 4, you will see in the "Response headers" the content type HTTP header is content-type:application/json; charset=utf-8 and the HTTP method is POST
Catch HTTP or json failure errors
trigger_error('aaa', E_USER_WARNING);
  • Go to global config in the admin panel and send a test mail
  • You will get an error message (without this patch you get no message - javascript error). image
avatar andrepereiradasilva andrepereiradasilva - open - 31 Mar 2016
avatar andrepereiradasilva andrepereiradasilva - change - 31 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Mar 2016
Labels Added: ?
avatar brianteeman
brianteeman - comment - 31 Mar 2016

is #5238 related?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

i think that's unrelated to this issue.

avatar brianteeman
brianteeman - comment - 31 Mar 2016

ok - fair enough ;)

avatar mbabker
mbabker - comment - 31 Mar 2016

Being completely honest with you, the last time I tried working with JDocumentJson it just felt completely broken (like it doesn't even JSON encode the data buffer for starters). Also seems pretty stupid if it forces downloads (which it didn't in that case where I was using it in Chrome, and this was last month I was working with it).

BTW, this is just me being nit-picky for the sake of being nit-picky, but headers should be consistently set and sent through the application like https://github.com/joomla/joomla-cms/blob/staging/components/com_finder/controllers/suggestions.json.php does (the day components ever get real automated tests written for them using PHP's header() function will just make things act up).

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

ok just changed jquery javascript to handle the json object data without the need to use parseJSON (it's already fetched as a json object).

ready for testing.

NOTE: i also changed the HTTP method to POST so the smtp server password doesn't appear in the server/proxies log files.

avatar andrepereiradasilva andrepereiradasilva - change - 31 Mar 2016
Title
Use correct mimetype in HTTP headers for the json result in send mail test
[Send Test Mail] Use json MimeType and send data via POST method
avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

@piotrmocko please try now i have added some ajax fail treatments in this PR.

Don't forgot to clear the browser cache.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

no it also works on malformed json , just tested.

to trown a warning i added

trigger_error('aaa', E_USER_WARNING);

in https://github.com/joomla/joomla-cms/pull/9685/files#diff-f0600c10281461980c2770b1951d453eR42

Result:
image

HTTP status 200. Page:

Warning: aaa in /path/to/joomla-staging/administrator/components/com_config/controller/application/sendtestmail.php on line 42
{"success":true,"message":null,"messages":{"success":["The email was sent successfully to <strong>test@test.com<\/strong> using <strong>SMTP<\/strong>. You should check that you've received the test email."]},"data":true}
avatar piotrmocko
piotrmocko - comment - 31 Mar 2016

I will test it again

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

ok, don't forget to clear the browser cache

avatar andrepereiradasilva andrepereiradasilva - change - 31 Mar 2016
Title
[Send Test Mail] Use json MimeType and send data via POST method
[Send Test Mail] Use json MimeType, send data via POST method and catch json response errors
avatar richard67 richard67 - test_item - 31 Mar 2016 - Tested successfully
avatar richard67
richard67 - comment - 31 Mar 2016

I have tested this item :white_check_mark: successfully on 6d22f55

Tested as described in the instructions, but with Firefox/Firebug and not Chrome console :tongue:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar piotrmocko
piotrmocko - comment - 31 Mar 2016

Finally it helped :) It looks like it has changed in jQuery in last years.
You may consider to display in the message:
(jqXHR.responseText.indexOf('<html') === -1 ? jqXHR.responseText : error)

avatar joomla-cms-bot
joomla-cms-bot - comment - 31 Mar 2016

This PR has received new commits.

CC: @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot
joomla-cms-bot - comment - 31 Mar 2016

This PR has received new commits.

CC: @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

@richard67 @piotrmocko
Added better error reporting,Test instructions updated. Please test now.

avatar richard67
richard67 - comment - 31 Mar 2016

If you explain me what "mimified" means :smile:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

If you explain me what "mimified" means :smile:

copy pasting ... errors... and lack of sleep

avatar richard67
richard67 - comment - 31 Mar 2016

Ah, I thought maybe it has to do with a girl named "Mimi"


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar richard67
richard67 - comment - 31 Mar 2016

@andrepereiradasilva The error message I get in the test looks as follows:

A parse error as occured while processing the following JSON data:
Warning: aaa in /homepages/38/d391032706/htdocs/test7/administrator/components/com_config/controller/application/sendtestmail.php on line 43
{"success":true,"message":null,"messages":{"success":["The email was sent successfully to admin@richard-fath.de<\/strong> using PHP Mail<\/strong>. You should check that you've received the test email."]},"data":true}

Was that intentional, that the json part is in the message?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar brianteeman
brianteeman - comment - 31 Mar 2016

Who is mimi and who gave her a massage?

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

@richard67 yes it's intentional to show why the parse error.

avatar andrepereiradasilva
andrepereiradasilva - comment - 31 Mar 2016

Who is mimi and who gave her a massage?

The question is: who got a massage from mimi ;)

avatar richard67 richard67 - test_item - 31 Mar 2016 - Tested successfully
avatar richard67
richard67 - comment - 31 Mar 2016

I have tested this item :white_check_mark: successfully on 69bb1de


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Apr 2016

@piotrmocko can you test this so it can be RTC for 3.5.2 too?

avatar brianteeman brianteeman - change - 2 Apr 2016
Category JavaScript
avatar piotrmocko
piotrmocko - comment - 4 Apr 2016

I will test it today
02.04.2016 13:37 "andrepereiradasilva" notifications@github.com
napisał(a):

@piotrmocko https://github.com/piotrmocko can you test this so it can
be RTC for 3.5.2 too?

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#9685 (comment)

avatar mikeveeckmans mikeveeckmans - test_item - 5 Apr 2016 - Tested successfully
avatar mikeveeckmans
mikeveeckmans - comment - 5 Apr 2016

I have tested this item :white_check_mark: successfully on 69bb1de

TEST OK


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar piotrmocko
piotrmocko - comment - 5 Apr 2016

I have tested this item :white_check_mark: successfully on 69bb1de

TEST OK

avatar brianteeman brianteeman - change - 5 Apr 2016
Status Pending Ready to Commit
avatar brianteeman
brianteeman - comment - 5 Apr 2016

RTC - thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot joomla-cms-bot - change - 5 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 5 Apr 2016
Milestone Added:
avatar wilsonge
wilsonge - comment - 6 Apr 2016

Sorry to be a pain as this is already RTC but is there a reason why these javascript errors can't be made lang strings?

avatar andrepereiradasilva
andrepereiradasilva - comment - 6 Apr 2016

is it possible to merge this and them i will take care of the messages in a new PR?

Just saying this because @anibalsanchez wants to make a PR too (see anibalsanchez#1) to correct a bug.
But since this has a minified js it gets conflicts and we have to redo the js.

avatar andrepereiradasilva
andrepereiradasilva - comment - 7 Apr 2016

ok, will made the changes needed.

avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Apr 2016

This PR has received new commits.

CC: @mikeveeckmans, @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2016
Labels Added: ?
avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Apr 2016

This PR has received new commits.

CC: @mikeveeckmans, @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Apr 2016

This PR has received new commits.

CC: @mikeveeckmans, @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Apr 2016

This PR has received new commits.

CC: @mikeveeckmans, @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 7 Apr 2016

ok. language variables added.

avatar brianteeman brianteeman - change - 7 Apr 2016
Category JavaScript JavaScript Language & Strings
avatar brianteeman brianteeman - change - 7 Apr 2016
Labels
avatar brianteeman brianteeman - change - 7 Apr 2016
Status Ready to Commit Pending
avatar brianteeman
brianteeman - comment - 7 Apr 2016

Removed the RTC label and made some comments on the language strings


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2016
Labels Removed: ?
avatar joomla-cms-bot
joomla-cms-bot - comment - 7 Apr 2016

This PR has received new commits.

CC: @mikeveeckmans, @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar andrepereiradasilva
andrepereiradasilva - comment - 7 Apr 2016

The latest change was adding javascript language vars as @wilsonge requested.

@mikeveeckmans, @richard67, @brianteeman can you retest to get this RTC again?

avatar wilsonge
wilsonge - comment - 7 Apr 2016

This looks MUCH better - thankyou!

avatar richard67 richard67 - test_item - 7 Apr 2016 - Tested successfully
avatar richard67
richard67 - comment - 7 Apr 2016

I have tested this item :white_check_mark: successfully on f56e8c8


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar anibalsanchez anibalsanchez - test_item - 8 Apr 2016 - Tested successfully
avatar anibalsanchez
anibalsanchez - comment - 8 Apr 2016

I have tested this item :white_check_mark: successfully on f56e8c8

Test OK


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar anibalsanchez anibalsanchez - reference | 6a109d3 - 8 Apr 16
avatar anibalsanchez anibalsanchez - reference | 8b4ffa2 - 8 Apr 16
avatar brianteeman brianteeman - change - 8 Apr 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 8 Apr 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar joomla-cms-bot joomla-cms-bot - change - 8 Apr 2016
Labels Added: ?
avatar anibalsanchez
anibalsanchez - comment - 8 Apr 2016

I have updated #9768 with the code from this issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9685.

avatar rdeutz rdeutz - change - 12 Apr 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-04-12 20:16:32
Closed_By rdeutz
avatar rdeutz rdeutz - reference | d5a0c4b - 12 Apr 16
avatar rdeutz rdeutz - merge - 12 Apr 2016
avatar rdeutz rdeutz - close - 12 Apr 2016
avatar andrepereiradasilva andrepereiradasilva - head_ref_deleted - 12 Apr 2016
avatar rdeutz rdeutz - change - 1 May 2016
Milestone Removed:
avatar rdeutz rdeutz - change - 1 May 2016
Milestone Added:
avatar rdeutz rdeutz - change - 1 May 2016
Milestone Added:
avatar rdeutz rdeutz - change - 1 May 2016
Milestone Removed:
avatar brianteeman brianteeman - change - 11 May 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment