summaryrefslogtreecommitdiffstats
path: root/web/react/stores
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-02-03 14:32:01 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-02-03 14:32:01 -0500
commit2b4af8d8c73ba5b9b683b65b1df4d4e3f24edb81 (patch)
tree916555d3a3f53ce9c41873949706b3e723465937 /web/react/stores
parentacac4ab989ac5b0af87aa53a1a1d0c9356dcafc9 (diff)
parentac184720facfaf43f1e48448375d125da19ddefd (diff)
downloadchat-2b4af8d8c73ba5b9b683b65b1df4d4e3f24edb81.tar.gz
chat-2b4af8d8c73ba5b9b683b65b1df4d4e3f24edb81.tar.bz2
chat-2b4af8d8c73ba5b9b683b65b1df4d4e3f24edb81.zip
Merge pull request #2060 from ZBoxApp/PLT-7-channel
PLT-7: Refactoring frontend (chunk 11)
Diffstat (limited to 'web/react/stores')
-rw-r--r--web/react/stores/post_store.jsx5
-rw-r--r--web/react/stores/socket_store.jsx21
2 files changed, 16 insertions, 10 deletions
diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx
index 7abadf2b1..08ffef822 100644
--- a/web/react/stores/post_store.jsx
+++ b/web/react/stores/post_store.jsx
@@ -446,7 +446,7 @@ class PostStoreClass extends EventEmitter {
posts = {};
}
- post.message = '(message deleted)';
+ post.message = this.delete_message;
post.state = Constants.POST_DELETED;
post.filenames = [];
@@ -581,6 +581,9 @@ class PostStoreClass extends EventEmitter {
return commentCount;
}
+ deleteMessage(msg) {
+ this.delete_message = msg;
+ }
}
var PostStore = new PostStoreClass();
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();