Skip to content

Commit

Permalink
Fix regression bug with active sessions (#2804)
Browse files Browse the repository at this point in the history
* Fix regression bug with active sessions

* dist and e-ref
  • Loading branch information
alex-kovoy authored Jun 27, 2019
1 parent 279f164 commit a3ec0d6
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion e
Submodule e updated from 6378c7 to 8fb0b6
7 changes: 4 additions & 3 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM node:8.11.2-slim

RUN apt-get update && apt-get install -y python python-dev python-pip

RUN npm i [email protected] -g
# Fixes jessie repository
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
RUN apt-get update && apt-get install git -y && apt-get install -y python python-dev python-pip
RUN npm i [email protected] -g

# prepare to install only package.json dependencies
RUN mkdir -p /app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21846,7 +21846,6 @@ webpackJsonp([0],[
id: undefined,
namespace: undefined,
login: undefined,
active: undefined,
created: undefined,
last_active: undefined,
server_id: undefined,
Expand Down Expand Up @@ -21880,9 +21879,7 @@ webpackJsonp([0],[

var jsonArray = json || [];
var newState = defaultState().withMutations(function (newState) {
return jsonArray.filter(function (item) {
return item.active === true;
}).forEach(function (item) {
return jsonArray.forEach(function (item) {
var rec = createSessionRec(siteId, item);
newState.set(rec.id, rec);
});
Expand Down
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<link rel="shortcut icon" href="/web/app/favicon.ico"><link href="/web/app/vendor.152a22f00cda8e3acc388ada3c83b2f6.css" rel="stylesheet"></head>
<body class="grv">
<div id="app"></div>
<script type="text/javascript" src="/web/app/vendor.1d3783820436ca0292c1.js"></script><script type="text/javascript" src="/web/app/styles.1d3783820436ca0292c1.js"></script><script type="text/javascript" src="/web/app/app.1d3783820436ca0292c1.js"></script></body>
<script type="text/javascript" src="/web/app/vendor.24a060de91be02b343c3.js"></script><script type="text/javascript" src="/web/app/styles.24a060de91be02b343c3.js"></script><script type="text/javascript" src="/web/app/app.24a060de91be02b343c3.js"></script></body>
</html>
22 changes: 10 additions & 12 deletions web/src/app/flux/sessions/activeSessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import { Record, List } from 'immutable';

import { RECEIVE_ACTIVE_SESSIONS } from './actionTypes';

const ActiveSessionRec = Record({
const ActiveSessionRec = Record({
id: undefined,
namespace: undefined,
namespace: undefined,
login: undefined,
active: undefined,
created: undefined,
last_active: undefined,
server_id: undefined,
siteId: undefined,
parties: List()
parties: List()
})

const PartyRecord = Record({
Expand All @@ -37,14 +36,14 @@ const PartyRecord = Record({
serverId: undefined
})

const defaultState = () => toImmutable({});
const defaultState = () => toImmutable({});

export default Store({
getInitialState() {
return defaultState();
},

initialize() {
initialize() {
this.on(RECEIVE_ACTIVE_SESSIONS, receive);
}
})
Expand All @@ -54,14 +53,13 @@ function receive(state, { siteId, json }) {
const jsonArray = json || [];
const newState = defaultState().withMutations(newState =>
jsonArray
.filter(item => item.active === true)
.forEach(item => {
const rec = createSessionRec(siteId, item);
newState.set(rec.id, rec);
})
);
return newState.equals(state) ? state : newState;

return newState.equals(state) ? state : newState;
}

function createSessionRec(siteId, json) {
Expand All @@ -77,9 +75,9 @@ function createSessionRec(siteId, json) {

function createParties(jsonArray) {
jsonArray = jsonArray || [];
const list = new List();
const list = new List();
return list.withMutations(list => {
jsonArray.forEach(item => {
jsonArray.forEach(item => {
const party = new PartyRecord({
user: item.user,
serverIp: item.remote_addr,
Expand All @@ -88,5 +86,5 @@ function createParties(jsonArray) {

list.push(party)
})
})
})
}

0 comments on commit a3ec0d6

Please sign in to comment.