From 9f8526ce29d2d8d3e48eb8952eeb32f4aaa015e4 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 9 Feb 2018 15:13:38 -0500 Subject: [PATCH] Add pm_conversations.recent.get_strings(). We will use this method for hotkey navigation through recent pms. --- frontend_tests/node_tests/pm_conversations.js | 2 ++ static/js/pm_conversations.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.js index 8e1b64ac04..ed1e9294d2 100644 --- a/frontend_tests/node_tests/pm_conversations.js +++ b/frontend_tests/node_tests/pm_conversations.js @@ -25,5 +25,7 @@ var pmc = zrequire('pm_conversations'); {user_ids_string: '1', timestamp: 3001}, {user_ids_string: '2', timestamp: 2001}, ]); + + assert.deepEqual(pmc.recent.get_strings(), ['1', '2']); }()); diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.js index 5f02863c44..24f81cc083 100644 --- a/static/js/pm_conversations.js +++ b/static/js/pm_conversations.js @@ -51,6 +51,12 @@ exports.recent = (function () { return recent_private_messages; }; + self.get_strings = function () { + // returns array of structs with user_ids_string and + // timestamp + return _.pluck(recent_private_messages, 'user_ids_string'); + }; + return self; }());