mattermost-redux 11.3.0 → 11.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ import PlaybookType from './playbooks';
22
22
  import PluginTypes from './plugins';
23
23
  import PostTypes from './posts';
24
24
  import PreferenceTypes from './preferences';
25
+ import RecapTypes from './recaps';
25
26
  import RoleTypes from './roles';
26
27
  import SchemeTypes from './schemes';
27
28
  import ScheduledPostTypes from './scheudled_posts';
@@ -30,7 +31,7 @@ import SharedChannelTypes from './shared_channels';
30
31
  import TeamTypes from './teams';
31
32
  import ThreadTypes from './threads';
32
33
  import UserTypes from './users';
33
- export { ErrorTypes, GeneralTypes, UserTypes, TeamTypes, ChannelTypes, PostTypes, FileTypes, PreferenceTypes, IntegrationTypes, EmojiTypes, AdminTypes, JobTypes, LimitsTypes, SearchTypes, RoleTypes, SchemeTypes, GroupTypes, BotTypes, PluginTypes, ChannelCategoryTypes, CloudTypes, AppsTypes, ThreadTypes, HostedCustomerTypes, DraftTypes, PlaybookType, ChannelBookmarkTypes, ScheduledPostTypes, SharedChannelTypes, ContentFlaggingTypes, AgentTypes, };
34
+ export { ErrorTypes, GeneralTypes, UserTypes, TeamTypes, ChannelTypes, PostTypes, FileTypes, PreferenceTypes, RecapTypes, IntegrationTypes, EmojiTypes, AdminTypes, JobTypes, LimitsTypes, SearchTypes, RoleTypes, SchemeTypes, GroupTypes, BotTypes, PluginTypes, ChannelCategoryTypes, CloudTypes, AppsTypes, ThreadTypes, HostedCustomerTypes, DraftTypes, PlaybookType, ChannelBookmarkTypes, ScheduledPostTypes, SharedChannelTypes, ContentFlaggingTypes, AgentTypes, };
34
35
  /**
35
36
  * An MMReduxAction is any non-Thunk Redux action accepted by mattermost-redux.
36
37
  */
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AgentTypes = exports.ContentFlaggingTypes = exports.SharedChannelTypes = exports.ScheduledPostTypes = exports.ChannelBookmarkTypes = exports.PlaybookType = exports.DraftTypes = exports.HostedCustomerTypes = exports.ThreadTypes = exports.AppsTypes = exports.CloudTypes = exports.ChannelCategoryTypes = exports.PluginTypes = exports.BotTypes = exports.GroupTypes = exports.SchemeTypes = exports.RoleTypes = exports.SearchTypes = exports.LimitsTypes = exports.JobTypes = exports.AdminTypes = exports.EmojiTypes = exports.IntegrationTypes = exports.PreferenceTypes = exports.FileTypes = exports.PostTypes = exports.ChannelTypes = exports.TeamTypes = exports.UserTypes = exports.GeneralTypes = exports.ErrorTypes = void 0;
8
+ exports.AgentTypes = exports.ContentFlaggingTypes = exports.SharedChannelTypes = exports.ScheduledPostTypes = exports.ChannelBookmarkTypes = exports.PlaybookType = exports.DraftTypes = exports.HostedCustomerTypes = exports.ThreadTypes = exports.AppsTypes = exports.CloudTypes = exports.ChannelCategoryTypes = exports.PluginTypes = exports.BotTypes = exports.GroupTypes = exports.SchemeTypes = exports.RoleTypes = exports.SearchTypes = exports.LimitsTypes = exports.JobTypes = exports.AdminTypes = exports.EmojiTypes = exports.IntegrationTypes = exports.RecapTypes = exports.PreferenceTypes = exports.FileTypes = exports.PostTypes = exports.ChannelTypes = exports.TeamTypes = exports.UserTypes = exports.GeneralTypes = exports.ErrorTypes = void 0;
9
9
  const admin_1 = __importDefault(require("./admin"));
10
10
  exports.AdminTypes = admin_1.default;
11
11
  const agents_1 = __importDefault(require("./agents"));
@@ -52,6 +52,8 @@ const posts_1 = __importDefault(require("./posts"));
52
52
  exports.PostTypes = posts_1.default;
53
53
  const preferences_1 = __importDefault(require("./preferences"));
54
54
  exports.PreferenceTypes = preferences_1.default;
55
+ const recaps_1 = __importDefault(require("./recaps"));
56
+ exports.RecapTypes = recaps_1.default;
55
57
  const roles_1 = __importDefault(require("./roles"));
56
58
  exports.RoleTypes = roles_1.default;
57
59
  const schemes_1 = __importDefault(require("./schemes"));
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ CREATE_RECAP_REQUEST: "CREATE_RECAP_REQUEST";
3
+ CREATE_RECAP_SUCCESS: "CREATE_RECAP_SUCCESS";
4
+ CREATE_RECAP_FAILURE: "CREATE_RECAP_FAILURE";
5
+ RECEIVED_RECAP: "RECEIVED_RECAP";
6
+ RECEIVED_RECAPS: "RECEIVED_RECAPS";
7
+ GET_RECAP_REQUEST: "GET_RECAP_REQUEST";
8
+ GET_RECAP_SUCCESS: "GET_RECAP_SUCCESS";
9
+ GET_RECAP_FAILURE: "GET_RECAP_FAILURE";
10
+ GET_RECAPS_REQUEST: "GET_RECAPS_REQUEST";
11
+ GET_RECAPS_SUCCESS: "GET_RECAPS_SUCCESS";
12
+ GET_RECAPS_FAILURE: "GET_RECAPS_FAILURE";
13
+ MARK_RECAP_READ_REQUEST: "MARK_RECAP_READ_REQUEST";
14
+ MARK_RECAP_READ_SUCCESS: "MARK_RECAP_READ_SUCCESS";
15
+ MARK_RECAP_READ_FAILURE: "MARK_RECAP_READ_FAILURE";
16
+ DELETE_RECAP_REQUEST: "DELETE_RECAP_REQUEST";
17
+ DELETE_RECAP_SUCCESS: "DELETE_RECAP_SUCCESS";
18
+ DELETE_RECAP_FAILURE: "DELETE_RECAP_FAILURE";
19
+ REGENERATE_RECAP_REQUEST: "REGENERATE_RECAP_REQUEST";
20
+ REGENERATE_RECAP_SUCCESS: "REGENERATE_RECAP_SUCCESS";
21
+ REGENERATE_RECAP_FAILURE: "REGENERATE_RECAP_FAILURE";
22
+ };
23
+ export default _default;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
+ // See LICENSE.txt for license information.
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const key_mirror_1 = __importDefault(require("mattermost-redux/utils/key_mirror"));
9
+ exports.default = (0, key_mirror_1.default)({
10
+ CREATE_RECAP_REQUEST: null,
11
+ CREATE_RECAP_SUCCESS: null,
12
+ CREATE_RECAP_FAILURE: null,
13
+ RECEIVED_RECAP: null,
14
+ RECEIVED_RECAPS: null,
15
+ GET_RECAP_REQUEST: null,
16
+ GET_RECAP_SUCCESS: null,
17
+ GET_RECAP_FAILURE: null,
18
+ GET_RECAPS_REQUEST: null,
19
+ GET_RECAPS_SUCCESS: null,
20
+ GET_RECAPS_FAILURE: null,
21
+ MARK_RECAP_READ_REQUEST: null,
22
+ MARK_RECAP_READ_SUCCESS: null,
23
+ MARK_RECAP_READ_FAILURE: null,
24
+ DELETE_RECAP_REQUEST: null,
25
+ DELETE_RECAP_SUCCESS: null,
26
+ DELETE_RECAP_FAILURE: null,
27
+ REGENERATE_RECAP_REQUEST: null,
28
+ REGENERATE_RECAP_SUCCESS: null,
29
+ REGENERATE_RECAP_FAILURE: null,
30
+ });
@@ -9,7 +9,6 @@ export declare function searchAccessControlPolicyChannels(id: string, term: stri
9
9
  export declare function assignChannelsToAccessControlPolicy(policyId: string, channelIds: string[]): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
10
10
  export declare function unassignChannelsFromAccessControlPolicy(policyId: string, channelIds: string[]): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
11
11
  export declare function getAccessControlFields(after: string, limit: number, channelId?: string): ActionFuncAsync<import("@mattermost/types/properties").UserPropertyField[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
12
- export declare function updateAccessControlPolicyActive(policyId: string, active: boolean): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
13
12
  export declare function searchUsersForExpression(expression: string, term: string, after: string, limit: number, channelId?: string): ActionFuncAsync<AccessControlTestResult>;
14
13
  export declare function getVisualAST(expression: string, channelId?: string): ActionFuncAsync<import("@mattermost/types/access_control").AccessControlVisualAST, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
15
14
  export declare function validateExpressionAgainstRequester(expression: string, channelId?: string): ActionFuncAsync<{
@@ -10,7 +10,6 @@ exports.searchAccessControlPolicyChannels = searchAccessControlPolicyChannels;
10
10
  exports.assignChannelsToAccessControlPolicy = assignChannelsToAccessControlPolicy;
11
11
  exports.unassignChannelsFromAccessControlPolicy = unassignChannelsFromAccessControlPolicy;
12
12
  exports.getAccessControlFields = getAccessControlFields;
13
- exports.updateAccessControlPolicyActive = updateAccessControlPolicyActive;
14
13
  exports.searchUsersForExpression = searchUsersForExpression;
15
14
  exports.getVisualAST = getVisualAST;
16
15
  exports.validateExpressionAgainstRequester = validateExpressionAgainstRequester;
@@ -116,15 +115,6 @@ function getAccessControlFields(after, limit, channelId) {
116
115
  ],
117
116
  });
118
117
  }
119
- function updateAccessControlPolicyActive(policyId, active) {
120
- return (0, helpers_1.bindClientFunc)({
121
- clientFunc: client_1.Client4.updateAccessControlPolicyActive,
122
- params: [
123
- policyId,
124
- active,
125
- ],
126
- });
127
- }
128
118
  function searchUsersForExpression(expression, term, after, limit, channelId) {
129
119
  return async (dispatch, getState) => {
130
120
  let data;
@@ -0,0 +1,8 @@
1
+ import type { Recap } from '@mattermost/types/recaps';
2
+ import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
3
+ export declare function createRecap(title: string, channelIds: string[], agentId: string): ActionFuncAsync<Recap>;
4
+ export declare function getRecaps(page?: number, perPage?: number): ActionFuncAsync<Recap[]>;
5
+ export declare function getRecap(recapId: string): ActionFuncAsync<Recap>;
6
+ export declare function markRecapAsRead(recapId: string): ActionFuncAsync<Recap>;
7
+ export declare function regenerateRecap(recapId: string): ActionFuncAsync<Recap>;
8
+ export declare function deleteRecap(recapId: string): ActionFuncAsync;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
+ // See LICENSE.txt for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.createRecap = createRecap;
6
+ exports.getRecaps = getRecaps;
7
+ exports.getRecap = getRecap;
8
+ exports.markRecapAsRead = markRecapAsRead;
9
+ exports.regenerateRecap = regenerateRecap;
10
+ exports.deleteRecap = deleteRecap;
11
+ const action_types_1 = require("mattermost-redux/action_types");
12
+ const errors_1 = require("mattermost-redux/actions/errors");
13
+ const client_1 = require("mattermost-redux/client");
14
+ const helpers_1 = require("./helpers");
15
+ function createRecap(title, channelIds, agentId) {
16
+ return (0, helpers_1.bindClientFunc)({
17
+ clientFunc: () => client_1.Client4.createRecap({ title, channel_ids: channelIds, agent_id: agentId }),
18
+ onRequest: action_types_1.RecapTypes.CREATE_RECAP_REQUEST,
19
+ onSuccess: [action_types_1.RecapTypes.CREATE_RECAP_SUCCESS, action_types_1.RecapTypes.RECEIVED_RECAP],
20
+ onFailure: action_types_1.RecapTypes.CREATE_RECAP_FAILURE,
21
+ });
22
+ }
23
+ function getRecaps(page = 0, perPage = 60) {
24
+ return (0, helpers_1.bindClientFunc)({
25
+ clientFunc: () => client_1.Client4.getRecaps(page, perPage),
26
+ onRequest: action_types_1.RecapTypes.GET_RECAPS_REQUEST,
27
+ onSuccess: [action_types_1.RecapTypes.GET_RECAPS_SUCCESS, action_types_1.RecapTypes.RECEIVED_RECAPS],
28
+ onFailure: action_types_1.RecapTypes.GET_RECAPS_FAILURE,
29
+ });
30
+ }
31
+ function getRecap(recapId) {
32
+ return (0, helpers_1.bindClientFunc)({
33
+ clientFunc: () => client_1.Client4.getRecap(recapId),
34
+ onRequest: action_types_1.RecapTypes.GET_RECAP_REQUEST,
35
+ onSuccess: [action_types_1.RecapTypes.GET_RECAP_SUCCESS, action_types_1.RecapTypes.RECEIVED_RECAP],
36
+ onFailure: action_types_1.RecapTypes.GET_RECAP_FAILURE,
37
+ });
38
+ }
39
+ function markRecapAsRead(recapId) {
40
+ return (0, helpers_1.bindClientFunc)({
41
+ clientFunc: () => client_1.Client4.markRecapAsRead(recapId),
42
+ onRequest: action_types_1.RecapTypes.MARK_RECAP_READ_REQUEST,
43
+ onSuccess: [action_types_1.RecapTypes.MARK_RECAP_READ_SUCCESS, action_types_1.RecapTypes.RECEIVED_RECAP],
44
+ onFailure: action_types_1.RecapTypes.MARK_RECAP_READ_FAILURE,
45
+ });
46
+ }
47
+ function regenerateRecap(recapId) {
48
+ return (0, helpers_1.bindClientFunc)({
49
+ clientFunc: () => client_1.Client4.regenerateRecap(recapId),
50
+ onRequest: action_types_1.RecapTypes.REGENERATE_RECAP_REQUEST,
51
+ onSuccess: [action_types_1.RecapTypes.REGENERATE_RECAP_SUCCESS, action_types_1.RecapTypes.RECEIVED_RECAP],
52
+ onFailure: action_types_1.RecapTypes.REGENERATE_RECAP_FAILURE,
53
+ });
54
+ }
55
+ function deleteRecap(recapId) {
56
+ return async (dispatch, getState) => {
57
+ dispatch({ type: action_types_1.RecapTypes.DELETE_RECAP_REQUEST, data: recapId });
58
+ try {
59
+ await client_1.Client4.deleteRecap(recapId);
60
+ dispatch({
61
+ type: action_types_1.RecapTypes.DELETE_RECAP_SUCCESS,
62
+ data: { recapId },
63
+ });
64
+ return { data: true };
65
+ }
66
+ catch (error) {
67
+ dispatch((0, errors_1.logError)(error));
68
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
69
+ dispatch({
70
+ type: action_types_1.RecapTypes.DELETE_RECAP_FAILURE,
71
+ error,
72
+ });
73
+ return { error };
74
+ }
75
+ };
76
+ }
@@ -98,6 +98,7 @@ declare const _default: import("redux").Reducer<{
98
98
  [key: string]: import("@mattermost/types/preferences").PreferencesType;
99
99
  };
100
100
  };
101
+ recaps: import("./recaps").RecapsState;
101
102
  typing: import("@mattermost/types/typing").Typing;
102
103
  integrations: {
103
104
  incomingHooks: import("@mattermost/types/utilities").IDMappedObjects<import("@mattermost/types/integrations").IncomingWebhook>;
@@ -470,6 +471,7 @@ declare const _default: import("redux").Reducer<{
470
471
  myPreferences: Record<string, import("@mattermost/types/preferences").PreferenceType> | undefined;
471
472
  userPreferences: Record<string, import("@mattermost/types/preferences").PreferencesType> | undefined;
472
473
  }> | undefined;
474
+ recaps: import("./recaps").RecapsState | undefined;
473
475
  typing: import("@mattermost/types/typing").Typing | undefined;
474
476
  integrations: {
475
477
  incomingHooks: import("@mattermost/types/utilities").IDMappedObjects<import("@mattermost/types/integrations").IncomingWebhook>;
@@ -25,6 +25,7 @@ const jobs_1 = __importDefault(require("./jobs"));
25
25
  const limits_1 = __importDefault(require("./limits"));
26
26
  const posts_1 = __importDefault(require("./posts"));
27
27
  const preferences_1 = __importDefault(require("./preferences"));
28
+ const recaps_1 = __importDefault(require("./recaps"));
28
29
  const roles_1 = __importDefault(require("./roles"));
29
30
  const scheduled_posts_1 = __importDefault(require("./scheduled_posts"));
30
31
  const schemes_1 = __importDefault(require("./schemes"));
@@ -45,6 +46,7 @@ exports.default = (0, redux_1.combineReducers)({
45
46
  posts: posts_1.default,
46
47
  files: files_1.default,
47
48
  preferences: preferences_1.default,
49
+ recaps: recaps_1.default,
48
50
  typing: typing_1.default,
49
51
  integrations: integrations_1.default,
50
52
  emojis: emojis_1.default,
@@ -130,6 +130,46 @@ function nextPostsReplies(state = {}, action) {
130
130
  return state;
131
131
  }
132
132
  }
133
+ // Helper function to remove posts and permalink embeds for a set of channel IDs.
134
+ function removePostsAndEmbedsForChannels(state, channelIds) {
135
+ let postModified = false;
136
+ const nextState = { ...state };
137
+ for (const post of Object.values(state)) {
138
+ // Remove posts from the channels
139
+ if (channelIds.has(post.channel_id)) {
140
+ Reflect.deleteProperty(nextState, post.id);
141
+ postModified = true;
142
+ continue;
143
+ }
144
+ // Remove permalink embeds referencing those channels (matches server behavior)
145
+ if (post.metadata?.embeds?.length) {
146
+ const newEmbeds = [];
147
+ let embedRemoved = false;
148
+ for (const embed of post.metadata.embeds) {
149
+ if (embed.type === 'permalink' && embed.data && channelIds.has(embed.data.channel_id)) {
150
+ embedRemoved = true;
151
+ }
152
+ else {
153
+ newEmbeds.push(embed);
154
+ }
155
+ }
156
+ if (embedRemoved) {
157
+ nextState[post.id] = {
158
+ ...nextState[post.id],
159
+ metadata: {
160
+ ...nextState[post.id].metadata,
161
+ embeds: newEmbeds,
162
+ },
163
+ };
164
+ postModified = true;
165
+ }
166
+ }
167
+ }
168
+ if (!postModified) {
169
+ return state;
170
+ }
171
+ return nextState;
172
+ }
133
173
  function handlePosts(state = {}, action) {
134
174
  switch (action.type) {
135
175
  case action_types_1.PostTypes.RECEIVED_POST:
@@ -299,20 +339,14 @@ function handlePosts(state = {}, action) {
299
339
  }
300
340
  case action_types_1.ChannelTypes.LEAVE_CHANNEL: {
301
341
  const channelId = action.data.id;
302
- let postDeleted = false;
303
- // Remove any posts from the channel left by the user
304
- const nextState = { ...state };
305
- for (const post of Object.values(state)) {
306
- if (post.channel_id === channelId) {
307
- Reflect.deleteProperty(nextState, post.id);
308
- postDeleted = true;
309
- }
310
- }
311
- if (!postDeleted) {
312
- // Nothing changed
342
+ return removePostsAndEmbedsForChannels(state, new Set([channelId]));
343
+ }
344
+ case action_types_1.TeamTypes.LEAVE_TEAM: {
345
+ const channelIds = action.data.channelIds || [];
346
+ if (channelIds.length === 0) {
313
347
  return state;
314
348
  }
315
- return nextState;
349
+ return removePostsAndEmbedsForChannels(state, new Set(channelIds));
316
350
  }
317
351
  case action_types_1.ThreadTypes.FOLLOW_CHANGED_THREAD: {
318
352
  const { id, following } = action.data;
@@ -0,0 +1,7 @@
1
+ import type { Recap } from '@mattermost/types/recaps';
2
+ import type { MMReduxAction } from 'mattermost-redux/action_types';
3
+ export type RecapsState = {
4
+ byId: Record<string, Recap>;
5
+ allIds: string[];
6
+ };
7
+ export default function recapsReducer(state: RecapsState | undefined, action: MMReduxAction): RecapsState;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
+ // See LICENSE.txt for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.default = recapsReducer;
6
+ const action_types_1 = require("mattermost-redux/action_types");
7
+ const initialState = {
8
+ byId: {},
9
+ allIds: [],
10
+ };
11
+ function recapsReducer(state = initialState, action) {
12
+ switch (action.type) {
13
+ case action_types_1.RecapTypes.RECEIVED_RECAP: {
14
+ const recap = action.data;
15
+ const nextState = { ...state };
16
+ nextState.byId = {
17
+ ...state.byId,
18
+ [recap.id]: recap,
19
+ };
20
+ if (!state.allIds.includes(recap.id)) {
21
+ nextState.allIds = [...state.allIds, recap.id];
22
+ }
23
+ return nextState;
24
+ }
25
+ case action_types_1.RecapTypes.RECEIVED_RECAPS: {
26
+ const recaps = action.data;
27
+ const nextState = { ...state };
28
+ const newById = { ...state.byId };
29
+ const newAllIds = new Set(state.allIds);
30
+ recaps.forEach((recap) => {
31
+ newById[recap.id] = recap;
32
+ newAllIds.add(recap.id);
33
+ });
34
+ nextState.byId = newById;
35
+ nextState.allIds = Array.from(newAllIds);
36
+ return nextState;
37
+ }
38
+ case action_types_1.RecapTypes.DELETE_RECAP_SUCCESS: {
39
+ const { recapId } = action.data;
40
+ const nextState = { ...state };
41
+ const newById = { ...state.byId };
42
+ delete newById[recapId];
43
+ nextState.byId = newById;
44
+ nextState.allIds = state.allIds.filter((id) => id !== recapId);
45
+ return nextState;
46
+ }
47
+ case action_types_1.UserTypes.LOGOUT_SUCCESS:
48
+ return initialState;
49
+ default:
50
+ return state;
51
+ }
52
+ }
@@ -100,6 +100,7 @@ declare const _default: {
100
100
  [key: string]: import("@mattermost/types/preferences").PreferencesType;
101
101
  };
102
102
  };
103
+ recaps: import("./entities/recaps").RecapsState;
103
104
  typing: import("@mattermost/types/typing").Typing;
104
105
  integrations: {
105
106
  incomingHooks: import("@mattermost/types/utilities").IDMappedObjects<import("@mattermost/types/integrations").IncomingWebhook>;
@@ -472,6 +473,7 @@ declare const _default: {
472
473
  myPreferences: Record<string, import("@mattermost/types/preferences").PreferenceType> | undefined;
473
474
  userPreferences: Record<string, import("@mattermost/types/preferences").PreferencesType> | undefined;
474
475
  }> | undefined;
476
+ recaps: import("./entities/recaps").RecapsState | undefined;
475
477
  typing: import("@mattermost/types/typing").Typing | undefined;
476
478
  integrations: {
477
479
  incomingHooks: import("@mattermost/types/utilities").IDMappedObjects<import("@mattermost/types/integrations").IncomingWebhook>;
@@ -0,0 +1,11 @@
1
+ import type { Recap } from '@mattermost/types/recaps';
2
+ import { RecapStatus } from '@mattermost/types/recaps';
3
+ import type { GlobalState } from '@mattermost/types/store';
4
+ export declare function getAllRecaps(state: GlobalState): Recap[];
5
+ export declare function getRecap(state: GlobalState, recapId: string): Recap | undefined;
6
+ export declare const getRecapsByStatus: import("mattermost-redux/selectors/create_selector").OutputParametricSelector<GlobalState, RecapStatus, Recap[], (res1: Recap[], res2: RecapStatus) => Recap[]>;
7
+ export declare const getSortedRecaps: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, Recap[], (res: Recap[]) => Recap[]>;
8
+ export declare const getCompletedRecaps: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, Recap[], (res: Recap[]) => Recap[]>;
9
+ export declare const getPendingRecaps: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, Recap[], (res: Recap[]) => Recap[]>;
10
+ export declare const getUnreadRecaps: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, Recap[], (res: Recap[]) => Recap[]>;
11
+ export declare const getReadRecaps: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, Recap[], (res: Recap[]) => Recap[]>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
+ // See LICENSE.txt for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getReadRecaps = exports.getUnreadRecaps = exports.getPendingRecaps = exports.getCompletedRecaps = exports.getSortedRecaps = exports.getRecapsByStatus = void 0;
6
+ exports.getAllRecaps = getAllRecaps;
7
+ exports.getRecap = getRecap;
8
+ const recaps_1 = require("@mattermost/types/recaps");
9
+ const create_selector_1 = require("mattermost-redux/selectors/create_selector");
10
+ function getAllRecaps(state) {
11
+ const { byId, allIds } = state.entities.recaps;
12
+ return allIds.map((id) => byId[id]);
13
+ }
14
+ function getRecap(state, recapId) {
15
+ return state.entities.recaps.byId[recapId] || undefined;
16
+ }
17
+ exports.getRecapsByStatus = (0, create_selector_1.createSelector)('getRecapsByStatus', getAllRecaps, (_state, status) => status, (recaps, status) => {
18
+ return recaps.filter((recap) => recap.status === status);
19
+ });
20
+ exports.getSortedRecaps = (0, create_selector_1.createSelector)('getSortedRecaps', getAllRecaps, (recaps) => {
21
+ return [...recaps].sort((a, b) => b.create_at - a.create_at);
22
+ });
23
+ exports.getCompletedRecaps = (0, create_selector_1.createSelector)('getCompletedRecaps', getAllRecaps, (recaps) => {
24
+ return recaps.filter((recap) => recap.status === recaps_1.RecapStatus.COMPLETED).sort((a, b) => b.create_at - a.create_at);
25
+ });
26
+ exports.getPendingRecaps = (0, create_selector_1.createSelector)('getPendingRecaps', getAllRecaps, (recaps) => {
27
+ return recaps.filter((recap) => recap.status === recaps_1.RecapStatus.PENDING || recap.status === recaps_1.RecapStatus.PROCESSING);
28
+ });
29
+ exports.getUnreadRecaps = (0, create_selector_1.createSelector)('getUnreadRecaps', getAllRecaps, (recaps) => {
30
+ return recaps.filter((recap) => recap.read_at === 0).sort((a, b) => b.create_at - a.create_at);
31
+ });
32
+ exports.getReadRecaps = (0, create_selector_1.createSelector)('getReadRecaps', getAllRecaps, (recaps) => {
33
+ return recaps.filter((recap) => recap.read_at > 0).sort((a, b) => b.read_at - a.read_at);
34
+ });
@@ -100,6 +100,10 @@ const state = {
100
100
  counts: {},
101
101
  countsIncludingDirect: {},
102
102
  },
103
+ recaps: {
104
+ byId: {},
105
+ allIds: [],
106
+ },
103
107
  preferences: {
104
108
  myPreferences: {},
105
109
  userPreferences: {},
@@ -60,8 +60,9 @@ function checkDialogElementForError(elem, value) {
60
60
  if (value && value.length < elem.min_length) {
61
61
  return (0, react_intl_1.defineMessage)({
62
62
  id: 'interactive_dialog.error.too_short',
63
+ // minLength provided by InteractiveDialog
64
+ // eslint-disable-next-line formatjs/enforce-placeholders
63
65
  defaultMessage: 'Minimum input length is {minLength}.',
64
- values: { minLength: elem.min_length },
65
66
  });
66
67
  }
67
68
  if (elem.subtype === 'email') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-redux",
3
- "version": "11.3.0",
3
+ "version": "11.4.0",
4
4
  "description": "Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client",
5
5
  "keywords": [
6
6
  "mattermost"
@@ -39,8 +39,8 @@
39
39
  "directory": "webapp/platform/mattermost-redux"
40
40
  },
41
41
  "dependencies": {
42
- "@mattermost/client": "11.3.0",
43
- "@mattermost/types": "11.3.0",
42
+ "@mattermost/client": "11.4.0",
43
+ "@mattermost/types": "11.4.0",
44
44
  "@redux-devtools/extension": "3.3.0",
45
45
  "lodash": "^4.17.21",
46
46
  "moment-timezone": "^0.5.38",