rows.js: Add get_message_id() helper.

This commit is contained in:
Steve Howell 2017-07-19 07:53:30 -04:00 committed by Tim Abbott
parent c256b1663e
commit 9a239f682d
1 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,15 @@ exports.get_table = function (table_name) {
return $('#' + table_name); return $('#' + table_name);
}; };
exports.get_message_id = function (elem) {
// Gets the message_id for elem, where elem is a DOM
// element inside a message. This is typically used
// in click handlers for things like the reaction button.
var row = $(elem).closest(".message_row");
var message_id = exports.id(row);
return message_id;
};
exports.get_closest_group = function (element) { exports.get_closest_group = function (element) {
// This gets the closest message row to an element, whether it's // This gets the closest message row to an element, whether it's
// a recipient bar or message. With our current markup, // a recipient bar or message. With our current markup,