Skip to content

Commit

Permalink
Regression: Revert Livechat packages upgrades/removals that were caus…
Browse files Browse the repository at this point in the history
…ing issues (#26077)
  • Loading branch information
murtaza98 committed Jun 30, 2022
1 parent cb7c9a9 commit 26a9965
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 251 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/server/api/v1/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ API.v1.addRoute('livechat/config', {
const config = await cachedSettings({ businessUnit });

const status = Livechat.online(department);
const guest = token && Livechat.findGuest(token);
const guest = token && (await Livechat.findGuest(token));

const room = guest && findOpenRoom(token);
const agent = guest && room && room.servedBy && findAgent(room.servedBy._id);
Expand Down
3 changes: 2 additions & 1 deletion packages/livechat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"url-loader": "^4.1.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^4.9.2"
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@rocket.chat/fuselage-tokens": "~0.31.11",
Expand All @@ -87,6 +87,7 @@
"css-vars-ponyfill": "^2.3.2",
"date-fns": "^2.15.0",
"emoji-mart": "^3.0.0",
"history": "^5.3.0",
"i18next": "^21.8.4",
"markdown-it": "^11.0.0",
"mem": "^6.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/livechat/src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Router, route } from 'preact-router';
import { parse } from 'query-string';
import { withTranslation } from 'react-i18next';

import history from '../../history';
import Connection from '../../lib/connection';
import CustomFields from '../../lib/customFields';
import Hooks from '../../lib/hooks';
Expand Down Expand Up @@ -230,7 +231,7 @@ export class App extends Component {
};

return (
<Router onChange={this.handleRoute}>
<Router history={history} onChange={this.handleRoute}>
<ChatConnector default path='/' {...screenProps} />
<ChatFinished path='/chat-finished' {...screenProps} />
<GDPRAgreement path='/gdpr' {...screenProps} />
Expand Down
5 changes: 5 additions & 0 deletions packages/livechat/src/history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createMemoryHistory } from 'history';

export const history = createMemoryHistory();

export default history;
2 changes: 1 addition & 1 deletion packages/livechat/src/routes/Register/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class RegisterContainer extends Component {
const { user: prevUser } = prevProps;
const { user } = this.props;

if (!prevUser && user && user._id) {
if ((!prevUser || Object.keys(prevUser).length === 0) && user && user._id) {
route('/');
}
}
Expand Down
Loading

0 comments on commit 26a9965

Please sign in to comment.