[FIX] Method calls not sending date params as EJSON (#3159)

This commit is contained in:
Diego Mello 2021-05-26 16:32:30 -03:00 committed by GitHub
parent 3ef4ef5317
commit 6d3bcfbd67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -945,7 +945,13 @@ const RocketChat = {
if (API_Use_REST_For_DDP_Calls) { if (API_Use_REST_For_DDP_Calls) {
return this.post(`method.call/${ method }`, { message: EJSON.stringify({ method, params }) }); return this.post(`method.call/${ method }`, { message: EJSON.stringify({ method, params }) });
} }
return this.methodCall(method, ...params); const parsedParams = params.map((param) => {
if (param instanceof Date) {
return { $date: new Date(param).getTime() };
}
return param;
});
return this.methodCall(method, ...parsedParams);
}, },
getUserRoles() { getUserRoles() {