-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
make ChangePasswordController and UI Code respect Message and Hint fr… #1787
Conversation
@blizzz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @MorrisJobke, @rullzer and @michag86 to be potential reviewers. |
4bd006f
to
948d3d2
Compare
if(!_.isEmpty(result.data.hint)) { | ||
message += "<br/>" + _.escape(result.data.hint); | ||
} | ||
OC.Notification.showTemporary(t('admin', message), {isHTML: true}); |
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.
Just mentioning, when the strings are not used in any other t
method, they will not be translated.
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.
Maybe it's better to use t
in line 667 and 669?
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.
@michag86 this does not help. To make sure that a string is translated, it must be provided as plain text to the method. That way it can be parsed and fed into the translation tool.
Basically I did not change the behavior much. If translation worked before, it is pure luck. This should happen on the server side code where the string is passed (if applicable). Best thing to do here is actually remove the transaltion of received strings.
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.
Removed the translation call.
Current coverage is 57.07% (diff: 60.00%)@@ master #1787 diff @@
==========================================
Files 1191 1191
Lines 71912 71909 -3
Methods 7299 7300 +1
Messages 0 0
Branches 1213 1213
==========================================
+ Hits 41036 41045 +9
+ Misses 30876 30864 -12
Partials 0 0
|
@@ -231,6 +231,9 @@ $(document).ready(function () { | |||
$('#pass2').val('').change(); | |||
} else { | |||
if (typeof(data.data) !== "undefined") { | |||
if(!_.isEmpty(data.data.hint)) { | |||
data.data.message += "\n" + data.data.hint; |
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.
In normal cases hint is the translated version of message. That is at least the case for all HintExceptions I have seen so far.
@MorrisJobke thx. Wow. After acking through the HintException usages it seems that half of the time the However since it is vastly used in this manner i am hesitating to change this all, and this would include other repos… If this is expected to land into logExpection translated stuff does not make sense again either. Perhaps the best way is to extend (or add another Exception inheriting from it for backwards compatibility) for another parameter, translated message or so 🙈 🙉 🙊 This amazingly extend the PR, resulting in more work than I anticipated. Perhaps I postpone it for a little bit later and we need to go with a workaround solution in #1715 first. |
@blizzz The hint is the reason that could be shown to the user and is therefore translated. The hint never lands in the logs. The message of an hint exception is untranslated and will never get to the user because it could contain sensitive data. So the usage of the HintException holding the translated string is correct. |
@MorrisJobke then we ought to rename the parameter and add some doc. This is confusing and misleading. |
So what are we going to do here? @blizzz @MorrisJobke ? |
At least resolve the conflicts :( |
…om HintException Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* stings should be translated (if applicable) where they happen * ChangePasswordController returns all its fixed strings already translated * local user backend does not throw HintException at all Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
b97fdcb
to
376d34b
Compare
I fixed the conflicts and rebased on master ;) |
That's kind, but apart from PHP Doc adjustments there is nothing else to do (cf. #1787 (comment)) I come up with a new PR instead. |
…om HintException
Needed for #1715
Please review @GitHubUser4234 @nickvergessen @ChristophWurst