From 0a1b34366b0308c62b64df7d27b36b6c6ae348e9 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Wed, 5 Jul 2017 09:00:30 -0400
Subject: Update mattermost redux to latest (#6846)

* Update to latest mattermost-redux

* Add back recent and new users to team analytics page

* Update to latest
---
 .../analytics/team_analytics/team_analytics.jsx    | 25 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

(limited to 'webapp/components/analytics/team_analytics/team_analytics.jsx')

diff --git a/webapp/components/analytics/team_analytics/team_analytics.jsx b/webapp/components/analytics/team_analytics/team_analytics.jsx
index c2616fede..f2f12d938 100644
--- a/webapp/components/analytics/team_analytics/team_analytics.jsx
+++ b/webapp/components/analytics/team_analytics/team_analytics.jsx
@@ -13,6 +13,7 @@ import BrowserStore from 'stores/browser_store.jsx';
 
 import * as AdminActions from 'actions/admin_actions.jsx';
 import {StatTypes} from 'utils/constants.jsx';
+import {General} from 'mattermost-redux/constants';
 
 import LineChart from 'components/analytics/line_chart.jsx';
 import StatisticCount from 'components/analytics/statistic_count.jsx';
@@ -39,7 +40,12 @@ export default class TeamAnalytics extends React.Component {
             /*
              * Function to get teams
              */
-            getTeams: PropTypes.func.isRequired
+            getTeams: PropTypes.func.isRequired,
+
+            /*
+             * Function to get users in a team
+             */
+            getProfilesInTeam: PropTypes.func.isRequired
         }).isRequired
     }
 
@@ -50,7 +56,9 @@ export default class TeamAnalytics extends React.Component {
 
         this.state = {
             team: props.initialTeam,
-            stats: AnalyticsStore.getAllTeam(teamId)
+            stats: AnalyticsStore.getAllTeam(teamId),
+            recentlyActiveUsers: [],
+            newUsers: []
         };
     }
 
@@ -70,10 +78,17 @@ export default class TeamAnalytics extends React.Component {
         }
     }
 
-    getData(id) {
+    getData = async (id) => {
         AdminActions.getStandardAnalytics(id);
         AdminActions.getPostsPerDayAnalytics(id);
         AdminActions.getUsersPerDayAnalytics(id);
+        const recentlyActiveUsers = await this.props.actions.getProfilesInTeam(id, 0, General.PROFILE_CHUNK_SIZE, 'last_activity_at');
+        const newUsers = await this.props.actions.getProfilesInTeam(id, 0, General.PROFILE_CHUNK_SIZE, 'create_at');
+
+        this.setState({
+            recentlyActiveUsers,
+            newUsers
+        });
     }
 
     componentWillUnmount() {
@@ -200,8 +215,8 @@ export default class TeamAnalytics extends React.Component {
             );
         }
 
-        const recentActiveUsers = formatRecentUsersData(stats[StatTypes.RECENTLY_ACTIVE_USERS]);
-        const newlyCreatedUsers = formatNewUsersData(stats[StatTypes.NEWLY_CREATED_USERS]);
+        const recentActiveUsers = formatRecentUsersData(this.state.recentlyActiveUsers);
+        const newlyCreatedUsers = formatNewUsersData(this.state.newUsers);
 
         const teams = this.props.teams.map((team) => {
             return (
-- 
cgit v1.2.3-1-g7c22

