From 5a890d0d8b71fce8febda109a68b80a5a2a37e25 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 23 Jun 2016 16:39:05 +0100 Subject: [PATCH 01/19] Add log matching rules. --- .../HumanReadableLogsRules.coffee | 142 +++++++++++++----- 1 file changed, 101 insertions(+), 41 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index a94e756244..d5900a8e19 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -1,43 +1,103 @@ define -> [ - # regexToMatch: /Too many }'s/ - # extraInfoURL: "" - # humanReadableHint: """ - # The reason LaTeX thinks there are too many }'s here is that the opening curly brace is missing after the \\date control sequence and before the word December, so the closing curly brace is seen as one too many (which it is!). - # """ - # , - # regexToMatch: /Undefined control sequence/ - # extraInfoURL: "/learn/Errors:Undefined_control_sequence." - # humanReadableHint: """ - # In this example, LaTeX is complaining that it has no such command ("control sequence") as \\dtae. Obviously it's been mistyped, but only a human can detect that fact: all LaTeX knows is that \\dtae is not a command it knows about: it's undefined. - # """ - # , - # regexToMatch: /Missing \$ inserted/ - # extraInfoURL: "/learn/Errors:Missing_$_inserted" - # humanReadableHint: """ - # A character that can only be used in the mathematics was inserted in normal text. If you intended to use mathematics mode, then use $...$ or \\begin{math}...\\end{math} or use the 'quick math mode': \\ensuremath{...}. - # """ - # , - # regexToMatch: /Runaway argument/ - # extraInfoURL: "/learn/Errors:Undefined_control_sequence." - # humanReadableHint: """ - # In this error, the closing curly brace has been omitted from the date. It's the opposite of the error of too many }'s, and it results in \\maketitle trying to format the title page while LaTeX is still expecting more text for the date! - # """ - # , - # regexToMatch: /Underfull \\hbox/ - # extraInfoURL: "/learn/Errors:Underfull_%5Chbox" - # humanReadableHint: """ - # This is a warning that LaTeX cannot stretch the line wide enough to fit, without making the spacing bigger than its currently permitted maximum. The badness (0-10,000) indicates how severe this is (here you can probably ignore a badness of 1394). - # """ - # , - # regexToMatch: /Overfull \\hbox/ - # extraInfoURL: "" - # humanReadableHint: """ - # An overfull \\hbox means that there is a hyphenation or justification problem: moving the last word on the line to the next line would make the spaces in the line wider than the current limit; keeping the word on the line would make the spaces smaller than the current limit, so the word is left on the line, but with the minimum allowed space between words, and which makes the line go over the edge. - # """ - # , - # regexToMatch: /LaTeX Error: File .* not found/ - # extraInfoURL: "/learn/Errors:missing_package" - # humanReadableHint: """ - # When you use the \\usepackage command to request LaTeX to use a certain package, it will look for a file with the specified name and the filetype .sty. In this case the user has mistyped the name of the paralist package, so it's easy to fix. - # """ + regexToMatch: /Misplaced alignment tab character \&/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Misplaced_alignment_tab_character_%26" + humanReadableHint: """ + You have placed an alignment tab character '&' in the wrong place. If you want to align something, you must write it inside an align environment such as \\begin{align} \u2026 \\end{align}, \\begin{tabular} \u2026 \\end{tabular}, etc. If you want to write an ampersand '&' in text, you must write \\& instead. + """ + , + regexToMatch: /Extra alignment tab has been changed to \\cr/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Extra_alignment_tab_has_been_changed_to_%5Ccr" + humanReadableHint: """ + You have written too many alignment tabs in a table, causing one of them to be turned one of them into a line break. Make sure you have specified the correct number of columns in your [table](https://www.sharelatex.com/learn/Tables). + """ + , + regexToMatch: /Display math should end with \$\$/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Display_math_should_end_with_$$." + humanReadableHint: """ + You have forgotten a $ sign at the end of 'display math' mode. When writing in \u2018display math' mode, you must always math write inside $$ \u2026 $$. Check that the number of $s match around maths. + """ + , + regexToMatch: /Missing [{$] inserted./ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Missing_$_inserted" + humanReadableHint: """ + Check that your $s match around maths. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Sybols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list [here](https://www.sharelatex.com/learn/Errors:Missing_$_inserted). If you intended to use mathematics mode, then use $ \u2026 $ or \\begin{math} \u2026 \\end{math} or use the \u2018quick math mode\u2019: \\ensuremath{...}. + """ + , + regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:There_were_undefined_references." + humanReadableHint: """ + You have referenced something which has not yet been labeled. If you have labeled it already, make sure that what is written inside \\ref{...} is the same as what is written inside \\label{...}. + """ + , + regexToMatch: /Citation .+ on page .+ undefined on input line .+/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Citation_XXX_on_page_XXX_undefined_on_input_line_XXX." + humanReadableHint: """ + You have cited something which has not been included in the bibliography. Make sure that the citation (\\cite{...}) has a corresponding label in your bibliography, and that both are spelled the same way. + """ + , + regexToMatch: /(Label .+)? multiply[ -]defined( labels)?/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:There_were_multiply-defined_labels." + humanReadableHint: """ + You have used the same label more than once. Check that each \\label{...} labels only one item. + """ + , + regexToMatch: /`!h' float specifier changed to `!ht'/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." + humanReadableHint: """ + The float specifier '!h' is too strict of a demand for LaTeX to place our float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try to keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27.). + """ + , + regexToMatch: /`h' float specifier changed to `ht'/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." + humanReadableHint: """ + The float specifier 'h' is too strict of a demand for LaTeX to place our float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Positioning_of_Figures). + """ + , + regexToMatch: /No positions in optional float specifier/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:No_positions_in_optional_float_specifier." + humanReadableHint: """ + You have forgotten to include a float specifier, which tells LaTeX where to position your figure. Find out more about float specifiers [here](https://www.sharelatex.com/learn/Positioning_of_Figures). + """ + , + regexToMatch: /Undefined control sequence/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:Undefined_control_sequence." + humanReadableHint: """ + The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \\usepackage{...}. + """ + , + regexToMatch: /File .+ not found/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:File_XXX_not_found_on_input_line_XXX." + humanReadableHint: """ + The compiler cannot find the file you want to include. Make sure that you have [uploaded the file](https://www.sharelatex.com/learn/Including_images_in_ShareLaTeX) and [specified the file location correctly](https://www.sharelatex.com/learn/Errors:File_XXX_not_found_on_input_line_XXX.). + """ + , + regexToMatch: /LaTeX Error: Unknown graphics extension: \..+/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif." + humanReadableHint: """ + The compiler does not recognise the file type of one of your images. Make sure you are using a [supported image format](https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif.) for your choice of compiler, and check that there are no full stops in the name of your image. + """ + , + regexToMatch: /LaTeX Error: Unknown float option `H'/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." + humanReadableHint: """ + The compiler isn't recognizing the float option 'H'. Include \\usepackage{float} in your preamble to fix this. + """ + , + regexToMatch: /LaTeX Error: Unknown float option `P'/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." + humanReadableHint: """ + You have used a float specifier which the compiler does not understand. The only extra float option provided by the 'float' package is 'H'. You can learn more about the different float options available for placing figures in our [documentation](https://www.sharelatex.com/learn/Positioning_of_Figures). + """ + , + regexToMatch: /LaTeX Error: Unknown float option `.+'/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." + humanReadableHint: """ + You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures [here](https://www.sharelatex.com/learn/Positioning_of_Figures). + """ + , + regexToMatch: /LaTeX Error: \\math.+ allowed only in math mode/ + extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_%5Cmathrm_allowed_only_in_math_mode." + humanReadableHint: """ + You have used a font which is only available in math mode. To use this font, you must write it in mathematics mode by using $ \u2026 $ or \\begin{math} \u2026 \\end{math}, or using the \u2018quick math mode\u2019: \\ensuremath{...}. + """ ] From 5371669f89c095c4785e6bf7f7e1b2bff34f81d0 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 23 Jun 2016 16:39:54 +0100 Subject: [PATCH 02/19] if references has no url don't send post, silently return --- .../web/app/coffee/Features/References/ReferencesHandler.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/app/coffee/Features/References/ReferencesHandler.coffee b/services/web/app/coffee/Features/References/ReferencesHandler.coffee index 7894ab6915..72b2216e69 100644 --- a/services/web/app/coffee/Features/References/ReferencesHandler.coffee +++ b/services/web/app/coffee/Features/References/ReferencesHandler.coffee @@ -84,6 +84,8 @@ module.exports = ReferencesHandler = ReferencesHandler._buildFileUrl projectId, fileId allUrls = bibDocUrls.concat(bibFileUrls) logger.log {projectId, isFullIndex, docIds, bibDocUrls}, "sending request to references service" + if !settings.apis.references.url? + return callback() request.post { url: "#{settings.apis.references.url}/project/#{projectId}/index" json: From da41e64e97844a99b0349d1182fc579dedc27243 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 23 Jun 2016 16:52:02 +0100 Subject: [PATCH 03/19] Update HumanReadableLogsRules.coffee --- .../HumanReadableLogsRules.coffee | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index d5900a8e19..3d5b20bc9a 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -8,31 +8,31 @@ define -> [ regexToMatch: /Extra alignment tab has been changed to \\cr/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Extra_alignment_tab_has_been_changed_to_%5Ccr" humanReadableHint: """ - You have written too many alignment tabs in a table, causing one of them to be turned one of them into a line break. Make sure you have specified the correct number of columns in your [table](https://www.sharelatex.com/learn/Tables). + You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your [table](https://www.sharelatex.com/learn/Tables). """ , regexToMatch: /Display math should end with \$\$/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Display_math_should_end_with_$$." humanReadableHint: """ - You have forgotten a $ sign at the end of 'display math' mode. When writing in \u2018display math' mode, you must always math write inside $$ \u2026 $$. Check that the number of $s match around maths. + You have forgotten a $ sign at the end of 'display math' mode. When writing in display math mode, you must always math write inside $$ \u2026 $$. Check that the number of $s match around each math expression. """ , regexToMatch: /Missing [{$] inserted./ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Missing_$_inserted" humanReadableHint: """ - Check that your $s match around maths. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Sybols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list [here](https://www.sharelatex.com/learn/Errors:Missing_$_inserted). If you intended to use mathematics mode, then use $ \u2026 $ or \\begin{math} \u2026 \\end{math} or use the \u2018quick math mode\u2019: \\ensuremath{...}. + Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list [here](https://www.sharelatex.com/learn/Errors:Missing_$_inserted). """ , regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:There_were_undefined_references." humanReadableHint: """ - You have referenced something which has not yet been labeled. If you have labeled it already, make sure that what is written inside \\ref{...} is the same as what is written inside \\label{...}. + You have referenced something which has not yet been labelled. If you have labelled it already, make sure that what is written inside \\ref{...} is the same as what is written inside \\label{...}. """ , regexToMatch: /Citation .+ on page .+ undefined on input line .+/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Citation_XXX_on_page_XXX_undefined_on_input_line_XXX." humanReadableHint: """ - You have cited something which has not been included in the bibliography. Make sure that the citation (\\cite{...}) has a corresponding label in your bibliography, and that both are spelled the same way. + You have cited something which is not included in your bibliography. Make sure that the citation (\\cite{...}) has a corresponding key in your bibliography, and that both are spelled the same way. """ , regexToMatch: /(Label .+)? multiply[ -]defined( labels)?/ @@ -44,13 +44,13 @@ define -> [ regexToMatch: /`!h' float specifier changed to `!ht'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." humanReadableHint: """ - The float specifier '!h' is too strict of a demand for LaTeX to place our float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try to keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27.). + The float specifier '!h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try to keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27.). """ , regexToMatch: /`h' float specifier changed to `ht'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." humanReadableHint: """ - The float specifier 'h' is too strict of a demand for LaTeX to place our float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Positioning_of_Figures). + The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Positioning_of_Figures). """ , regexToMatch: /No positions in optional float specifier/ @@ -74,7 +74,7 @@ define -> [ regexToMatch: /LaTeX Error: Unknown graphics extension: \..+/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif." humanReadableHint: """ - The compiler does not recognise the file type of one of your images. Make sure you are using a [supported image format](https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif.) for your choice of compiler, and check that there are no full stops in the name of your image. + The compiler does not recognise the file type of one of your images. Make sure you are using a [supported image format](https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif.) for your choice of compiler, and check that there are no periods (.) in the name of your image. """ , regexToMatch: /LaTeX Error: Unknown float option `H'/ @@ -82,12 +82,6 @@ define -> [ humanReadableHint: """ The compiler isn't recognizing the float option 'H'. Include \\usepackage{float} in your preamble to fix this. """ - , - regexToMatch: /LaTeX Error: Unknown float option `P'/ - extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." - humanReadableHint: """ - You have used a float specifier which the compiler does not understand. The only extra float option provided by the 'float' package is 'H'. You can learn more about the different float options available for placing figures in our [documentation](https://www.sharelatex.com/learn/Positioning_of_Figures). - """ , regexToMatch: /LaTeX Error: Unknown float option `.+'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." @@ -98,6 +92,6 @@ define -> [ regexToMatch: /LaTeX Error: \\math.+ allowed only in math mode/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_%5Cmathrm_allowed_only_in_math_mode." humanReadableHint: """ - You have used a font which is only available in math mode. To use this font, you must write it in mathematics mode by using $ \u2026 $ or \\begin{math} \u2026 \\end{math}, or using the \u2018quick math mode\u2019: \\ensuremath{...}. + You have used a font command which is only available in math mode. To use this command, you must be in maths mode (E.g. $ \u2026 $ or \\begin{math} \u2026 \\end{math}). If you want to use it outside of math mode, use the text version instead: \\textrm, \\textit, etc. """ ] From 9b25af3c8ce839a3883024e8d342aa284adad167 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 23 Jun 2016 16:57:05 +0100 Subject: [PATCH 04/19] Consolidate rules related to too-strict float specifiers. --- .../ide/human-readable-logs/HumanReadableLogsRules.coffee | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index 3d5b20bc9a..e0b6346dab 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -41,13 +41,7 @@ define -> [ You have used the same label more than once. Check that each \\label{...} labels only one item. """ , - regexToMatch: /`!h' float specifier changed to `!ht'/ - extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." - humanReadableHint: """ - The float specifier '!h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try to keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27.). - """ - , - regexToMatch: /`h' float specifier changed to `ht'/ + regexToMatch: /`!?h' float specifier changed to `!?ht'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." humanReadableHint: """ The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Positioning_of_Figures). From 2da9cdb0dba47781d626905e1a9f70e4669eebff Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 10:15:51 +0100 Subject: [PATCH 05/19] Hints as HTML. --- .../HumanReadableLogsRules.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index e0b6346dab..9064c95575 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -8,7 +8,7 @@ define -> [ regexToMatch: /Extra alignment tab has been changed to \\cr/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Extra_alignment_tab_has_been_changed_to_%5Ccr" humanReadableHint: """ - You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your [table](https://www.sharelatex.com/learn/Tables). + You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your table. """ , regexToMatch: /Display math should end with \$\$/ @@ -20,7 +20,7 @@ define -> [ regexToMatch: /Missing [{$] inserted./ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Missing_$_inserted" humanReadableHint: """ - Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list [here](https://www.sharelatex.com/learn/Errors:Missing_$_inserted). + Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list here. """ , regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/ @@ -44,13 +44,13 @@ define -> [ regexToMatch: /`!?h' float specifier changed to `!?ht'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." humanReadableHint: """ - The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the [float package](https://www.sharelatex.com/learn/Positioning_of_Figures). + The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the float package. """ , regexToMatch: /No positions in optional float specifier/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:No_positions_in_optional_float_specifier." humanReadableHint: """ - You have forgotten to include a float specifier, which tells LaTeX where to position your figure. Find out more about float specifiers [here](https://www.sharelatex.com/learn/Positioning_of_Figures). + You have forgotten to include a float specifier, which tells LaTeX where to position your figure. Find out more about float specifiers here. """ , regexToMatch: /Undefined control sequence/ @@ -62,13 +62,13 @@ define -> [ regexToMatch: /File .+ not found/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:File_XXX_not_found_on_input_line_XXX." humanReadableHint: """ - The compiler cannot find the file you want to include. Make sure that you have [uploaded the file](https://www.sharelatex.com/learn/Including_images_in_ShareLaTeX) and [specified the file location correctly](https://www.sharelatex.com/learn/Errors:File_XXX_not_found_on_input_line_XXX.). + The compiler cannot find the file you want to include. Make sure that you have uploaded the file and specified the file location correctly. """ , regexToMatch: /LaTeX Error: Unknown graphics extension: \..+/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif." humanReadableHint: """ - The compiler does not recognise the file type of one of your images. Make sure you are using a [supported image format](https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif.) for your choice of compiler, and check that there are no periods (.) in the name of your image. + The compiler does not recognise the file type of one of your images. Make sure you are using a supported image format for your choice of compiler, and check that there are no periods (.) in the name of your image. """ , regexToMatch: /LaTeX Error: Unknown float option `H'/ @@ -80,7 +80,7 @@ define -> [ regexToMatch: /LaTeX Error: Unknown float option `.+'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." humanReadableHint: """ - You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures [here](https://www.sharelatex.com/learn/Positioning_of_Figures). + You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures here. """ , regexToMatch: /LaTeX Error: \\math.+ allowed only in math mode/ From 91cbf2b321974231821ea258d5be34803ece5006 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 11:56:31 +0100 Subject: [PATCH 06/19] Links within hint content also open in a new tab. --- .../HumanReadableLogsRules.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee index 9064c95575..b4cb138be8 100644 --- a/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee +++ b/services/web/public/coffee/ide/human-readable-logs/HumanReadableLogsRules.coffee @@ -8,7 +8,7 @@ define -> [ regexToMatch: /Extra alignment tab has been changed to \\cr/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Extra_alignment_tab_has_been_changed_to_%5Ccr" humanReadableHint: """ - You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your table. + You have written too many alignment tabs in a table, causing one of them to be turned into a line break. Make sure you have specified the correct number of columns in your table. """ , regexToMatch: /Display math should end with \$\$/ @@ -20,7 +20,7 @@ define -> [ regexToMatch: /Missing [{$] inserted./ extraInfoURL: "https://www.sharelatex.com/learn/Errors:Missing_$_inserted" humanReadableHint: """ - Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list here. + Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list here. """ , regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/ @@ -44,13 +44,13 @@ define -> [ regexToMatch: /`!?h' float specifier changed to `!?ht'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:%60!h%27_float_specifier_changed_to_%60!ht%27." humanReadableHint: """ - The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the float package. + The float specifier 'h' is too strict of a demand for LaTeX to place your float in a nice way here. Try relaxing it by using 'ht', or even 'htbp' if necessary. If you want to try keep the float here anyway, check out the float package. """ , regexToMatch: /No positions in optional float specifier/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:No_positions_in_optional_float_specifier." humanReadableHint: """ - You have forgotten to include a float specifier, which tells LaTeX where to position your figure. Find out more about float specifiers here. + You have forgotten to include a float specifier, which tells LaTeX where to position your figure. Find out more about float specifiers here. """ , regexToMatch: /Undefined control sequence/ @@ -62,13 +62,13 @@ define -> [ regexToMatch: /File .+ not found/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:File_XXX_not_found_on_input_line_XXX." humanReadableHint: """ - The compiler cannot find the file you want to include. Make sure that you have uploaded the file and specified the file location correctly. + The compiler cannot find the file you want to include. Make sure that you have uploaded the file and specified the file location correctly. """ , regexToMatch: /LaTeX Error: Unknown graphics extension: \..+/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_graphics_extension:_.gif." humanReadableHint: """ - The compiler does not recognise the file type of one of your images. Make sure you are using a supported image format for your choice of compiler, and check that there are no periods (.) in the name of your image. + The compiler does not recognise the file type of one of your images. Make sure you are using a supported image format for your choice of compiler, and check that there are no periods (.) in the name of your image. """ , regexToMatch: /LaTeX Error: Unknown float option `H'/ @@ -80,7 +80,7 @@ define -> [ regexToMatch: /LaTeX Error: Unknown float option `.+'/ extraInfoURL: "https://www.sharelatex.com/learn/Errors:LaTeX_Error:_Unknown_float_option_%60H%27." humanReadableHint: """ - You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures here. + You have used a float specifier which the compiler does not understand. You can learn more about the different float options available for placing figures here. """ , regexToMatch: /LaTeX Error: \\math.+ allowed only in math mode/ From e4a1443d1ded6e4026685ead7427b2cb35860360 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 12:07:02 +0100 Subject: [PATCH 07/19] Better handling of whitespace. --- services/web/app/views/project/editor/pdf.jade | 2 +- services/web/public/stylesheets/app/editor/pdf.less | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 34c9ece719..c2b27777f8 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -129,7 +129,7 @@ div.full-size.pdf(ng-controller="PdfController") ) #{translate("answer_no")} .card-hint-feedback(ng-show="feedbackSent") label.card-hint-feedback-label #{translate("log_hint_feedback_gratitude")} - p.entry-content(ng-show="entry.content") {{ entry.content }} + p.entry-content(ng-show="entry.content") {{ entry.content.trim() }} p .pull-right diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index f77d497eb0..93818ba2c3 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -217,6 +217,10 @@ margin-bottom: 20px; } + &-text { + min-height: 35px; + } + &-feedback-label { font-size: inherit; margin-right: 0.5em; From 5f7ffb5a8ce4fdd4ba36650cf3cc56444f9b8454 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 12:12:45 +0100 Subject: [PATCH 08/19] Make hint card area non-clickable. --- services/web/app/views/project/editor/pdf.jade | 5 ++++- services/web/public/stylesheets/app/editor/pdf.less | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index c2b27777f8..feeb01049b 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -106,7 +106,10 @@ div.full-size.pdf(ng-controller="PdfController") span(ng-show="entry.file") {{ entry.file }} span(ng-show="entry.line") , line {{ entry.line }} p.entry-message(ng-show="entry.message") {{ entry.message }} - .card.card-hint(ng-if="entry.humanReadableHint") + .card.card-hint( + ng-if="entry.humanReadableHint" + stop-propagation="click" + ) figure.card-hint-icon-container i.fa.fa-lightbulb-o(aria-hidden="true") p.card-hint-text(ng-show="entry.humanReadableHint", ng-bind-html="entry.humanReadableHint") diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index 93818ba2c3..c2ad5895be 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -181,6 +181,7 @@ .card-hint:extend(.card-thin) { margin-top: 10px; + cursor: default; &-icon-container { background: currentColor; From 9a3e621c9cdb07f41b28c423fdede08fd6c28ddc Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 13:15:22 +0100 Subject: [PATCH 09/19] stripe off errors and kb from page titles --- .../web/app/coffee/Features/Wiki/WikiController.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/web/app/coffee/Features/Wiki/WikiController.coffee b/services/web/app/coffee/Features/Wiki/WikiController.coffee index c75ee06f86..e4f85a6c9f 100644 --- a/services/web/app/coffee/Features/Wiki/WikiController.coffee +++ b/services/web/app/coffee/Features/Wiki/WikiController.coffee @@ -39,6 +39,13 @@ module.exports = WikiController = if pageData.content?.length > 280 if _.include(other_lngs, req.lng) pageData.title = pageData.title.slice(0, pageData.title.length - (req.lng.length+1) ) + + if pageData.title?.toLowerCase()?.indexOf("kb") == 0 + pageData.title = pageData.title.slice(3) + + if pageData.title?.toLowerCase()?.indexOf("errors") == 0 + pageData.title = pageData.title.slice(7) + WikiController._renderPage(pageData, contents, res) else WikiController._getPageContent page, (error, pageData) -> From d7a1c7f693de1c7eea6430c9b8a984f51143de09 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 14:01:22 +0100 Subject: [PATCH 10/19] Inline links in the hint now match the theme. --- services/web/public/stylesheets/app/editor/pdf.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index c2ad5895be..db29870c1a 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -181,6 +181,7 @@ .card-hint:extend(.card-thin) { margin-top: 10px; + padding-bottom: 7px; cursor: default; &-icon-container { @@ -235,7 +236,8 @@ font-size: 0.8rem; } - &-actions a { + &-actions a, + &-text a { .alert-danger & { color: @alert-danger-text; } From 3887db88988352de3be33ede606150c47bb073bc Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 14:06:04 +0100 Subject: [PATCH 11/19] don't call notifications if notifications has no url --- .../Notifications/NotificationsHandler.coffee | 19 +++++++++++++++---- .../NotificationsHandlerTests.coffee | 17 ++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee index a26bfff16a..6d0b6ccfbf 100644 --- a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee +++ b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee @@ -3,6 +3,13 @@ request = require("request") logger = require("logger-sharelatex") oneSecond = 1000 + +makeRequest = (opts, callback)-> + if !settings.apis.notifications.url? + return callback() + else + request(opts, callback) + module.exports = getUserNotifications: (user_id, callback)-> @@ -10,7 +17,8 @@ module.exports = uri: "#{settings.apis.notifications.url}/user/#{user_id}" json: true timeout: oneSecond - request.get opts, (err, res, unreadNotifications)-> + method: "GET" + request opts, (err, res, unreadNotifications)-> statusCode = if res? then res.statusCode else 500 if err? or statusCode != 200 e = new Error("something went wrong getting notifications, #{err}, #{statusCode}") @@ -25,28 +33,31 @@ module.exports = opts = uri: "#{settings.apis.notifications.url}/user/#{user_id}" timeout: oneSecond + method:"POST" json: { key:key messageOpts:messageOpts templateKey:templateKey } logger.log opts:opts, "creating notification for user" - request.post opts, callback + request opts, callback markAsReadWithKey: (user_id, key, callback)-> opts = uri: "#{settings.apis.notifications.url}/user/#{user_id}" + method: "DELETE" timeout: oneSecond json: { key:key } logger.log user_id:user_id, key:key, "sending mark notification as read with key to notifications api" - request.del opts, callback + request opts, callback markAsRead: (user_id, notification_id, callback)-> opts = + method: "DELETE" uri: "#{settings.apis.notifications.url}/user/#{user_id}/notification/#{notification_id}" timeout:oneSecond logger.log user_id:user_id, notification_id:notification_id, "sending mark notification as read to notifications api" - request.del opts, callback + request opts, callback diff --git a/services/web/test/UnitTests/coffee/Notifications/NotificationsHandlerTests.coffee b/services/web/test/UnitTests/coffee/Notifications/NotificationsHandlerTests.coffee index 6f10b351df..cfca6dfebe 100644 --- a/services/web/test/UnitTests/coffee/Notifications/NotificationsHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/Notifications/NotificationsHandlerTests.coffee @@ -12,10 +12,7 @@ describe 'NotificationsHandler', -> notificationUrl = "notification.sharelatex.testing" beforeEach -> - @request = - post: sinon.stub().callsArgWith(1) - del: sinon.stub().callsArgWith(1) - get: sinon.stub() + @request = sinon.stub().callsArgWith(1) @handler = SandboxedModule.require modulePath, requires: "settings-sharelatex": apis:{notifications:{url:notificationUrl}} "request":@request @@ -26,18 +23,19 @@ describe 'NotificationsHandler', -> describe "getUserNotifications", -> it 'should get unread notifications', (done)-> stubbedNotifications = [{_id: notification_id, user_id: user_id}] - @request.get.callsArgWith(1, null, {statusCode:200}, stubbedNotifications) + @request.callsArgWith(1, null, {statusCode:200}, stubbedNotifications) @handler.getUserNotifications user_id, (err, unreadNotifications)=> stubbedNotifications.should.deep.equal unreadNotifications getOpts = uri: "#{notificationUrl}/user/#{user_id}" json:true timeout:1000 - @request.get.calledWith(getOpts).should.equal true + method: "GET" + @request.calledWith(getOpts).should.equal true done() it 'should return empty arrays if there are no notifications', -> - @request.get.callsArgWith(1, null, {statusCode:200}, null) + @request.callsArgWith(1, null, {statusCode:200}, null) @handler.getUserNotifications user_id, (err, unreadNotifications)=> unreadNotifications.length.should.equal 0 @@ -52,7 +50,8 @@ describe 'NotificationsHandler', -> json: key:@key timeout:1000 - @request.del.calledWith(opts).should.equal true + method: "DELETE" + @request.calledWith(opts).should.equal true done() @@ -64,7 +63,7 @@ describe 'NotificationsHandler', -> it "should post the message over", (done)-> @handler.createNotification user_id, @key, @templateKey, @messageOpts, => - args = @request.post.args[0][0] + args = @request.args[0][0] args.uri.should.equal "#{notificationUrl}/user/#{user_id}" args.timeout.should.equal 1000 expectedJson = {key:@key, templateKey:@templateKey, messageOpts:@messageOpts} From cc9f90c3e8ec875487f8c067ec79383c1ec02a05 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 15:03:15 +0100 Subject: [PATCH 12/19] don't set referneces and notifications urls in default as open source does not use them yet --- services/web/config/settings.defaults.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index ce95780075..b784088f4b 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -104,10 +104,10 @@ module.exports = settings = url: "http://localhost:3036" sixpack: url: "" - references: - url: "http://localhost:3040" - notifications: - url: "http://localhost:3042" + # references: + # url: "http://localhost:3040" + # notifications: + # url: "http://localhost:3042" templates: user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2" From 8d79b37651c9e590fc7b4654751d782b91a1082d Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 15:04:10 +0100 Subject: [PATCH 13/19] return from _doIndexOperation if referneces is not setup eailer --- .../app/coffee/Features/References/ReferencesHandler.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/Features/References/ReferencesHandler.coffee b/services/web/app/coffee/Features/References/ReferencesHandler.coffee index 72b2216e69..fa38ddedf6 100644 --- a/services/web/app/coffee/Features/References/ReferencesHandler.coffee +++ b/services/web/app/coffee/Features/References/ReferencesHandler.coffee @@ -66,6 +66,8 @@ module.exports = ReferencesHandler = ReferencesHandler._doIndexOperation(projectId, project, docIds, [], callback) _doIndexOperation: (projectId, project, docIds, fileIds, callback) -> + if !settings.apis?.references?.url? + return callback() ReferencesHandler._isFullIndex project, (err, isFullIndex) -> if err logger.err {err, projectId}, "error checking whether to do full index" @@ -84,8 +86,6 @@ module.exports = ReferencesHandler = ReferencesHandler._buildFileUrl projectId, fileId allUrls = bibDocUrls.concat(bibFileUrls) logger.log {projectId, isFullIndex, docIds, bibDocUrls}, "sending request to references service" - if !settings.apis.references.url? - return callback() request.post { url: "#{settings.apis.references.url}/project/#{projectId}/index" json: From 51df3825e53598a4c43ba82afee3ee8e96f307e8 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 15:11:22 +0100 Subject: [PATCH 14/19] add null check on notifications handler --- .../coffee/Features/Notifications/NotificationsHandler.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee index 6d0b6ccfbf..f14139e107 100644 --- a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee +++ b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee @@ -5,7 +5,7 @@ logger = require("logger-sharelatex") oneSecond = 1000 makeRequest = (opts, callback)-> - if !settings.apis.notifications.url? + if !settings.apis.notifications?.url? return callback() else request(opts, callback) From c376c807d72f9b60353e204b81117a7b92b974b8 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Jun 2016 15:22:34 +0100 Subject: [PATCH 15/19] Forgotten href attribute. --- services/web/app/views/project/editor/pdf.jade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index feeb01049b..75ff03020d 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -125,10 +125,12 @@ div.full-size.pdf(ng-controller="PdfController") label.card-hint-feedback-label #{translate("log_hint_feedback_label")} a.card-hint-feedback-positive( ng-click="feedbackSent = true;" + href ) #{translate("answer_yes")} span  /  a.card-hint-feedback-negative( ng-click="feedbackSent = true;" + href ) #{translate("answer_no")} .card-hint-feedback(ng-show="feedbackSent") label.card-hint-feedback-label #{translate("log_hint_feedback_gratitude")} From 6e59a10fb33cf85dface1eb20490b4c794f7165b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 15:23:57 +0100 Subject: [PATCH 16/19] added more null checks for potential undefined notifications --- .../Features/Notifications/NotificationsHandler.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee index f14139e107..d3e2cb3cb9 100644 --- a/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee +++ b/services/web/app/coffee/Features/Notifications/NotificationsHandler.coffee @@ -14,7 +14,7 @@ module.exports = getUserNotifications: (user_id, callback)-> opts = - uri: "#{settings.apis.notifications.url}/user/#{user_id}" + uri: "#{settings.apis.notifications?.url}/user/#{user_id}" json: true timeout: oneSecond method: "GET" @@ -31,7 +31,7 @@ module.exports = createNotification: (user_id, key, templateKey, messageOpts, callback)-> opts = - uri: "#{settings.apis.notifications.url}/user/#{user_id}" + uri: "#{settings.apis.notifications?.url}/user/#{user_id}" timeout: oneSecond method:"POST" json: { @@ -44,7 +44,7 @@ module.exports = markAsReadWithKey: (user_id, key, callback)-> opts = - uri: "#{settings.apis.notifications.url}/user/#{user_id}" + uri: "#{settings.apis.notifications?.url}/user/#{user_id}" method: "DELETE" timeout: oneSecond json: { @@ -57,7 +57,7 @@ module.exports = markAsRead: (user_id, notification_id, callback)-> opts = method: "DELETE" - uri: "#{settings.apis.notifications.url}/user/#{user_id}/notification/#{notification_id}" + uri: "#{settings.apis.notifications?.url}/user/#{user_id}/notification/#{notification_id}" timeout:oneSecond logger.log user_id:user_id, notification_id:notification_id, "sending mark notification as read to notifications api" request opts, callback From 9888d6631a10ffad5f8a2fc6c6b77040387d5567 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 15:46:37 +0100 Subject: [PATCH 17/19] don't error if references is not enabled --- .../References/ReferencesController.coffee | 8 +++--- .../ReferencesControllerTests.coffee | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/References/ReferencesController.coffee b/services/web/app/coffee/Features/References/ReferencesController.coffee index 0536e3b680..5976af9430 100644 --- a/services/web/app/coffee/Features/References/ReferencesController.coffee +++ b/services/web/app/coffee/Features/References/ReferencesController.coffee @@ -15,7 +15,7 @@ module.exports = ReferencesController = return res.sendStatus 400 logger.log {projectId, docIds: docIds}, "index references for project" ReferencesHandler.index projectId, docIds, (err, data) -> - if err + if err? logger.err {err, projectId}, "error indexing all references" return res.sendStatus 500 ReferencesController._handleIndexResponse(req, res, projectId, shouldBroadcast, data) @@ -25,13 +25,15 @@ module.exports = ReferencesController = shouldBroadcast = req.body.shouldBroadcast logger.log {projectId}, "index all references for project" ReferencesHandler.indexAll projectId, (err, data) -> - if err + if err? logger.err {err, projectId}, "error indexing all references" return res.sendStatus 500 ReferencesController._handleIndexResponse(req, res, projectId, shouldBroadcast, data) _handleIndexResponse: (req, res, projectId, shouldBroadcast, data) -> - if shouldBroadcast + if !data? or !data.keys? + return res.send() + else if shouldBroadcast logger.log {projectId}, "emitting new references keys to connected clients" EditorRealTimeController.emitToRoom projectId, 'references:keys:updated', data.keys return res.json data diff --git a/services/web/test/UnitTests/coffee/References/ReferencesControllerTests.coffee b/services/web/test/UnitTests/coffee/References/ReferencesControllerTests.coffee index 16266c0820..0d58da7631 100644 --- a/services/web/test/UnitTests/coffee/References/ReferencesControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/References/ReferencesControllerTests.coffee @@ -32,6 +32,7 @@ describe "ReferencesController", -> shouldBroadcast: false @res = new MockResponse() @res.json = sinon.stub() + @res.send = sinon.stub() @res.sendStatus = sinon.stub() @fakeResponseData = projectId: @projectId, @@ -113,6 +114,30 @@ describe "ReferencesController", -> @res.json.calledWith(@fakeResponseData).should.equal true done() + describe 'there is no dataaaaaaa', -> + + beforeEach -> + @ReferencesHandler.indexAll.callsArgWith(1) + @call = (callback) => + @controller.indexAll @req, @res + callback() + + it 'should not call EditorRealTimeController.emitToRoom', (done) -> + @call () => + @EditorRealTimeController.emitToRoom.callCount.should.equal 0 + done() + + it 'should not produce an error', (done) -> + @call () => + @res.sendStatus.callCount.should.equal 0 + @res.sendStatus.calledWith(500).should.equal false + @res.sendStatus.calledWith(400).should.equal false + done() + + it 'should close the response', (done) -> + @call () => + @res.send.called.should.equal true + done() describe 'index', -> From 6526b29f9684892a6d0fda68140164c2b7fd7266 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Sat, 25 Jun 2016 13:56:45 +0100 Subject: [PATCH 18/19] add another null check on file inside fetchLogs --- .../web/public/coffee/ide/pdf/controllers/PdfController.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index f503437407..52b243c79b 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -156,7 +156,7 @@ define [ method:"GET" params: clsiserverid:ide.clsiServerId - if file.url? # FIXME clean this up when we have file.urls out consistently + if file?.url? # FIXME clean this up when we have file.urls out consistently opts.url = file.url else if file?.build? opts.url = "/project/#{$scope.project_id}/build/#{file.build}/output/#{name}" From 8b15d40f8b969b5dc59fac4e64a9f0d317bcbdca Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 27 Jun 2016 12:41:50 +0100 Subject: [PATCH 19/19] add word count to per-user container --- .../ide/wordcount/controllers/WordCountModalController.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee b/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee index e880a25eef..2336de614d 100644 --- a/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee +++ b/services/web/public/coffee/ide/wordcount/controllers/WordCountModalController.coffee @@ -4,12 +4,14 @@ define [ App.controller 'WordCountModalController', ($scope, $modalInstance, ide, $http) -> $scope.status = loading:true - + + perUserCompile = window.location?.search?.match(/isolated=true/)? or undefined opts = url:"/project/#{ide.project_id}/wordcount" method:"GET" params: clsiserverid:ide.clsiServerId + isolated: perUserCompile $http opts .success (data) -> $scope.status.loading = false