Use Client APIs to resolve URLs (#5148)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
67739cb516
Коммит
7e9cf13aa3
7
webapp/client/test_web_client.jsx
Обычный файл
7
webapp/client/test_web_client.jsx
Обычный файл
@@ -0,0 +1,7 @@
|
|||||||
|
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See License.txt for license information.
|
||||||
|
|
||||||
|
import Client from './client.jsx';
|
||||||
|
|
||||||
|
var WebClient = new Client();
|
||||||
|
export default WebClient;
|
||||||
@@ -50,7 +50,7 @@ class WebClientClass extends Client {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err.status === HTTP_UNAUTHORIZED && res.req.url !== '/api/v3/users/login') {
|
if (err.status === HTTP_UNAUTHORIZED && res.req.url !== this.getUsersRoute() + '/login') {
|
||||||
GlobalActions.emitUserLoggedOutEvent('/login');
|
GlobalActions.emitUserLoggedOutEvent('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
|
import Client from '../client/web_client.jsx';
|
||||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
@@ -148,8 +149,7 @@ class EmojiStore extends EventEmitter {
|
|||||||
|
|
||||||
getEmojiImageUrl(emoji) {
|
getEmojiImageUrl(emoji) {
|
||||||
if (emoji.id) {
|
if (emoji.id) {
|
||||||
// must match Client.getCustomEmojiImageUrl
|
return Client.getCustomEmojiImageUrl(emoji.id);
|
||||||
return `/api/v3/emoji/${emoji.id}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const filename = emoji.filename || emoji.aliases[0];
|
const filename = emoji.filename || emoji.aliases[0];
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ if (TEST) {
|
|||||||
config.entry = ['babel-polyfill', './root.jsx'];
|
config.entry = ['babel-polyfill', './root.jsx'];
|
||||||
config.target = 'node';
|
config.target = 'node';
|
||||||
config.externals = [nodeExternals()];
|
config.externals = [nodeExternals()];
|
||||||
|
config.resolve.alias['./client/web_client.jsx'] = path.resolve(__dirname, 'client/test_web_client.jsx');
|
||||||
} else {
|
} else {
|
||||||
// For some reason these break mocha. So they go here.
|
// For some reason these break mocha. So they go here.
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user