summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx4
-rw-r--r--web/react/utils/client.jsx28
-rw-r--r--web/react/utils/utils.jsx2
3 files changed, 18 insertions, 16 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 13b57092d..ca9d81865 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -787,11 +787,13 @@ export function getSuggestedCommands(command, suggestionId, component) {
data.forEach((cmd) => {
if (('/' + cmd.trigger).indexOf(command) === 0) {
let s = '/' + cmd.trigger;
+ let hint = '';
if (cmd.auto_complete_hint && cmd.auto_complete_hint.length !== 0) {
- s += ' ' + cmd.auto_complete_hint;
+ hint = cmd.auto_complete_hint;
}
matches.push({
suggestion: s,
+ hint,
description: cmd.auto_complete_desc
});
}
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 81bdb7293..f647e2296 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -4,6 +4,15 @@ import BrowserStore from '../stores/browser_store.jsx';
import TeamStore from '../stores/team_store.jsx';
import ErrorStore from '../stores/error_store.jsx';
+let translations = {
+ connectionError: 'There appears to be a problem with your internet connection.',
+ unknownError: 'We received an unexpected status code from the server.'
+};
+
+export function setTranslations(messages) {
+ translations = messages;
+}
+
export function track(category, action, label, property, value) {
global.window.analytics.track(action, {category, label, property, value});
}
@@ -23,23 +32,14 @@ function handleError(methodName, xhr, status, err) {
var msg = '';
if (e) {
- msg = 'error in ' + methodName + ' msg=' + e.message + ' detail=' + e.detailed_error + ' rid=' + e.request_id;
+ msg = 'method=' + methodName + ' msg=' + e.message + ' detail=' + e.detailed_error + ' rid=' + e.request_id;
} else {
- msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err;
+ msg = 'method=' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err;
if (xhr.status === 0) {
- let errorCount = 1;
- const oldError = ErrorStore.getLastError();
- let connectError = 'There appears to be a problem with your internet connection';
-
- if (oldError && oldError.connErrorCount) {
- errorCount += oldError.connErrorCount;
- connectError = 'Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port.';
- }
-
- e = {message: connectError, connErrorCount: errorCount};
+ e = {message: translations.connectionError};
} else {
- e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'};
+ e = {message: translations.unknownError + ' (' + xhr.status + ')'};
}
}
@@ -279,7 +279,7 @@ export function logout() {
var currentTeamUrl = TeamStore.getCurrentTeamUrl();
BrowserStore.signalLogout();
BrowserStore.clear();
- ErrorStore.storeLastError(null);
+ ErrorStore.clearLastError();
window.location.href = currentTeamUrl + '/logout';
}
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 02590bd93..3e531c821 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -158,7 +158,7 @@ export function notifyMe(title, body, channel) {
Notification.requestPermission((permission) => {
if (permission === 'granted') {
try {
- var notification = new Notification(title, {body, tag: body, icon: '/static/images/icon50x50.png'});
+ var notification = new Notification(title, {body: body, tag: body, icon: '/static/images/icon50x50.png'});
notification.onclick = () => {
window.focus();
if (channel) {