mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
Remove direct use of x.attr('zid')
See https://wiki.humbughq.com/Code%20style#x.attrzid-vs.rows.idx for why this is bad. (imported from commit b341146704af3bb1b477b12d226096ab72b5e269)
This commit is contained in:
@@ -56,7 +56,7 @@ $(document).bind('copy', function (e) {
|
||||
// To ensure we can't enter an infinite loop, bail out (and let the
|
||||
// browser handle the copy-paste on its own) if we don't hit what we
|
||||
// are looking for within 10 rows.
|
||||
for (j = 0; start_tr.attr('zid') === undefined && j < 10; j++) {
|
||||
for (j = 0; (!start_tr.is('.message_row')) && j < 10; j++) {
|
||||
start_tr = start_tr.next();
|
||||
}
|
||||
if (j === 10) {
|
||||
@@ -67,7 +67,7 @@ $(document).bind('copy', function (e) {
|
||||
// (In fact, we need to because it won't work correctly in this case)
|
||||
skip_same_td_check = true;
|
||||
}
|
||||
startid = start_tr.attr('zid');
|
||||
startid = rows.id(start_tr);
|
||||
|
||||
endc = $(range.endContainer);
|
||||
// If the selection ends in the bottom whitespace, we should act as
|
||||
@@ -91,7 +91,7 @@ $(document).bind('copy', function (e) {
|
||||
// To ensure we can't enter an infinite loop, bail out (and let the
|
||||
// browser handle the copy-paste on its own) if we don't hit what we
|
||||
// are looking for within 10 rows.
|
||||
for (j = 0; end_tr.attr('zid') === undefined && j < 10; j++) {
|
||||
for (j = 0; (!end_tr.is('.message_row')) && j < 10; j++) {
|
||||
end_tr = end_tr.prev();
|
||||
}
|
||||
if (j === 10) {
|
||||
@@ -102,7 +102,7 @@ $(document).bind('copy', function (e) {
|
||||
// (In fact, we need to because it won't work correctly in this case)
|
||||
skip_same_td_check = true;
|
||||
}
|
||||
endid = end_tr.attr('zid');
|
||||
endid = rows.id(end_tr);
|
||||
|
||||
// If the selection starts and ends in the same td,
|
||||
// we should let the browser handle the copy-paste entirely on its own
|
||||
@@ -124,7 +124,7 @@ $(document).bind('copy', function (e) {
|
||||
p.html(p.html() + "<b>" + content.text() + "</b>" + "<br>");
|
||||
}
|
||||
|
||||
message = message_dict[row.attr('zid')];
|
||||
message = message_dict[rows.id(row)];
|
||||
|
||||
content = $('<div>').text(message.sender_full_name + ": " +
|
||||
$('<div/>').html(message.content).text()
|
||||
@@ -289,7 +289,7 @@ function replace_floating_recipient_bar(desired_label) {
|
||||
new_label.find("td:last").replaceWith(header.clone());
|
||||
other_label.css('display', 'none');
|
||||
new_label.css('display', 'table-row');
|
||||
new_label.attr("zid", desired_label.attr("zid"));
|
||||
new_label.attr("zid", rows.id(desired_label));
|
||||
|
||||
old_label = desired_label;
|
||||
}
|
||||
@@ -772,7 +772,7 @@ $(function () {
|
||||
if (!(clicking && mouse_moved)) {
|
||||
// Was a click (not a click-and-drag).
|
||||
var row = $(this).closest(".message_row");
|
||||
select_message_by_id(row.attr('zid'));
|
||||
select_message_by_id(rows.id(row));
|
||||
respond_to_message();
|
||||
}
|
||||
mouse_moved = false;
|
||||
@@ -815,19 +815,19 @@ $(function () {
|
||||
// last popover. That is, we want it to be the case that
|
||||
// a user can dismiss a popover by clicking on the same
|
||||
// element that caused the popover
|
||||
show_userinfo_popover(this, row.attr('zid'));
|
||||
show_userinfo_popover(this, rows.id(row));
|
||||
}
|
||||
});
|
||||
|
||||
$("#home").on("click", ".narrows_by_recipient", function (e) {
|
||||
var row = $(this).closest(".recipient_row");
|
||||
narrow.target(row.attr('zid'));
|
||||
narrow.target(rows.id(row));
|
||||
narrow.by_recipient();
|
||||
});
|
||||
|
||||
$("#home").on("click", ".narrows_by_subject", function (e) {
|
||||
var row = $(this).closest(".recipient_row");
|
||||
narrow.target(row.attr('zid'));
|
||||
narrow.target(rows.id(row));
|
||||
narrow.by_subject();
|
||||
});
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ function add_to_table(messages, table_name, filter_function, where, allow_collap
|
||||
if (! row.hasClass('message_row')) {
|
||||
return;
|
||||
}
|
||||
var id = row.attr('zid');
|
||||
var id = rows.id(row);
|
||||
if (ids_where_next_is_same_sender[id]) {
|
||||
row.find('.messagebox').addClass("next_is_same_sender");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user