Make |unlink|hide| always roomhide

|unlink|hide| used to hide all text from the user everywhere, not
just in the room. While a good idea in spirit, in practice it
was inconsistent in terms of what it hid, because not all users
are in the same room, etc etc. It also made for very confusing
behavior when text would disappear without a message, when a user
was locked in a different room.

This also fixes bugs caused by this behavior.
This commit is contained in:
Guangcong Luo
2016-06-12 20:23:30 -04:00
parent e6e47c6c88
commit bfef3b3d31

View File

@@ -1224,10 +1224,11 @@
if (!$messages.length) break;
$messages.find('a').contents().unwrap();
if (row[2]) {
if (row[1] === 'roomhide') {
$messages = this.$chat.find('.chatmessage-' + user);
if (!$messages.length) break;
}
// there used to be a condition for
// row[1] === 'roomhide'
// but it's now always applied
$messages = this.$chat.find('.chatmessage-' + user);
if (!$messages.length) break;
$messages.hide().addClass('revealed').find('button').parent().remove();
this.$chat.children().last().append(' <button name="toggleMessages" value="' + user + '" class="subtle"><small>(' + $messages.length + ' line' + ($messages.length > 1 ? 's' : '') + ' from ' + user + ' hidden)</small></button>');
}
@@ -1251,7 +1252,7 @@
}
},
toggleMessages: function (user, button) {
var $messages = $('.chatmessage-' + user + '.revealed');
var $messages = this.$('.chatmessage-' + user + '.revealed');
var $button = $(button);
if (!$messages.is(':hidden')) {
$messages.hide();