mattermost-redux 11.6.0 → 11.7.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.
Files changed (40) hide show
  1. package/lib/action_types/channel_categories.d.ts +3 -0
  2. package/lib/action_types/channel_categories.js +3 -0
  3. package/lib/action_types/index.d.ts +2 -1
  4. package/lib/action_types/index.js +3 -1
  5. package/lib/action_types/properties.d.ts +10 -0
  6. package/lib/action_types/properties.js +20 -0
  7. package/lib/actions/access_control.d.ts +15 -12
  8. package/lib/actions/access_control.js +61 -43
  9. package/lib/actions/channel_categories.d.ts +20 -1
  10. package/lib/actions/channel_categories.js +137 -3
  11. package/lib/actions/jobs.d.ts +1 -1
  12. package/lib/actions/jobs.js +2 -1
  13. package/lib/actions/users.js +8 -8
  14. package/lib/constants/channel_categories.d.ts +2 -0
  15. package/lib/constants/channel_categories.js +4 -1
  16. package/lib/constants/general.d.ts +0 -1
  17. package/lib/constants/general.js +1 -2
  18. package/lib/constants/permissions.d.ts +3 -0
  19. package/lib/constants/permissions.js +3 -0
  20. package/lib/reducers/entities/channel_categories.d.ts +4 -0
  21. package/lib/reducers/entities/channel_categories.js +45 -0
  22. package/lib/reducers/entities/index.d.ts +17 -0
  23. package/lib/reducers/entities/index.js +2 -0
  24. package/lib/reducers/entities/properties.d.ts +11 -0
  25. package/lib/reducers/entities/properties.js +201 -0
  26. package/lib/reducers/index.d.ts +17 -0
  27. package/lib/selectors/entities/channel_categories.d.ts +8 -2
  28. package/lib/selectors/entities/channel_categories.js +100 -16
  29. package/lib/selectors/entities/general.d.ts +2 -0
  30. package/lib/selectors/entities/general.js +8 -0
  31. package/lib/selectors/entities/properties.d.ts +17 -0
  32. package/lib/selectors/entities/properties.js +67 -0
  33. package/lib/selectors/entities/shared_channels.d.ts +1 -1
  34. package/lib/selectors/entities/shared_channels.js +1 -1
  35. package/lib/selectors/entities/users.js +1 -1
  36. package/lib/store/initial_state.js +6 -0
  37. package/lib/utils/property_utils.d.ts +2 -0
  38. package/lib/utils/property_utils.js +11 -0
  39. package/lib/utils/user_utils.js +0 -1
  40. package/package.json +3 -3
@@ -5,5 +5,8 @@ declare const _default: {
5
5
  CATEGORY_COLLAPSED: "CATEGORY_COLLAPSED";
6
6
  CATEGORY_EXPANDED: "CATEGORY_EXPANDED";
7
7
  CATEGORY_DELETED: "CATEGORY_DELETED";
8
+ RECEIVED_MANAGED_CATEGORY_MAPPINGS: "RECEIVED_MANAGED_CATEGORY_MAPPINGS";
9
+ MANAGED_CATEGORY_MAPPING_SET: "MANAGED_CATEGORY_MAPPING_SET";
10
+ MANAGED_CATEGORY_MAPPING_REMOVED: "MANAGED_CATEGORY_MAPPING_REMOVED";
8
11
  };
9
12
  export default _default;
@@ -13,4 +13,7 @@ exports.default = (0, key_mirror_1.default)({
13
13
  CATEGORY_COLLAPSED: null,
14
14
  CATEGORY_EXPANDED: null,
15
15
  CATEGORY_DELETED: null,
16
+ RECEIVED_MANAGED_CATEGORY_MAPPINGS: null,
17
+ MANAGED_CATEGORY_MAPPING_SET: null,
18
+ MANAGED_CATEGORY_MAPPING_REMOVED: null,
16
19
  });
@@ -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 PropertyTypes from './properties';
25
26
  import RecapTypes from './recaps';
26
27
  import RoleTypes from './roles';
27
28
  import SchemeTypes from './schemes';
@@ -32,7 +33,7 @@ import TeamTypes from './teams';
32
33
  import ThreadTypes from './threads';
33
34
  import UserTypes from './users';
34
35
  import WebSocketTypes from './websocket';
35
- 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, WebSocketTypes, };
36
+ 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, PropertyTypes, AgentTypes, WebSocketTypes, };
36
37
  /**
37
38
  * An MMReduxAction is any non-Thunk Redux action accepted by mattermost-redux.
38
39
  */
@@ -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.WebSocketTypes = 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;
8
+ exports.WebSocketTypes = exports.AgentTypes = exports.PropertyTypes = 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 properties_1 = __importDefault(require("./properties"));
56
+ exports.PropertyTypes = properties_1.default;
55
57
  const recaps_1 = __importDefault(require("./recaps"));
56
58
  exports.RecapTypes = recaps_1.default;
57
59
  const roles_1 = __importDefault(require("./roles"));
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ RECEIVED_PROPERTY_FIELDS: "RECEIVED_PROPERTY_FIELDS";
3
+ PROPERTY_FIELD_DELETED: "PROPERTY_FIELD_DELETED";
4
+ RECEIVED_PROPERTY_VALUES: "RECEIVED_PROPERTY_VALUES";
5
+ PROPERTY_VALUE_DELETED: "PROPERTY_VALUE_DELETED";
6
+ PROPERTY_VALUES_DELETED_FOR_FIELD: "PROPERTY_VALUES_DELETED_FOR_FIELD";
7
+ PROPERTY_VALUES_DELETED_FOR_TARGET: "PROPERTY_VALUES_DELETED_FOR_TARGET";
8
+ RECEIVED_PROPERTY_GROUP: "RECEIVED_PROPERTY_GROUP";
9
+ };
10
+ export default _default;
@@ -0,0 +1,20 @@
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
+ // Field actions
11
+ RECEIVED_PROPERTY_FIELDS: null,
12
+ PROPERTY_FIELD_DELETED: null,
13
+ // Value actions
14
+ RECEIVED_PROPERTY_VALUES: null,
15
+ PROPERTY_VALUE_DELETED: null,
16
+ PROPERTY_VALUES_DELETED_FOR_FIELD: null,
17
+ PROPERTY_VALUES_DELETED_FOR_TARGET: null,
18
+ // Group actions
19
+ RECEIVED_PROPERTY_GROUP: null,
20
+ });
@@ -1,20 +1,23 @@
1
1
  import type { AccessControlPoliciesResult, AccessControlPolicy, AccessControlPolicyActiveUpdate, AccessControlTestResult } from '@mattermost/types/access_control';
2
2
  import type { ChannelSearchOpts, ChannelsWithTotalCount } from '@mattermost/types/channels';
3
3
  import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
4
- export declare function getAccessControlPolicy(id: string, channelId?: string): ActionFuncAsync<AccessControlPolicy, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
5
- export declare function createAccessControlPolicy(policy: AccessControlPolicy): ActionFuncAsync<AccessControlPolicy>;
6
- export declare function deleteAccessControlPolicy(id: string): ActionFuncAsync<AccessControlPolicy, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
4
+ export declare function getAccessControlPolicy(id: string, channelId?: string, teamId?: string): ActionFuncAsync<AccessControlPolicy, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
5
+ export declare function createAccessControlPolicy(policy: AccessControlPolicy, teamId?: string): ActionFuncAsync<AccessControlPolicy>;
6
+ export declare function deleteAccessControlPolicy(id: string, teamId?: string): ActionFuncAsync<AccessControlPolicy, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
7
7
  export declare function searchAccessControlPolicies(term: string, type: string, after: string, limit: number): ActionFuncAsync<AccessControlPoliciesResult>;
8
- export declare function searchAccessControlPolicyChannels(id: string, term: string, opts: ChannelSearchOpts): ActionFuncAsync<ChannelsWithTotalCount>;
9
- export declare function assignChannelsToAccessControlPolicy(policyId: string, channelIds: string[]): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
10
- export declare function unassignChannelsFromAccessControlPolicy(policyId: string, channelIds: string[]): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
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 searchUsersForExpression(expression: string, term: string, after: string, limit: number, channelId?: string): ActionFuncAsync<AccessControlTestResult>;
13
- export declare function getVisualAST(expression: string, channelId?: string): ActionFuncAsync<import("@mattermost/types/access_control").AccessControlVisualAST, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
14
- export declare function validateExpressionAgainstRequester(expression: string, channelId?: string): ActionFuncAsync<{
8
+ export declare function searchPermissionPolicies(term: string, after: string, limit: number): ActionFuncAsync<AccessControlPoliciesResult>;
9
+ export declare function searchTeamAccessControlPolicies(teamId: string, term: string, type: string, after: string, limit: number): ActionFuncAsync<AccessControlPoliciesResult>;
10
+ export declare function searchAccessControlPolicyChannels(id: string, term: string, opts: ChannelSearchOpts, teamId?: string): ActionFuncAsync<ChannelsWithTotalCount>;
11
+ export declare function assignChannelsToAccessControlPolicy(policyId: string, channelIds: string[], teamId?: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
12
+ export declare function unassignChannelsFromAccessControlPolicy(policyId: string, channelIds: string[], teamId?: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
13
+ export declare function getAccessControlFields(after: string, limit: number, channelId?: string, teamId?: string): ActionFuncAsync<import("@mattermost/types/properties").UserPropertyField[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
14
+ export declare function searchUsersForExpression(expression: string, term: string, after: string, limit: number, channelId?: string, teamId?: string): ActionFuncAsync<AccessControlTestResult>;
15
+ export declare function getVisualAST(expression: string, channelId?: string, teamId?: string): ActionFuncAsync<import("@mattermost/types/access_control").AccessControlVisualAST, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
16
+ export declare function validateExpressionAgainstRequester(expression: string, channelId?: string, teamId?: string): ActionFuncAsync<{
15
17
  requester_matches: boolean;
16
18
  }>;
17
19
  export declare function createAccessControlSyncJob(jobData: {
18
- policy_id: string;
20
+ policy_id?: string;
21
+ team_id?: string;
19
22
  }): ActionFuncAsync<any>;
20
- export declare function updateAccessControlPoliciesActive(states: AccessControlPolicyActiveUpdate[]): ActionFuncAsync<AccessControlPolicy[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
23
+ export declare function updateAccessControlPoliciesActive(states: AccessControlPolicyActiveUpdate[], teamId?: string): ActionFuncAsync<AccessControlPolicy[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
@@ -6,6 +6,8 @@ exports.getAccessControlPolicy = getAccessControlPolicy;
6
6
  exports.createAccessControlPolicy = createAccessControlPolicy;
7
7
  exports.deleteAccessControlPolicy = deleteAccessControlPolicy;
8
8
  exports.searchAccessControlPolicies = searchAccessControlPolicies;
9
+ exports.searchPermissionPolicies = searchPermissionPolicies;
10
+ exports.searchTeamAccessControlPolicies = searchTeamAccessControlPolicies;
9
11
  exports.searchAccessControlPolicyChannels = searchAccessControlPolicyChannels;
10
12
  exports.assignChannelsToAccessControlPolicy = assignChannelsToAccessControlPolicy;
11
13
  exports.unassignChannelsFromAccessControlPolicy = unassignChannelsFromAccessControlPolicy;
@@ -19,21 +21,18 @@ const redux_batched_actions_1 = require("redux-batched-actions");
19
21
  const action_types_1 = require("mattermost-redux/action_types");
20
22
  const client_1 = require("mattermost-redux/client");
21
23
  const helpers_1 = require("./helpers");
22
- function getAccessControlPolicy(id, channelId) {
24
+ function getAccessControlPolicy(id, channelId, teamId) {
23
25
  return (0, helpers_1.bindClientFunc)({
24
- clientFunc: client_1.Client4.getAccessControlPolicy,
26
+ clientFunc: () => client_1.Client4.getAccessControlPolicy(id, channelId, teamId),
25
27
  onSuccess: [action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_POLICY],
26
- params: [
27
- id,
28
- channelId,
29
- ],
28
+ params: [],
30
29
  });
31
30
  }
32
- function createAccessControlPolicy(policy) {
31
+ function createAccessControlPolicy(policy, teamId) {
33
32
  return async (dispatch, getState) => {
34
33
  let data;
35
34
  try {
36
- data = await client_1.Client4.updateOrCreateAccessControlPolicy(policy);
35
+ data = await client_1.Client4.updateOrCreateAccessControlPolicy(policy, teamId);
37
36
  }
38
37
  catch (error) {
39
38
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -43,13 +42,11 @@ function createAccessControlPolicy(policy) {
43
42
  return { data };
44
43
  };
45
44
  }
46
- function deleteAccessControlPolicy(id) {
45
+ function deleteAccessControlPolicy(id, teamId) {
47
46
  return (0, helpers_1.bindClientFunc)({
48
- clientFunc: client_1.Client4.deleteAccessControlPolicy,
47
+ clientFunc: () => client_1.Client4.deleteAccessControlPolicy(id, teamId),
49
48
  onSuccess: [action_types_1.AdminTypes.DELETE_ACCESS_CONTROL_POLICY_SUCCESS],
50
- params: [
51
- id,
52
- ],
49
+ params: [],
53
50
  });
54
51
  }
55
52
  function searchAccessControlPolicies(term, type, after, limit) {
@@ -66,11 +63,42 @@ function searchAccessControlPolicies(term, type, after, limit) {
66
63
  return { data };
67
64
  };
68
65
  }
69
- function searchAccessControlPolicyChannels(id, term, opts) {
66
+ function searchPermissionPolicies(term, after, limit) {
70
67
  return async (dispatch, getState) => {
71
68
  let data;
72
69
  try {
73
- data = await client_1.Client4.searchChildAccessControlPolicyChannels(id, term, opts);
70
+ data = await client_1.Client4.searchPermissionPolicies(term, after, limit);
71
+ }
72
+ catch (error) {
73
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
74
+ return { error };
75
+ }
76
+ dispatch({ type: action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH, data: data.policies });
77
+ return { data };
78
+ };
79
+ }
80
+ function searchTeamAccessControlPolicies(teamId, term, type, after, limit) {
81
+ return async (dispatch, getState) => {
82
+ if (!teamId) {
83
+ return { error: new Error('teamId is required for team-scoped policy search') };
84
+ }
85
+ let data;
86
+ try {
87
+ data = await client_1.Client4.searchAccessControlPolicies(term, type, after, limit, teamId);
88
+ }
89
+ catch (error) {
90
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
91
+ return { error };
92
+ }
93
+ dispatch({ type: action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH, data: data.policies });
94
+ return { data };
95
+ };
96
+ }
97
+ function searchAccessControlPolicyChannels(id, term, opts, teamId) {
98
+ return async (dispatch, getState) => {
99
+ let data;
100
+ try {
101
+ data = await client_1.Client4.searchChildAccessControlPolicyChannels(id, term, opts, teamId);
74
102
  }
75
103
  catch (error) {
76
104
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -85,41 +113,31 @@ function searchAccessControlPolicyChannels(id, term, opts) {
85
113
  return { data };
86
114
  };
87
115
  }
88
- function assignChannelsToAccessControlPolicy(policyId, channelIds) {
116
+ function assignChannelsToAccessControlPolicy(policyId, channelIds, teamId) {
89
117
  return (0, helpers_1.bindClientFunc)({
90
- clientFunc: client_1.Client4.assignChannelsToAccessControlPolicy,
118
+ clientFunc: () => client_1.Client4.assignChannelsToAccessControlPolicy(policyId, channelIds, teamId),
91
119
  onSuccess: [action_types_1.AdminTypes.ASSIGN_CHANNELS_TO_ACCESS_CONTROL_POLICY_SUCCESS],
92
- params: [
93
- policyId,
94
- channelIds,
95
- ],
120
+ params: [],
96
121
  });
97
122
  }
98
- function unassignChannelsFromAccessControlPolicy(policyId, channelIds) {
123
+ function unassignChannelsFromAccessControlPolicy(policyId, channelIds, teamId) {
99
124
  return (0, helpers_1.bindClientFunc)({
100
- clientFunc: client_1.Client4.unassignChannelsFromAccessControlPolicy,
125
+ clientFunc: () => client_1.Client4.unassignChannelsFromAccessControlPolicy(policyId, channelIds, teamId),
101
126
  onSuccess: [action_types_1.AdminTypes.UNASSIGN_CHANNELS_FROM_ACCESS_CONTROL_POLICY_SUCCESS],
102
- params: [
103
- policyId,
104
- channelIds,
105
- ],
127
+ params: [],
106
128
  });
107
129
  }
108
- function getAccessControlFields(after, limit, channelId) {
130
+ function getAccessControlFields(after, limit, channelId, teamId) {
109
131
  return (0, helpers_1.bindClientFunc)({
110
- clientFunc: client_1.Client4.getAccessControlFields,
111
- params: [
112
- after,
113
- limit,
114
- channelId,
115
- ],
132
+ clientFunc: () => client_1.Client4.getAccessControlFields(after, limit, channelId, teamId),
133
+ params: [],
116
134
  });
117
135
  }
118
- function searchUsersForExpression(expression, term, after, limit, channelId) {
136
+ function searchUsersForExpression(expression, term, after, limit, channelId, teamId) {
119
137
  return async (dispatch, getState) => {
120
138
  let data;
121
139
  try {
122
- data = await client_1.Client4.testAccessControlExpression(expression, term, after, limit, channelId);
140
+ data = await client_1.Client4.testAccessControlExpression(expression, term, after, limit, channelId, teamId);
123
141
  }
124
142
  catch (error) {
125
143
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -129,17 +147,17 @@ function searchUsersForExpression(expression, term, after, limit, channelId) {
129
147
  return { data };
130
148
  };
131
149
  }
132
- function getVisualAST(expression, channelId) {
150
+ function getVisualAST(expression, channelId, teamId) {
133
151
  return (0, helpers_1.bindClientFunc)({
134
- clientFunc: client_1.Client4.expressionToVisualFormat,
135
- params: [expression, channelId],
152
+ clientFunc: () => client_1.Client4.expressionToVisualFormat(expression, channelId, teamId),
153
+ params: [],
136
154
  });
137
155
  }
138
- function validateExpressionAgainstRequester(expression, channelId) {
156
+ function validateExpressionAgainstRequester(expression, channelId, teamId) {
139
157
  return async (dispatch, getState) => {
140
158
  let data;
141
159
  try {
142
- data = await client_1.Client4.validateExpressionAgainstRequester(expression, channelId);
160
+ data = await client_1.Client4.validateExpressionAgainstRequester(expression, channelId, teamId);
143
161
  }
144
162
  catch (error) {
145
163
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -161,9 +179,9 @@ function createAccessControlSyncJob(jobData) {
161
179
  return { data };
162
180
  };
163
181
  }
164
- function updateAccessControlPoliciesActive(states) {
182
+ function updateAccessControlPoliciesActive(states, teamId) {
165
183
  return (0, helpers_1.bindClientFunc)({
166
184
  clientFunc: client_1.Client4.updateAccessControlPoliciesActive,
167
- params: [states],
185
+ params: [states, teamId],
168
186
  });
169
187
  }
@@ -1,12 +1,13 @@
1
1
  import type { ChannelCategory } from '@mattermost/types/channel_categories';
2
2
  import { CategorySorting } from '@mattermost/types/channel_categories';
3
3
  import type { Channel } from '@mattermost/types/channels';
4
+ import type { PropertyValuesUpdated } from '@mattermost/types/properties';
5
+ import type { Team } from '@mattermost/types/teams';
4
6
  import type { ActionFuncAsync, ThunkActionFunc } from 'mattermost-redux/types/actions';
5
7
  export declare function setCategoryCollapsed(categoryId: string, collapsed: boolean): ActionFuncAsync;
6
8
  export declare function setCategorySorting(categoryId: string, sorting: CategorySorting): ActionFuncAsync;
7
9
  export declare function patchCategory(categoryId: string, patch: Partial<ChannelCategory>): ActionFuncAsync;
8
10
  export declare function setCategoryMuted(categoryId: string, muted: boolean): ActionFuncAsync;
9
- export declare function fetchMyCategories(teamId: string, isWebSocket?: boolean): ThunkActionFunc<unknown>;
10
11
  export declare function addChannelToInitialCategory(channel: Channel, setOnServer?: boolean): ActionFuncAsync;
11
12
  export declare function addChannelToCategory(categoryId: string, channelId: string): ActionFuncAsync;
12
13
  export declare function moveChannelToCategory(categoryId: string, channelId: string, newIndex: number, setManualSorting?: boolean): ActionFuncAsync;
@@ -22,3 +23,21 @@ export declare function receivedCategoryOrder(teamId: string, order: string[]):
22
23
  export declare function createCategory(teamId: string, displayName: string, channelIds?: Array<Channel['id']>): ActionFuncAsync<ChannelCategory>;
23
24
  export declare function renameCategory(categoryId: string, displayName: string): ActionFuncAsync;
24
25
  export declare function deleteCategory(categoryId: string): ActionFuncAsync;
26
+ export declare function addChannelToManagedCategory(teamId: Team['id'], channelId: Channel['id'], categoryName: string): {
27
+ type: "MANAGED_CATEGORY_MAPPING_SET";
28
+ data: {
29
+ id: string;
30
+ team_id: string;
31
+ category_name: string;
32
+ };
33
+ };
34
+ export declare function removeChannelFromManagedCategory(teamId: Team['id'], channelId: Channel['id']): {
35
+ type: "MANAGED_CATEGORY_MAPPING_REMOVED";
36
+ data: {
37
+ id: string;
38
+ team_id: string;
39
+ };
40
+ };
41
+ export declare function fetchChannelManagedCategoryMapping(channel: Channel): ActionFuncAsync;
42
+ export declare function handleManagedCategoryPropertyValuesUpdated(parsedPropertyValuesUpdated: PropertyValuesUpdated<string>): ThunkActionFunc<void>;
43
+ export declare function fetchMyCategories(teamId: string, isWebSocket?: boolean): ThunkActionFunc<unknown>;
@@ -6,7 +6,6 @@ exports.setCategoryCollapsed = setCategoryCollapsed;
6
6
  exports.setCategorySorting = setCategorySorting;
7
7
  exports.patchCategory = patchCategory;
8
8
  exports.setCategoryMuted = setCategoryMuted;
9
- exports.fetchMyCategories = fetchMyCategories;
10
9
  exports.addChannelToInitialCategory = addChannelToInitialCategory;
11
10
  exports.addChannelToCategory = addChannelToCategory;
12
11
  exports.moveChannelToCategory = moveChannelToCategory;
@@ -16,6 +15,11 @@ exports.receivedCategoryOrder = receivedCategoryOrder;
16
15
  exports.createCategory = createCategory;
17
16
  exports.renameCategory = renameCategory;
18
17
  exports.deleteCategory = deleteCategory;
18
+ exports.addChannelToManagedCategory = addChannelToManagedCategory;
19
+ exports.removeChannelFromManagedCategory = removeChannelFromManagedCategory;
20
+ exports.fetchChannelManagedCategoryMapping = fetchChannelManagedCategoryMapping;
21
+ exports.handleManagedCategoryPropertyValuesUpdated = handleManagedCategoryPropertyValuesUpdated;
22
+ exports.fetchMyCategories = fetchMyCategories;
19
23
  const redux_batched_actions_1 = require("redux-batched-actions");
20
24
  const channel_categories_1 = require("@mattermost/types/channel_categories");
21
25
  const action_types_1 = require("mattermost-redux/action_types");
@@ -24,6 +28,8 @@ const helpers_1 = require("mattermost-redux/actions/helpers");
24
28
  const client_1 = require("mattermost-redux/client");
25
29
  const channel_categories_2 = require("mattermost-redux/constants/channel_categories");
26
30
  const channel_categories_3 = require("mattermost-redux/selectors/entities/channel_categories");
31
+ const channels_1 = require("mattermost-redux/selectors/entities/channels");
32
+ const properties_1 = require("mattermost-redux/selectors/entities/properties");
27
33
  const users_1 = require("mattermost-redux/selectors/entities/users");
28
34
  const array_utils_1 = require("mattermost-redux/utils/array_utils");
29
35
  const constants_1 = require("../constants");
@@ -110,7 +116,7 @@ function updateCategory(category) {
110
116
  return { data: updatedCategory };
111
117
  };
112
118
  }
113
- function fetchMyCategories(teamId, isWebSocket) {
119
+ function fetchNonManagedCategories(teamId, isWebSocket) {
114
120
  return async (dispatch, getState) => {
115
121
  const currentUserId = (0, users_1.getCurrentUserId)(getState());
116
122
  let data;
@@ -166,6 +172,9 @@ function addChannelToInitialCategory(channel, setOnServer = false) {
166
172
  })),
167
173
  });
168
174
  }
175
+ if ((0, channel_categories_3.areManagedCategoriesEnabled)(state)) {
176
+ dispatch(fetchChannelManagedCategoryMapping(channel));
177
+ }
169
178
  // Add the new channel to the Channels category on the channel's team
170
179
  if (categories.some((category) => category.channel_ids.some((channelId) => channelId === channel.id))) {
171
180
  return { data: false };
@@ -320,7 +329,7 @@ function moveChannelsToCategory(categoryId, channelIds, newIndex, setManualSorti
320
329
  function moveCategory(teamId, categoryId, newIndex) {
321
330
  return async (dispatch, getState) => {
322
331
  const state = getState();
323
- const order = (0, channel_categories_3.getCategoryIdsForTeam)(state, teamId);
332
+ const order = (0, channel_categories_3.getNonManagedCategoryOrderForTeam)(state, teamId);
324
333
  const currentUserId = (0, users_1.getCurrentUserId)(state);
325
334
  const newOrder = (0, array_utils_1.insertWithoutDuplicates)(order, categoryId, newIndex);
326
335
  // Optimistically update the category order
@@ -402,3 +411,128 @@ function deleteCategory(categoryId) {
402
411
  return { data: true };
403
412
  };
404
413
  }
414
+ function addChannelToManagedCategory(teamId, channelId, categoryName) {
415
+ return {
416
+ type: action_types_1.ChannelCategoryTypes.MANAGED_CATEGORY_MAPPING_SET,
417
+ data: {
418
+ id: channelId,
419
+ team_id: teamId,
420
+ category_name: categoryName,
421
+ },
422
+ };
423
+ }
424
+ function removeChannelFromManagedCategory(teamId, channelId) {
425
+ return {
426
+ type: action_types_1.ChannelCategoryTypes.MANAGED_CATEGORY_MAPPING_REMOVED,
427
+ data: {
428
+ id: channelId,
429
+ team_id: teamId,
430
+ },
431
+ };
432
+ }
433
+ function fetchChannelManagedCategoryMapping(channel) {
434
+ return async (dispatch, getState) => {
435
+ try {
436
+ const values = await client_1.Client4.getPropertyValues(channel_categories_2.ManagedCategoryPropertyGroupName, 'channel', channel.id);
437
+ const categoryValue = values[0];
438
+ if (categoryValue && channel.team_id) {
439
+ dispatch(addChannelToManagedCategory(channel.team_id, channel.id, categoryValue.value));
440
+ }
441
+ }
442
+ catch (error) {
443
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
444
+ dispatch((0, errors_1.logError)(error));
445
+ }
446
+ return { data: true };
447
+ };
448
+ }
449
+ function handleManagedCategoryPropertyValuesUpdated(parsedPropertyValuesUpdated) {
450
+ return (doDispatch, doGetState) => {
451
+ const state = doGetState();
452
+ if (!(0, channel_categories_3.areManagedCategoriesEnabled)(state)) {
453
+ return;
454
+ }
455
+ if (!parsedPropertyValuesUpdated.target_id) {
456
+ return;
457
+ }
458
+ if (!parsedPropertyValuesUpdated.values?.length) {
459
+ return;
460
+ }
461
+ const first = parsedPropertyValuesUpdated.values[0];
462
+ const propertyGroup = (0, properties_1.getPropertyGroupById)(state, first.group_id);
463
+ const propertyField = (0, properties_1.getPropertyFieldById)(state, first.field_id);
464
+ if (propertyField?.name !== channel_categories_2.ManagedCategoryPropertyFieldName || propertyGroup?.name !== channel_categories_2.ManagedCategoryPropertyGroupName) {
465
+ return;
466
+ }
467
+ const categoryName = first.value;
468
+ const teamId = (0, channels_1.getChannel)(doGetState(), parsedPropertyValuesUpdated.target_id)?.team_id;
469
+ if (!teamId) {
470
+ return;
471
+ }
472
+ if (categoryName) {
473
+ doDispatch(addChannelToManagedCategory(teamId, parsedPropertyValuesUpdated.target_id, categoryName));
474
+ }
475
+ else {
476
+ doDispatch(removeChannelFromManagedCategory(teamId, parsedPropertyValuesUpdated.target_id));
477
+ }
478
+ };
479
+ }
480
+ function fetchManagedCategories(teamId) {
481
+ return async (dispatch, getState) => {
482
+ if (!(0, channel_categories_3.areManagedCategoriesEnabled)(getState())) {
483
+ return {};
484
+ }
485
+ const state = getState();
486
+ const propertyGroup = (0, properties_1.getPropertyGroupByName)(state, channel_categories_2.ManagedCategoryPropertyGroupName);
487
+ if (!propertyGroup) {
488
+ try {
489
+ const fields = await client_1.Client4.getPropertyFields(channel_categories_2.ManagedCategoryPropertyGroupName, 'channel', 'system');
490
+ if (fields.length === 0) {
491
+ return { error: new Error(`No property fields found for ${channel_categories_2.ManagedCategoryPropertyGroupName}`) };
492
+ }
493
+ dispatch((0, redux_batched_actions_1.batchActions)([
494
+ {
495
+ type: action_types_1.PropertyTypes.RECEIVED_PROPERTY_FIELDS,
496
+ data: { fields },
497
+ },
498
+ {
499
+ type: action_types_1.PropertyTypes.RECEIVED_PROPERTY_GROUP,
500
+ data: {
501
+ id: fields[0].group_id,
502
+ name: channel_categories_2.ManagedCategoryPropertyGroupName,
503
+ },
504
+ },
505
+ ]));
506
+ }
507
+ catch (error) {
508
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
509
+ dispatch((0, errors_1.logError)(error));
510
+ return { error };
511
+ }
512
+ }
513
+ try {
514
+ const managedMappings = await client_1.Client4.getManagedCategories(teamId);
515
+ return dispatch({
516
+ type: action_types_1.ChannelCategoryTypes.RECEIVED_MANAGED_CATEGORY_MAPPINGS,
517
+ data: {
518
+ team_id: teamId,
519
+ mappings: managedMappings,
520
+ },
521
+ });
522
+ }
523
+ catch (error) {
524
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
525
+ dispatch((0, errors_1.logError)(error));
526
+ return { error };
527
+ }
528
+ };
529
+ }
530
+ function fetchMyCategories(teamId, isWebSocket) {
531
+ return async (dispatch) => {
532
+ const [nonManagedResult] = await Promise.all([
533
+ dispatch(fetchNonManagedCategories(teamId, isWebSocket)),
534
+ dispatch(fetchManagedCategories(teamId)),
535
+ ]);
536
+ return nonManagedResult;
537
+ };
538
+ }
@@ -22,5 +22,5 @@ export declare function getJob(id: string): import("../types/actions").ActionFun
22
22
  data: any;
23
23
  }, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
24
24
  export declare function getJobs(page?: number, perPage?: number): import("../types/actions").ActionFuncAsync<import("@mattermost/types/jobs").Job[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
25
- export declare function getJobsByType(type: JobType, page?: number, perPage?: number): import("../types/actions").ActionFuncAsync<import("@mattermost/types/jobs").Job[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
25
+ export declare function getJobsByType(type: JobType, page?: number, perPage?: number, teamId?: string): import("../types/actions").ActionFuncAsync<import("@mattermost/types/jobs").Job[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
26
26
  export declare function cancelJob(job: string): import("../types/actions").ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
@@ -39,7 +39,7 @@ function getJobs(page = 0, perPage = constants_1.General.JOBS_CHUNK_SIZE) {
39
39
  ],
40
40
  });
41
41
  }
42
- function getJobsByType(type, page = 0, perPage = constants_1.General.JOBS_CHUNK_SIZE) {
42
+ function getJobsByType(type, page = 0, perPage = constants_1.General.JOBS_CHUNK_SIZE, teamId) {
43
43
  return (0, helpers_1.bindClientFunc)({
44
44
  clientFunc: client_1.Client4.getJobsByType,
45
45
  onSuccess: [action_types_1.JobTypes.RECEIVED_JOBS, action_types_1.JobTypes.RECEIVED_JOBS_BY_TYPE],
@@ -47,6 +47,7 @@ function getJobsByType(type, page = 0, perPage = constants_1.General.JOBS_CHUNK_
47
47
  type,
48
48
  page,
49
49
  perPage,
50
+ teamId,
50
51
  ],
51
52
  });
52
53
  }
@@ -656,19 +656,19 @@ function getStatusesByIds(userIds) {
656
656
  }
657
657
  function setStatus(status) {
658
658
  return async (dispatch, getState) => {
659
- let recievedStatus;
659
+ let receivedStatus;
660
660
  try {
661
- recievedStatus = await client_1.Client4.updateStatus(status);
661
+ receivedStatus = await client_1.Client4.updateStatus(status);
662
662
  }
663
663
  catch (error) {
664
664
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
665
665
  dispatch((0, errors_1.logError)(error));
666
666
  return { error };
667
667
  }
668
- const updatedStatus = { [recievedStatus.user_id]: recievedStatus.status };
669
- const dndEndTimes = { [recievedStatus.user_id]: recievedStatus?.dnd_end_time ?? 0 };
670
- const isManualStatus = { [recievedStatus.user_id]: recievedStatus?.manual ?? false };
671
- const lastActivity = { [recievedStatus.user_id]: recievedStatus?.last_activity_at ?? 0 };
668
+ const updatedStatus = { [receivedStatus.user_id]: receivedStatus.status };
669
+ const dndEndTimes = { [receivedStatus.user_id]: receivedStatus?.dnd_end_time ?? 0 };
670
+ const isManualStatus = { [receivedStatus.user_id]: receivedStatus?.manual ?? false };
671
+ const lastActivity = { [receivedStatus.user_id]: receivedStatus?.last_activity_at ?? 0 };
672
672
  dispatch((0, redux_batched_actions_1.batchActions)([
673
673
  {
674
674
  type: action_types_1.UserTypes.RECEIVED_STATUSES,
@@ -687,7 +687,7 @@ function setStatus(status) {
687
687
  data: lastActivity,
688
688
  },
689
689
  ], 'BATCHING_STATUS'));
690
- return { data: recievedStatus };
690
+ return { data: receivedStatus };
691
691
  };
692
692
  }
693
693
  function setCustomStatus(customStatus) {
@@ -919,7 +919,7 @@ function saveCustomProfileAttribute(userID, attributeID, attributeValue) {
919
919
  }
920
920
  catch (error) {
921
921
  // Extract user-friendly error message from server response
922
- let errorMessage = 'Failed to update custom profile attribute';
922
+ let errorMessage = 'Failed to update user attribute';
923
923
  if (error && typeof error === 'object' && 'message' in error && error.message) {
924
924
  errorMessage = error.message;
925
925
  }
@@ -2,3 +2,5 @@ import type { ChannelCategoryType } from '@mattermost/types/channel_categories';
2
2
  export declare const CategoryTypes: {
3
3
  [name: string]: ChannelCategoryType;
4
4
  };
5
+ export declare const ManagedCategoryPropertyGroupName = "managed_channel_categories";
6
+ export declare const ManagedCategoryPropertyFieldName = "category_name";
@@ -2,10 +2,13 @@
2
2
  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
3
3
  // See LICENSE.txt for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.CategoryTypes = void 0;
5
+ exports.ManagedCategoryPropertyFieldName = exports.ManagedCategoryPropertyGroupName = exports.CategoryTypes = void 0;
6
6
  exports.CategoryTypes = {
7
7
  FAVORITES: 'favorites',
8
8
  CHANNELS: 'channels',
9
9
  DIRECT_MESSAGES: 'direct_messages',
10
10
  CUSTOM: 'custom',
11
+ MANAGED: 'managed',
11
12
  };
13
+ exports.ManagedCategoryPropertyGroupName = 'managed_channel_categories';
14
+ exports.ManagedCategoryPropertyFieldName = 'category_name';
@@ -33,7 +33,6 @@ declare const _default: {
33
33
  SYSTEM_READ_ONLY_ADMIN_ROLE: string;
34
34
  SYSTEM_MANAGER_ROLE: string;
35
35
  SHARED_CHANNEL_MANAGER_ROLE: string;
36
- SECURE_CONNECTION_MANAGER_ROLE: string;
37
36
  SYSTEM_USER_ACCESS_TOKEN_ROLE: string;
38
37
  SYSTEM_POST_ALL_ROLE: string;
39
38
  SYSTEM_POST_ALL_PUBLIC_ROLE: string;