PLT-2074 Refactor desktop notification settings UI and add setting for duration (#3883)

* Refactor desktop notification settings UI and add setting for duration

* Update en.json

* Update desktop_notification_settings.jsx
Этот коммит содержится в:
Joram Wilander
2016-08-29 09:52:59 -04:00
коммит произвёл Christopher Speller
родитель d252e61c66
Коммит a76db5b84f
8 изменённых файлов: 542 добавлений и 271 удалений

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

@@ -79,17 +79,26 @@ class NotificationStoreClass extends EventEmitter {
notifyText = notifyText.substring(0, 49) + '...';
}
let body = '';
if (notifyText.length === 0) {
if (msgProps.image) {
Utils.notifyMe(title, username + Utils.localizeMessage('channel_loader.uploadedImage', ' uploaded an image'), channel, teamId);
body = username + Utils.localizeMessage('channel_loader.uploadedImage', ' uploaded an image');
} else if (msgProps.otherFile) {
Utils.notifyMe(title, username + Utils.localizeMessage('channel_loader.uploadedFile', ' uploaded a file'), channel, teamId);
body = Utils.localizeMessage('channel_loader.uploadedFile', ' uploaded a file');
} else {
Utils.notifyMe(title, username + Utils.localizeMessage('channel_loader.something', ' did something new'), channel, teamId);
body = username + Utils.localizeMessage('channel_loader.something', ' did something new');
}
} else {
Utils.notifyMe(title, username + Utils.localizeMessage('channel_loader.wrote', ' wrote: ') + notifyText, channel, teamId);
body = username + Utils.localizeMessage('channel_loader.wrote', ' wrote: ') + notifyText;
}
let duration = Constants.DEFAULT_NOTIFICATION_DURATION;
if (user.notify_props && user.notify_props.desktop_duration) {
duration = parseInt(user.notify_props.desktop_duration, 10) * 1000;
}
Utils.notifyMe(title, body, channel, teamId, duration);
if (!user.notify_props || user.notify_props.desktop_sound === 'true') {
Utils.ding();
}