Fixed variable naming conflict with msg and added cosmetic refactors

Этот коммит содержится в:
nickago
2015-08-03 12:39:27 -07:00
родитель dfcaabe222
Коммит 3db7d315f9

Просмотреть файл

@@ -183,10 +183,10 @@ module.exports = React.createClass({
var notifyText = post.message.replace(repRegex, '\n').replace(/\n+/g, ' ').replace('<mention>', '').replace('</mention>', ''); var notifyText = post.message.replace(repRegex, '\n').replace(/\n+/g, ' ').replace('<mention>', '').replace('</mention>', '');
if (notifyText.length > 50) { if (notifyText.length > 50) {
notifyText = msg.substring(0,49) + '...'; notifyText = notifyText.substring(0, 49) + '...';
} }
if (msg.length === 0) { if (notifyText.length === 0) {
if (msgProps.image) { if (msgProps.image) {
utils.notifyMe(title, username + ' uploaded an image', channel); utils.notifyMe(title, username + ' uploaded an image', channel);
} else if (msgProps.otherFile) { } else if (msgProps.otherFile) {
@@ -195,17 +195,17 @@ module.exports = React.createClass({
utils.notifyMe(title, username + ' did something new', channel); utils.notifyMe(title, username + ' did something new', channel);
} }
} else { } else {
utils.notifyMe(title, username + ' wrote: ' + msg, channel); utils.notifyMe(title, username + ' wrote: ' + notifyText, channel);
} }
if (!user.notify_props || user.notify_props.desktop_sound === 'true') { if (!user.notify_props || user.notify_props.desktop_sound === 'true') {
utils.ding(); utils.ding();
} }
} }
} else if (msg.action == 'viewed') { } else if (msg.action === 'viewed') {
if (ChannelStore.getCurrentId() != msg.channel_id) { if (ChannelStore.getCurrentId() != msg.channel_id) {
AsyncClient.getChannels(true); AsyncClient.getChannels(true);
} }
} else if (msg.action == 'user_added') { } else if (msg.action === 'user_added') {
if (UserStore.getCurrentId() === msg.user_id) { if (UserStore.getCurrentId() === msg.user_id) {
AsyncClient.getChannels(true); AsyncClient.getChannels(true);
} }
@@ -231,7 +231,7 @@ module.exports = React.createClass({
var teammate_username = utils.getDirectTeammate(channel.id).username; var teammate_username = utils.getDirectTeammate(channel.id).username;
document.title = teammate_username + ' ' + document.title.substring(document.title.lastIndexOf('-')); document.title = teammate_username + ' ' + document.title.substring(document.title.lastIndexOf('-'));
} else { } else {
document.title = channel.display_name + ' ' + document.title.substring(document.title.lastIndexOf('-')) document.title = channel.display_name + ' ' + document.title.substring(document.title.lastIndexOf('-'));
} }
} }
}, },