mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
fix: always return empty array if its not set
This commit is contained in:
@@ -53,9 +53,9 @@ module.exports = function (Messaging) {
|
||||
data.groupChat = parseInt(data.groupChat, 10) === 1;
|
||||
}
|
||||
|
||||
if (data.hasOwnProperty('groups')) {
|
||||
if (data.hasOwnProperty('groups') || !fields.length || fields.includes('groups')) {
|
||||
try {
|
||||
data.groups = JSON.parse(data.groups);
|
||||
data.groups = JSON.parse(data.groups || '[]');
|
||||
} catch (err) {
|
||||
winston.error(err.stack);
|
||||
data.groups = [];
|
||||
|
||||
Reference in New Issue
Block a user