Этот коммит содержится в:
megos
2017-06-28 21:37:51 +09:00
коммит произвёл George Goldberg
родитель c66799a839
Коммит 58b3231916
2 изменённых файлов: 18 добавлений и 1 удалений

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

@@ -73,7 +73,21 @@ export function sendDesktopNotification(post, msgProps) {
} }
} }
let notifyText = post.message.replace(/\n+/g, ' '); let notifyText = post.message;
const msgPropsPost = JSON.parse(msgProps.post);
const attachments = msgPropsPost && msgPropsPost.props && msgPropsPost.props.attachments ? msgPropsPost.props.attachments : [];
let image = false;
attachments.forEach((attachment) => {
if (notifyText.length === 0) {
notifyText = attachment.fallback ||
attachment.pretext ||
attachment.text;
}
image |= attachment.image_url.length > 0;
});
notifyText.replace(/\n+/g, ' ');
if (notifyText.length > 50) { if (notifyText.length > 50) {
notifyText = notifyText.substring(0, 49) + '...'; notifyText = notifyText.substring(0, 49) + '...';
} }
@@ -84,6 +98,8 @@ export function sendDesktopNotification(post, msgProps) {
body = username + Utils.localizeMessage('channel_loader.uploadedImage', ' uploaded an image'); body = username + Utils.localizeMessage('channel_loader.uploadedImage', ' uploaded an image');
} else if (msgProps.otherFile) { } else if (msgProps.otherFile) {
body = username + Utils.localizeMessage('channel_loader.uploadedFile', ' uploaded a file'); body = username + Utils.localizeMessage('channel_loader.uploadedFile', ' uploaded a file');
} else if (image) {
body = username + Utils.localizeMessage('channel_loader.postedImage', ' posted an image');
} else { } else {
body = username + Utils.localizeMessage('channel_loader.something', ' did something new'); body = username + Utils.localizeMessage('channel_loader.something', ' did something new');
} }

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

@@ -1127,6 +1127,7 @@
"channel_loader.unknown_error": "We received an unexpected status code from the server.", "channel_loader.unknown_error": "We received an unexpected status code from the server.",
"channel_loader.uploadedFile": " uploaded a file", "channel_loader.uploadedFile": " uploaded a file",
"channel_loader.uploadedImage": " uploaded an image", "channel_loader.uploadedImage": " uploaded an image",
"channel_loader.postedImage": " posted an image",
"channel_loader.wrote": " wrote: ", "channel_loader.wrote": " wrote: ",
"channel_members_dropdown.channel_admin": "Channel Admin", "channel_members_dropdown.channel_admin": "Channel Admin",
"channel_members_dropdown.channel_member": "Channel Member", "channel_members_dropdown.channel_member": "Channel Member",