Skip to content

When user doesn't have any preferences, users.getPreferences fails with "Cannot set property 'language' of undefined" #12976

@panta82

Description

@panta82

Description:

When user doesn't have preferences, the REST API call https://rocket.chat/docs/developer-guides/rest-api/users/get-preferences/ fails with {"success":false,"error":"Cannot set property 'language' of undefined"}.

The problem is in this line:

preferences.language = user.language;

There needs to be a guard there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions