summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorElias Nahum <nahumhbl@gmail.com>2016-02-03 12:16:28 -0300
committerElias Nahum <nahumhbl@gmail.com>2016-02-03 12:17:13 -0300
commitcdfa9b585a220353114924477a300fb6d3e50df8 (patch)
treee4831292bb2d6f762a7fbb00a9e814dd61f29ff6 /web/react/stores
parent6a3806fe9d03abdfa1eb30fc62c7388a6922b60f (diff)
downloadchat-cdfa9b585a220353114924477a300fb6d3e50df8.tar.gz
chat-cdfa9b585a220353114924477a300fb6d3e50df8.tar.bz2
chat-cdfa9b585a220353114924477a300fb6d3e50df8.zip
Messages for SocketStore and small fixes
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/socket_store.jsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx
index 736b0ca27..744c2c8e5 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -86,7 +86,7 @@ class SocketStoreClass extends EventEmitter {
this.failCount = this.failCount + 1;
- ErrorStore.storeLastError({connErrorCount: this.failCount, message: 'Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port.'});
+ ErrorStore.storeLastError({connErrorCount: this.failCount, message: this.translations.socketError});
ErrorStore.emitChange();
};
@@ -109,7 +109,7 @@ class SocketStoreClass extends EventEmitter {
handleMessage(msg) {
switch (msg.action) {
case SocketEvents.POSTED:
- handleNewPostEvent(msg);
+ handleNewPostEvent(msg, this.translations);
break;
case SocketEvents.POST_EDITED:
@@ -151,9 +151,12 @@ class SocketStoreClass extends EventEmitter {
this.initialize();
}
}
+ setTranslations(messages) {
+ this.translations = messages;
+ }
}
-function handleNewPostEvent(msg) {
+function handleNewPostEvent(msg, translations) {
// Store post
const post = JSON.parse(msg.props.post);
EventHelpers.emitPostRecievedEvent(post);
@@ -192,14 +195,14 @@ function handleNewPostEvent(msg) {
return;
}
- let username = 'Someone';
+ let username = translations.someone;
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
username = post.props.override_username;
} else if (UserStore.hasProfile(msg.user_id)) {
username = UserStore.getProfile(msg.user_id).username;
}
- let title = 'Posted';
+ let title = translations.posted;
if (channel) {
title = channel.display_name;
}
@@ -211,14 +214,14 @@ function handleNewPostEvent(msg) {
if (notifyText.length === 0) {
if (msgProps.image) {
- Utils.notifyMe(title, username + ' uploaded an image', channel);
+ Utils.notifyMe(title, username + translations.uploadedImage, channel);
} else if (msgProps.otherFile) {
- Utils.notifyMe(title, username + ' uploaded a file', channel);
+ Utils.notifyMe(title, username + translations.uploadedFile, channel);
} else {
- Utils.notifyMe(title, username + ' did something new', channel);
+ Utils.notifyMe(title, username + translations.something, channel);
}
} else {
- Utils.notifyMe(title, username + ' wrote: ' + notifyText, channel);
+ Utils.notifyMe(title, username + translations.wrote + notifyText, channel);
}
if (!user.notify_props || user.notify_props.desktop_sound === 'true') {
Utils.ding();