Remove redundant checks that messages were sent by user.

When a user sends a message, it should be considered to be "read"
by that same user, but all that logic is handled on the back end
now, so we can remove some of the front end code related to
saying that a message is unread.

(imported from commit e4263f86c666882db42d7ae3d399196803d700cd)
This commit is contained in:
Steve Howell
2013-06-14 10:46:37 -04:00
parent 3fd7c44331
commit acc338da0e
2 changed files with 17 additions and 32 deletions

View File

@@ -206,9 +206,6 @@ exports.received_messages = function (messages) {
var i;
$.each(messages, function (index, message) {
if (message.sender_email !== page_params.email &&
narrow.message_in_home(message)) {
// We send notifications for messages which the user has
// configured as notifiable, as long as they haven't been
// marked as read by process_visible_unread_messages
@@ -228,7 +225,6 @@ exports.received_messages = function (messages) {
$("#notifications-area").find("audio")[0].play();
}
}
}
});
};

View File

@@ -35,20 +35,9 @@ function unread_hashkey(message) {
}
exports.message_unread = function (message) {
// This is the only halfway interesting function in this module.
// Everything else is just slinging hashes around.
if (message === undefined) {
return false;
}
var sent_by_human = ['website', 'iphone', 'android']
.indexOf(message.client.toLowerCase()) !== -1;
if (message.sender_email === page_params.email && sent_by_human) {
return false;
}
return message.flags === undefined ||
message.flags.indexOf('read') === -1;
};