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 удалений

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

@@ -60,8 +60,8 @@ export type AdminState = {
userAccessTokens: Record<string, UserAccessToken>;
clusterInfo: ClusterInfo[];
samlCertStatus?: SamlCertificateStatus;
analytics?: Record<string, number | AnalyticsRow[]>;
teamAnalytics?: RelationOneToOne<Team, Record<string, number | AnalyticsRow[]>>;
analytics: AnalyticsState;
teamAnalytics: RelationOneToOne<Team, AnalyticsState>;
userAccessTokensByUser?: RelationOneToOne<UserProfile, Record<string, UserAccessToken>>;
plugins?: Record<string, PluginRedux>;
pluginStatuses?: Record<string, PluginStatusRedux>;
@@ -71,6 +71,31 @@ export type AdminState = {
prevTrialLicense: ClientLicense;
};
export type AnalyticsState = {
POST_PER_DAY?: AnalyticsRow[];
BOT_POST_PER_DAY?: AnalyticsRow[];
USERS_WITH_POSTS_PER_DAY?: AnalyticsRow[];
TOTAL_PUBLIC_CHANNELS?: number;
TOTAL_PRIVATE_GROUPS?: number;
TOTAL_POSTS?: number;
TOTAL_USERS?: number;
TOTAL_INACTIVE_USERS?: number;
TOTAL_TEAMS?: number;
TOTAL_WEBSOCKET_CONNECTIONS?: number;
TOTAL_MASTER_DB_CONNECTIONS?: number;
TOTAL_READ_DB_CONNECTIONS?: number;
DAILY_ACTIVE_USERS?: number;
MONTHLY_ACTIVE_USERS?: number;
TOTAL_FILE_POSTS?: number;
TOTAL_HASHTAG_POSTS?: number;
TOTAL_IHOOKS?: number;
TOTAL_OHOOKS?: number;
TOTAL_COMMANDS?: number;
TOTAL_SESSIONS?: number;
REGISTERED_USERS?: number;
}
export type ClusterInfo = {
id: string;
version: string;

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

@@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IDMappedObjects, RelationOneToMany, RelationOneToOne} from './utilities';
import {IDMappedObjects, RelationOneToManyUnique, RelationOneToOne} from './utilities';
import {Team} from './teams';
// e.g.
@@ -147,7 +147,7 @@ export type ChannelUnread = {
export type ChannelsState = {
currentChannelId: string;
channels: IDMappedObjects<Channel>;
channelsInTeam: RelationOneToMany<Team, Channel>;
channelsInTeam: RelationOneToManyUnique<Team, Channel>;
myMembers: RelationOneToOne<Channel, ChannelMembership>;
roles: RelationOneToOne<Channel, Set<string>>;
membersInChannel: RelationOneToOne<Channel, Record<string, ChannelMembership>>;

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

@@ -70,16 +70,16 @@ export type UsersState = {
mySessions: Session[];
myAudits: Audit[];
profiles: IDMappedObjects<UserProfile>;
profilesInTeam: RelationOneToMany<Team, UserProfile>;
profilesNotInTeam: RelationOneToMany<Team, UserProfile>;
profilesInTeam: RelationOneToManyUnique<Team, UserProfile>;
profilesNotInTeam: RelationOneToManyUnique<Team, UserProfile>;
profilesWithoutTeam: Set<string>;
profilesInChannel: RelationOneToManyUnique<Channel, UserProfile>;
profilesNotInChannel: RelationOneToManyUnique<Channel, UserProfile>;
profilesInGroup: RelationOneToMany<Group, UserProfile>;
profilesNotInGroup: RelationOneToMany<Group, UserProfile>;
profilesInGroup: RelationOneToManyUnique<Group, UserProfile>;
profilesNotInGroup: RelationOneToManyUnique<Group, UserProfile>;
statuses: RelationOneToOne<UserProfile, string>;
stats: RelationOneToOne<UserProfile, UsersStats>;
filteredStats?: UsersStats;
stats: Partial<UsersStats>;
filteredStats: Partial<UsersStats>;
myUserAccessTokens: Record<string, UserAccessToken>;
lastActivity: RelationOneToOne<UserProfile, number>;
};