js: Read zid with rows.id.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-11 22:31:25 -08:00 committed by Tim Abbott
parent 8892f463a8
commit 2834b051d2
4 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,4 @@
zrequire('rows');
zrequire('lightbox');
set_global('blueslip', global.make_zblueslip());

View File

@ -134,10 +134,10 @@ exports.open = function (image, options) {
sender_full_name = people.my_full_name();
} else {
const $message = $parent.closest("[zid]");
const zid = parseInt($message.attr("zid"), 10);
const zid = rows.id($message);
const message = message_store.get(zid);
if (message === undefined) {
blueslip.error("Lightbox for unknown message " + $message.attr("zid"));
blueslip.error("Lightbox for unknown message " + rows.id($message));
} else {
sender_full_name = message.sender_full_name;
}

View File

@ -500,7 +500,7 @@ MessageListView.prototype = {
_put_row: function (row) {
// row is a jQuery object wrapping one message row
if (row.hasClass('message_row')) {
this._rows[row.attr('zid')] = row;
this._rows[rows.id(row)] = row;
}
},

View File

@ -16,8 +16,8 @@ function message_unhover() {
}
function message_hover(message_row) {
const id = parseInt(message_row.attr("zid"), 10);
if (current_message_hover && message_row && current_message_hover.attr("zid") === message_row.attr("zid")) {
const id = rows.id(message_row);
if (current_message_hover && rows.id(current_message_hover) === id) {
return;
}
// Don't allow on-hover editing for local-only messages