Fix types of various fields in GlobalState (#26125)

* Fix types of entities.admin.analytics and entities.admin.teamAnalytics

* Fix type of entities.channels.channelsInTeam

* Fix types of entities.users.stats and entities.users.filteredStats

* Fix types of various profilesInX fields in entities.users

* Fix incorrect field name last_password_update_at used when updating password

We never noticed this bug before because the settings modal reloads the current user after updating their password.

* MM-56760 Fix users not being removed from state.entities.users properly
Этот коммит содержится в:
Harrison Healey
2024-02-15 12:25:11 -05:00
коммит произвёл GitHub
родитель 64b140900e
Коммит 54507bb115
48 изменённых файлов: 316 добавлений и 217 удалений

Просмотреть файл

@@ -4,7 +4,7 @@
import React from 'react';
import {FormattedMessage, useIntl} from 'react-intl';
import type {AnalyticsRow} from '@mattermost/types/admin';
import type {AnalyticsState} from '@mattermost/types/admin';
import type {CloudCustomer} from '@mattermost/types/cloud';
import type {ClientLicense} from '@mattermost/types/config';
@@ -46,7 +46,7 @@ type Props = {
prevTrialLicense: ClientLicense;
stats?: Record<string, number | AnalyticsRow[]>;
stats?: AnalyticsState;
actions: {
getPrevTrialLicense: () => void;
getCloudSubscription: () => void;

Просмотреть файл

@@ -6,7 +6,7 @@ import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import type {ChannelStats} from '@mattermost/types/channels';
import type {UserProfile, UsersStats} from '@mattermost/types/users';
import type {UserProfile} from '@mattermost/types/users';
import {getChannelStats} from 'mattermost-redux/actions/channels';
import {getFilteredUsersStats} from 'mattermost-redux/actions/users';
@@ -69,10 +69,10 @@ function makeMapStateToProps() {
};
totalCount = stats.member_count;
} else {
const filteredUserStats: UsersStats = selectFilteredUsersStats(state) || {
const filteredUserStats = selectFilteredUsersStats(state) || {
total_users_count: 0,
};
totalCount = filteredUserStats.total_users_count;
totalCount = filteredUserStats.total_users_count ?? 0;
}
let users = [];

Просмотреть файл

@@ -5,7 +5,7 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import type {Dispatch} from 'redux';
import type {UserProfile, UsersStats} from '@mattermost/types/users';
import type {UserProfile} from '@mattermost/types/users';
import {getTeamStats as loadTeamStats} from 'mattermost-redux/actions/teams';
import {getFilteredUsersStats} from 'mattermost-redux/actions/users';
@@ -49,10 +49,10 @@ function mapStateToProps(state: GlobalState, props: Props) {
const stats = getTeamStats(state)[teamId] || {active_member_count: 0};
totalCount = stats.active_member_count;
} else {
const filteredUserStats: UsersStats = selectFilteredUsersStats(state) || {
const filteredUserStats = selectFilteredUsersStats(state) || {
total_users_count: 0,
};
totalCount = filteredUserStats.total_users_count;
totalCount = filteredUserStats.total_users_count ?? 0;
}
let users = [];

Просмотреть файл

@@ -72,7 +72,7 @@ const usesLDAP = async (
// // @see discussion here: https://github.com/mattermost/mattermost-webapp/pull/9822#discussion_r806879385
// const fetchGuestAccounts = async (
// config: Partial<AdminConfig>,
// analytics: Record<string, number | AnalyticsRow[]> | undefined,
// analytics: AnalyticsState | undefined,
// ) => {
// if (config.TeamSettings?.EnableOpenServer && config.GuestAccountsSettings?.Enable) {
// let usersArray = await fetch(`${Client4.getBaseRoute()}/users/invalid_emails`).then((result) => result.json());