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

[FIX] email message forward fix #7245

Closed
wants to merge 4 commits into from
Closed

[FIX] email message forward fix #7245

wants to merge 4 commits into from

Conversation

localguru
Copy link
Contributor

@localguru localguru commented Jun 13, 2017

[FIX] email message forward

@RocketChat/core

Closes #6179 #5797

PR fixes email message forwarding if locale in profile is not "en"

@localguru localguru changed the title email message forward fix [FIX] email message forward fix Jun 13, 2017
@@ -55,7 +55,7 @@ Meteor.methods({
if (data.language !== 'en') {
const localeFn = Meteor.call('loadLocale', data.language);
if (localeFn) {
Function(localeFn)();
Function(moment.localeFn)();
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like this isn't really solving the problem. The code originally was getting the locale storing it in localeFn and trying to call localeFn as a function. Makes sense why that might not work.

But... with this change you're simply calling a function called localeFn on moment. I don't believe this is actually a valid function.

Copy link
Contributor Author

@localguru localguru Jun 22, 2017

Choose a reason for hiding this comment

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

Hi, honestly I'm a little clueless with this problem. localeFn contains the content of private/moment-locales/de.js in case of "de" set in user's profile. What does Function(localeFn)(); do then? For testing I removed the complete code between if (data.language !== 'en') { and without it, it's still running with the correct locale set to "de". So what is Function(localeFn)();necessary for then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look here:

Function(localeFn).call({moment});
I'm not sure why these two approaches differ

Copy link
Contributor Author

@localguru localguru Jun 22, 2017

Choose a reason for hiding this comment

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

Aaron,

thanks for your time. I took the code from startup, which works without errors. But it makes no difference, if I remove the complete code lines, which handle the locale stuff. Both is working fine. So what's the code for?

                //data.language = data.language.split('-').shift().toLowerCase();
                //if (data.language !== 'en') {
                //      Meteor.call('loadLocale', data.language, (err, localeFn) => {
                //              Function(localeFn).call({moment});
                //              moment.locale(data.language);
                //      });
                //}

Ciao
Marcus

Copy link
Contributor

Choose a reason for hiding this comment

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

@ggazzo any ideas on this? I know this file was converted from coffeescript to js. So I can't see who wrote the line before or what it used to look like here 😁

Copy link
Contributor Author

@localguru localguru Jun 24, 2017

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with the upcoming 0.57.2 I'd like to cherry pick this PR. @ggazzo could you give some feedback please. Thanks, Marcus

@geekgonecrazy geekgonecrazy changed the base branch from master to develop June 20, 2017 22:22
@@ -1,1548 +0,0 @@
{
Copy link
Contributor

@geekgonecrazy geekgonecrazy Jun 20, 2017

Choose a reason for hiding this comment

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

Also please restore this file

Copy link
Contributor

Choose a reason for hiding this comment

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

@localguru you'll for sure have to restore this file to resolve the conflicts.

@engelgabriel
Copy link
Member

�[34mI20170823-03:22:18.285(0) Exception while invoking method 'mailMessages' TypeError: Cannot read property 'defineLocale' of undefined   at eval (<anonymous>:14:20)   at eval (<anonymous>:10:4)   at eval (<anonymous>:11:2)   at [object Object].Meteor.methods.mailMessages (/app/bundle/programs/server/packages/rocketchat_channel-settings-mail-messages.js:124:23)   at [object Object].methodsMap.(anonymous function) (/app/bundle/programs/server/packages/rocketchat_lib.js:1110:26)   at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)   at maybeAuditArgumentChecks (/app/bundle/programs/server/packages/ddp-server.js:1858:12)   at /app/bundle/programs/server/packages/ddp-server.js:904:20   at [object Object]._.extend.withValue (packages/meteor.js:1126:17)   at /app/bundle/programs/server/packages/ddp-server.js:903:47   at [object Object]._.extend.withValue (packages/meteor.js:1126:17)   at /app/bundle/programs/server/packages/ddp-server.js:902:46   at [object Object]._.extend.protocol_handlers.method (/app/bundle/programs/server/packages/ddp-server.js:875:21)   at /app/bundle/programs/server/packages/ddp-server.js:754:85  

@localguru
Copy link
Contributor Author

Please reopen, #7846 doesn't fix it!

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

Successfully merging this pull request may close these issues.

E-Mail message forward throws exception
4 participants