diff options
author | =Corey Hulen <corey@hulen.com> | 2016-02-03 10:45:58 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-02-03 10:45:58 -0800 |
commit | bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1 (patch) | |
tree | 1626d089802a92ee208b6e7fa056378e40568a92 /web/react/utils | |
parent | 581785f5044eecdc7cf664e4c7fc59efc6babc96 (diff) | |
parent | 9bba6c79882d1f5d14b98052caf59a11fc2388d5 (diff) | |
download | chat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.tar.gz chat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.tar.bz2 chat-bdfa4715d65ed4b4e903a1eb4c83eba6c95455d1.zip |
Merge branch 'master' into PLT-1429
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/async_client.jsx | 26 | ||||
-rw-r--r-- | web/react/utils/client.jsx | 36 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 6 | ||||
-rw-r--r-- | web/react/utils/markdown.jsx | 2 |
4 files changed, 67 insertions, 3 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 5378a2ba6..970b1a4c0 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -312,6 +312,32 @@ export function getLogs() { ); } +export function getServerAudits() { + if (isCallInProgress('getServerAudits')) { + return; + } + + callTracker.getServerAudits = utils.getTimestamp(); + client.getServerAudits( + (data, textStatus, xhr) => { + callTracker.getServerAudits = 0; + + if (xhr.status === 304 || !data) { + return; + } + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_SERVER_AUDITS, + audits: data + }); + }, + (err) => { + callTracker.getServerAudits = 0; + dispatchError(err, 'getServerAudits'); + } + ); +} + export function getConfig() { if (isCallInProgress('getConfig')) { return; diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 855de3fc2..992337671 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -305,6 +305,28 @@ export function loginByEmail(name, email, password, success, error) { }); } +export function loginByUsername(name, username, password, success, error) { + $.ajax({ + url: '/api/v1/users/login', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify({name, username, password}), + success: function onSuccess(data, textStatus, xhr) { + track('api', 'api_users_login_success', data.team_id, 'username', data.username); + sessionStorage.removeItem(data.id + '_last_error'); + BrowserStore.signalLogin(); + success(data, textStatus, xhr); + }, + error: function onError(xhr, status, err) { + track('api', 'api_users_login_fail', name, 'username', username); + + var e = handleError('loginByUsername', xhr, status, err); + error(e); + } + }); +} + export function loginByLdap(teamName, id, password, success, error) { $.ajax({ url: '/api/v1/users/login_ldap', @@ -385,6 +407,20 @@ export function getLogs(success, error) { }); } +export function getServerAudits(success, error) { + $.ajax({ + url: '/api/v1/admin/audits', + dataType: 'json', + contentType: 'application/json', + type: 'GET', + success, + error: function onError(xhr, status, err) { + var e = handleError('getServerAudits', xhr, status, err); + error(e); + } + }); +} + export function getConfig(success, error) { $.ajax({ url: '/api/v1/admin/config', diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index e1a4b8a8a..11a8da669 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -45,6 +45,7 @@ export default { RECIEVED_CONFIG: null, RECIEVED_LOGS: null, + RECIEVED_SERVER_AUDITS: null, RECIEVED_ALL_TEAMS: null, SHOW_SEARCH: null, @@ -84,7 +85,7 @@ export default { SPECIAL_MENTIONS: ['channel'], CHARACTER_LIMIT: 4000, IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'], - AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac'], + AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'], VIDEO_TYPES: ['mp4', 'avi', 'webm', 'mkv', 'wmv', 'mpg', 'mov', 'flv'], PRESENTATION_TYPES: ['ppt', 'pptx'], SPREADSHEET_TYPES: ['xlsx', 'csv'], @@ -462,5 +463,6 @@ export default { MIN_USERNAME_LENGTH: 3, MAX_USERNAME_LENGTH: 15, MIN_PASSWORD_LENGTH: 5, - MAX_PASSWORD_LENGTH: 50 + MAX_PASSWORD_LENGTH: 50, + TIME_SINCE_UPDATE_INTERVAL: 30000 }; diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 826b87d08..47b3a9a66 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -134,7 +134,7 @@ class MattermostMarkdownRenderer extends marked.Renderer { ); } else if (usedLanguage === 'tex' || usedLanguage === 'latex') { try { - const html = katex.renderToString(TextFormatting.sanitizeHtml(code), {throwOnError: false, displayMode: true}); + const html = katex.renderToString(code, {throwOnError: false, displayMode: true}); return '<div class="post-body--code tex">' + html + '</div>'; } catch (e) { |