From dd1a6a97bdac0fc70422c74a82c4cbd268be6eff Mon Sep 17 00:00:00 2001 From: YashRE42 <33805964+YashRE42@users.noreply.github.com> Date: Sun, 23 Jun 2019 23:24:30 +0530 Subject: [PATCH] group-pms: Update list when new group pm is made. The function activity.process_loaded_messages(messages) would be called from message_events.js, this would call people.huddle_string with the same message object, it was expected that this would return a list of ids but the message.display_recipient attribute which was being sent here used a "user_id" field instead of an "id" field. Fixes: #12503. --- static/js/echo.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/static/js/echo.js b/static/js/echo.js index 378cff0043..269aca0cd9 100644 --- a/static/js/echo.js +++ b/static/js/echo.js @@ -83,11 +83,24 @@ function insert_local_message(message_request, local_id) { var person = people.get_by_email(email); if (person === undefined) { // For unknown users, we return a skeleton object. - return {email: email, full_name: email, - unknown_local_echo_user: true}; + return { + email: email, + full_name: email, + unknown_local_echo_user: true, + }; } + // NORMAL PATH - return person; + // + // This should match the format of display_recipient + // objects generated by the backend code in models.py, + // which is why we create a new object with a `.id` field + // rather than a `.user_id` field. + return { + id: person.user_id, + email: person.email, + full_name: person.full_name, + }; }); }