mattermost-redux 10.8.0 → 10.10.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 (67) hide show
  1. package/lib/action_types/admin.d.ts +8 -0
  2. package/lib/action_types/admin.js +8 -0
  3. package/lib/action_types/general.d.ts +3 -0
  4. package/lib/action_types/general.js +3 -0
  5. package/lib/action_types/index.d.ts +2 -1
  6. package/lib/action_types/index.js +3 -1
  7. package/lib/action_types/integrations.d.ts +1 -0
  8. package/lib/action_types/integrations.js +1 -0
  9. package/lib/action_types/shared_channels.d.ts +5 -0
  10. package/lib/action_types/shared_channels.js +12 -0
  11. package/lib/action_types/users.d.ts +1 -0
  12. package/lib/action_types/users.js +1 -0
  13. package/lib/actions/access_control.d.ts +14 -0
  14. package/lib/actions/access_control.js +142 -0
  15. package/lib/actions/admin.d.ts +7 -1
  16. package/lib/actions/admin.js +51 -0
  17. package/lib/actions/channels.d.ts +5 -2
  18. package/lib/actions/channels.js +38 -22
  19. package/lib/actions/general.d.ts +1 -0
  20. package/lib/actions/general.js +22 -0
  21. package/lib/actions/integrations.js +3 -1
  22. package/lib/actions/posts.d.ts +1 -1
  23. package/lib/actions/posts.js +33 -7
  24. package/lib/actions/shared_channels.d.ts +18 -0
  25. package/lib/actions/shared_channels.js +80 -0
  26. package/lib/actions/users.d.ts +1 -1
  27. package/lib/actions/users.js +2 -2
  28. package/lib/constants/general.d.ts +1 -1
  29. package/lib/constants/general.js +1 -1
  30. package/lib/constants/permissions.d.ts +2 -0
  31. package/lib/constants/permissions.js +2 -0
  32. package/lib/constants/permissions_sysconsole.d.ts +4 -0
  33. package/lib/constants/permissions_sysconsole.js +6 -0
  34. package/lib/constants/preferences.d.ts +1 -0
  35. package/lib/constants/preferences.js +1 -0
  36. package/lib/reducers/entities/admin.d.ts +3 -0
  37. package/lib/reducers/entities/admin.js +60 -0
  38. package/lib/reducers/entities/general.d.ts +2 -0
  39. package/lib/reducers/entities/general.js +15 -0
  40. package/lib/reducers/entities/index.d.ts +8 -0
  41. package/lib/reducers/entities/index.js +2 -0
  42. package/lib/reducers/entities/integrations.d.ts +1 -0
  43. package/lib/reducers/entities/integrations.js +10 -0
  44. package/lib/reducers/entities/shared_channels.d.ts +9 -0
  45. package/lib/reducers/entities/shared_channels.js +41 -0
  46. package/lib/reducers/entities/users.js +18 -0
  47. package/lib/reducers/index.d.ts +8 -0
  48. package/lib/selectors/create_selector/index.js +2 -82
  49. package/lib/selectors/entities/access_control.d.ts +8 -0
  50. package/lib/selectors/entities/access_control.js +44 -0
  51. package/lib/selectors/entities/channel_banner.d.ts +1 -0
  52. package/lib/selectors/entities/channel_banner.js +11 -4
  53. package/lib/selectors/entities/general.d.ts +2 -0
  54. package/lib/selectors/entities/general.js +4 -0
  55. package/lib/selectors/entities/integrations.d.ts +1 -0
  56. package/lib/selectors/entities/integrations.js +4 -0
  57. package/lib/selectors/entities/report_a_problem.d.ts +3 -0
  58. package/lib/selectors/entities/report_a_problem.js +46 -0
  59. package/lib/selectors/entities/shared_channels.d.ts +6 -0
  60. package/lib/selectors/entities/shared_channels.js +25 -0
  61. package/lib/store/initial_state.js +3 -0
  62. package/lib/utils/browser_info.d.ts +5 -0
  63. package/lib/utils/browser_info.js +96 -0
  64. package/lib/utils/user_utils.js +2 -6
  65. package/package.json +3 -3
  66. package/lib/selectors/entities/hosted_customer.d.ts +0 -4
  67. package/lib/selectors/entities/hosted_customer.js +0 -12
@@ -47,5 +47,13 @@ declare const _default: {
47
47
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_TEAMS_FAILURE: "REMOVE_DATA_RETENTION_CUSTOM_POLICY_TEAMS_FAILURE";
48
48
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_SUCCESS: "REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_SUCCESS";
49
49
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_FAILURE: "REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_FAILURE";
50
+ RECEIVED_ACCESS_CONTROL_POLICIES: "RECEIVED_ACCESS_CONTROL_POLICIES";
51
+ RECEIVED_ACCESS_CONTROL_POLICY: "RECEIVED_ACCESS_CONTROL_POLICY";
52
+ CREATE_ACCESS_CONTROL_POLICY_SUCCESS: "CREATE_ACCESS_CONTROL_POLICY_SUCCESS";
53
+ DELETE_ACCESS_CONTROL_POLICY_SUCCESS: "DELETE_ACCESS_CONTROL_POLICY_SUCCESS";
54
+ RECEIVED_ACCESS_CONTROL_CHILD_POLICIES: "RECEIVED_ACCESS_CONTROL_CHILD_POLICIES";
55
+ RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH: "RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH";
56
+ ASSIGN_CHANNELS_TO_ACCESS_CONTROL_POLICY_SUCCESS: "ASSIGN_CHANNELS_TO_ACCESS_CONTROL_POLICY_SUCCESS";
57
+ UNASSIGN_CHANNELS_FROM_ACCESS_CONTROL_POLICY_SUCCESS: "UNASSIGN_CHANNELS_FROM_ACCESS_CONTROL_POLICY_SUCCESS";
50
58
  };
51
59
  export default _default;
@@ -55,4 +55,12 @@ exports.default = (0, key_mirror_1.default)({
55
55
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_TEAMS_FAILURE: null,
56
56
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_SUCCESS: null,
57
57
  REMOVE_DATA_RETENTION_CUSTOM_POLICY_CHANNELS_FAILURE: null,
58
+ RECEIVED_ACCESS_CONTROL_POLICIES: null,
59
+ RECEIVED_ACCESS_CONTROL_POLICY: null,
60
+ CREATE_ACCESS_CONTROL_POLICY_SUCCESS: null,
61
+ DELETE_ACCESS_CONTROL_POLICY_SUCCESS: null,
62
+ RECEIVED_ACCESS_CONTROL_CHILD_POLICIES: null,
63
+ RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH: null,
64
+ ASSIGN_CHANNELS_TO_ACCESS_CONTROL_POLICY_SUCCESS: null,
65
+ UNASSIGN_CHANNELS_FROM_ACCESS_CONTROL_POLICY_SUCCESS: null,
58
66
  });
@@ -21,5 +21,8 @@ declare const _default: {
21
21
  FIRST_ADMIN_VISIT_MARKETPLACE_STATUS_RECEIVED: "FIRST_ADMIN_VISIT_MARKETPLACE_STATUS_RECEIVED";
22
22
  FIRST_ADMIN_COMPLETE_SETUP_RECEIVED: "FIRST_ADMIN_COMPLETE_SETUP_RECEIVED";
23
23
  SHOW_LAUNCHING_WORKSPACE: "SHOW_LAUNCHING_WORKSPACE";
24
+ CWS_AVAILABILITY_CHECK_REQUEST: "CWS_AVAILABILITY_CHECK_REQUEST";
25
+ CWS_AVAILABILITY_CHECK_SUCCESS: "CWS_AVAILABILITY_CHECK_SUCCESS";
26
+ CWS_AVAILABILITY_CHECK_FAILURE: "CWS_AVAILABILITY_CHECK_FAILURE";
24
27
  };
25
28
  export default _default;
@@ -29,4 +29,7 @@ exports.default = (0, key_mirror_1.default)({
29
29
  FIRST_ADMIN_VISIT_MARKETPLACE_STATUS_RECEIVED: null,
30
30
  FIRST_ADMIN_COMPLETE_SETUP_RECEIVED: null,
31
31
  SHOW_LAUNCHING_WORKSPACE: null,
32
+ CWS_AVAILABILITY_CHECK_REQUEST: null,
33
+ CWS_AVAILABILITY_CHECK_SUCCESS: null,
34
+ CWS_AVAILABILITY_CHECK_FAILURE: null,
32
35
  });
@@ -24,10 +24,11 @@ import RoleTypes from './roles';
24
24
  import SchemeTypes from './schemes';
25
25
  import ScheduledPostTypes from './scheudled_posts';
26
26
  import SearchTypes from './search';
27
+ import SharedChannelTypes from './shared_channels';
27
28
  import TeamTypes from './teams';
28
29
  import ThreadTypes from './threads';
29
30
  import UserTypes from './users';
30
- 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, };
31
+ 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, };
31
32
  /**
32
33
  * An MMReduxAction is any non-Thunk Redux action accepted by mattermost-redux.
33
34
  */
@@ -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.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.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;
9
9
  const admin_1 = __importDefault(require("./admin"));
10
10
  exports.AdminTypes = admin_1.default;
11
11
  const apps_1 = __importDefault(require("./apps"));
@@ -56,6 +56,8 @@ const scheudled_posts_1 = __importDefault(require("./scheudled_posts"));
56
56
  exports.ScheduledPostTypes = scheudled_posts_1.default;
57
57
  const search_1 = __importDefault(require("./search"));
58
58
  exports.SearchTypes = search_1.default;
59
+ const shared_channels_1 = __importDefault(require("./shared_channels"));
60
+ exports.SharedChannelTypes = shared_channels_1.default;
59
61
  const teams_1 = __importDefault(require("./teams"));
60
62
  exports.TeamTypes = teams_1.default;
61
63
  const threads_1 = __importDefault(require("./threads"));
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  RECEIVED_OUTGOING_OAUTH_CONNECTION: "RECEIVED_OUTGOING_OAUTH_CONNECTION";
21
21
  DELETED_OUTGOING_OAUTH_CONNECTION: "DELETED_OUTGOING_OAUTH_CONNECTION";
22
22
  RECEIVED_DIALOG_TRIGGER_ID: "RECEIVED_DIALOG_TRIGGER_ID";
23
+ RECEIVED_DIALOG_ARGUMENTS: "RECEIVED_DIALOG_ARGUMENTS";
23
24
  RECEIVED_DIALOG: "RECEIVED_DIALOG";
24
25
  };
25
26
  export default _default;
@@ -28,5 +28,6 @@ exports.default = (0, key_mirror_1.default)({
28
28
  RECEIVED_OUTGOING_OAUTH_CONNECTION: null,
29
29
  DELETED_OUTGOING_OAUTH_CONNECTION: null,
30
30
  RECEIVED_DIALOG_TRIGGER_ID: null,
31
+ RECEIVED_DIALOG_ARGUMENTS: null,
31
32
  RECEIVED_DIALOG: null,
32
33
  });
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ RECEIVED_CHANNEL_REMOTES: "RECEIVED_CHANNEL_REMOTES";
3
+ RECEIVED_REMOTE_CLUSTER_INFO: "RECEIVED_REMOTE_CLUSTER_INFO";
4
+ };
5
+ export default _default;
@@ -0,0 +1,12 @@
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
+ RECEIVED_CHANNEL_REMOTES: null,
11
+ RECEIVED_REMOTE_CLUSTER_INFO: null,
12
+ });
@@ -61,5 +61,6 @@ declare const _default: {
61
61
  RECEIVED_FILTERED_USER_STATS: "RECEIVED_FILTERED_USER_STATS";
62
62
  PROFILE_NO_LONGER_VISIBLE: "PROFILE_NO_LONGER_VISIBLE";
63
63
  LOGIN: "LOGIN";
64
+ CLEAR_CPA_VALUES: "CLEAR_CPA_VALUES";
64
65
  };
65
66
  export default _default;
@@ -69,4 +69,5 @@ exports.default = (0, key_mirror_1.default)({
69
69
  RECEIVED_FILTERED_USER_STATS: null,
70
70
  PROFILE_NO_LONGER_VISIBLE: null,
71
71
  LOGIN: null,
72
+ CLEAR_CPA_VALUES: null,
72
73
  });
@@ -0,0 +1,14 @@
1
+ import type { AccessControlPoliciesResult, AccessControlPolicy, AccessControlTestResult } from '@mattermost/types/access_control';
2
+ import type { ChannelSearchOpts, ChannelsWithTotalCount } from '@mattermost/types/channels';
3
+ import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
4
+ export declare function getAccessControlPolicy(id: 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>;
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): 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
+ export declare function searchUsersForExpression(expression: string, term: string, after: string, limit: number): ActionFuncAsync<AccessControlTestResult>;
14
+ export declare function getVisualAST(expression: string): ActionFuncAsync<import("@mattermost/types/access_control").AccessControlVisualAST, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
@@ -0,0 +1,142 @@
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.getAccessControlPolicy = getAccessControlPolicy;
6
+ exports.createAccessControlPolicy = createAccessControlPolicy;
7
+ exports.deleteAccessControlPolicy = deleteAccessControlPolicy;
8
+ exports.searchAccessControlPolicies = searchAccessControlPolicies;
9
+ exports.searchAccessControlPolicyChannels = searchAccessControlPolicyChannels;
10
+ exports.assignChannelsToAccessControlPolicy = assignChannelsToAccessControlPolicy;
11
+ exports.unassignChannelsFromAccessControlPolicy = unassignChannelsFromAccessControlPolicy;
12
+ exports.getAccessControlFields = getAccessControlFields;
13
+ exports.updateAccessControlPolicyActive = updateAccessControlPolicyActive;
14
+ exports.searchUsersForExpression = searchUsersForExpression;
15
+ exports.getVisualAST = getVisualAST;
16
+ const redux_batched_actions_1 = require("redux-batched-actions");
17
+ const action_types_1 = require("mattermost-redux/action_types");
18
+ const client_1 = require("mattermost-redux/client");
19
+ const helpers_1 = require("./helpers");
20
+ function getAccessControlPolicy(id) {
21
+ return (0, helpers_1.bindClientFunc)({
22
+ clientFunc: client_1.Client4.getAccessControlPolicy,
23
+ onSuccess: [action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_POLICY],
24
+ params: [
25
+ id,
26
+ ],
27
+ });
28
+ }
29
+ function createAccessControlPolicy(policy) {
30
+ return async (dispatch, getState) => {
31
+ let data;
32
+ try {
33
+ data = await client_1.Client4.updateOrCreateAccessControlPolicy(policy);
34
+ }
35
+ catch (error) {
36
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
37
+ return { error };
38
+ }
39
+ dispatch({ type: action_types_1.AdminTypes.CREATE_ACCESS_CONTROL_POLICY_SUCCESS, data });
40
+ return { data };
41
+ };
42
+ }
43
+ function deleteAccessControlPolicy(id) {
44
+ return (0, helpers_1.bindClientFunc)({
45
+ clientFunc: client_1.Client4.deleteAccessControlPolicy,
46
+ onSuccess: [action_types_1.AdminTypes.DELETE_ACCESS_CONTROL_POLICY_SUCCESS],
47
+ params: [
48
+ id,
49
+ ],
50
+ });
51
+ }
52
+ function searchAccessControlPolicies(term, type, after, limit) {
53
+ return async (dispatch, getState) => {
54
+ let data;
55
+ try {
56
+ data = await client_1.Client4.searchAccessControlPolicies(term, type, after, limit);
57
+ }
58
+ catch (error) {
59
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
60
+ return { error };
61
+ }
62
+ dispatch({ type: action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_POLICIES_SEARCH, data: data.policies });
63
+ return { data };
64
+ };
65
+ }
66
+ function searchAccessControlPolicyChannels(id, term, opts) {
67
+ return async (dispatch, getState) => {
68
+ let data;
69
+ try {
70
+ data = await client_1.Client4.searchChildAccessControlPolicyChannels(id, term, opts);
71
+ }
72
+ catch (error) {
73
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
74
+ return { error };
75
+ }
76
+ const childs = {};
77
+ childs[id] = data.channels.map((channel) => channel.id);
78
+ dispatch((0, redux_batched_actions_1.batchActions)([
79
+ { type: action_types_1.AdminTypes.RECEIVED_ACCESS_CONTROL_CHILD_POLICIES, data: childs },
80
+ { type: action_types_1.ChannelTypes.RECEIVED_CHANNELS, data: data.channels },
81
+ ]));
82
+ return { data };
83
+ };
84
+ }
85
+ function assignChannelsToAccessControlPolicy(policyId, channelIds) {
86
+ return (0, helpers_1.bindClientFunc)({
87
+ clientFunc: client_1.Client4.assignChannelsToAccessControlPolicy,
88
+ onSuccess: [action_types_1.AdminTypes.ASSIGN_CHANNELS_TO_ACCESS_CONTROL_POLICY_SUCCESS],
89
+ params: [
90
+ policyId,
91
+ channelIds,
92
+ ],
93
+ });
94
+ }
95
+ function unassignChannelsFromAccessControlPolicy(policyId, channelIds) {
96
+ return (0, helpers_1.bindClientFunc)({
97
+ clientFunc: client_1.Client4.unassignChannelsFromAccessControlPolicy,
98
+ onSuccess: [action_types_1.AdminTypes.UNASSIGN_CHANNELS_FROM_ACCESS_CONTROL_POLICY_SUCCESS],
99
+ params: [
100
+ policyId,
101
+ channelIds,
102
+ ],
103
+ });
104
+ }
105
+ function getAccessControlFields(after, limit) {
106
+ return (0, helpers_1.bindClientFunc)({
107
+ clientFunc: client_1.Client4.getAccessControlFields,
108
+ params: [
109
+ after,
110
+ limit,
111
+ ],
112
+ });
113
+ }
114
+ function updateAccessControlPolicyActive(policyId, active) {
115
+ return (0, helpers_1.bindClientFunc)({
116
+ clientFunc: client_1.Client4.updateAccessControlPolicyActive,
117
+ params: [
118
+ policyId,
119
+ active,
120
+ ],
121
+ });
122
+ }
123
+ function searchUsersForExpression(expression, term, after, limit) {
124
+ return async (dispatch, getState) => {
125
+ let data;
126
+ try {
127
+ data = await client_1.Client4.testAccessControlExpression(expression, term, after, limit);
128
+ }
129
+ catch (error) {
130
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
131
+ return { error };
132
+ }
133
+ dispatch({ type: action_types_1.UserTypes.RECEIVED_PROFILES, data: data.users });
134
+ return { data };
135
+ };
136
+ }
137
+ function getVisualAST(expression) {
138
+ return (0, helpers_1.bindClientFunc)({
139
+ clientFunc: client_1.Client4.expressionToVisualFormat,
140
+ params: [expression],
141
+ });
142
+ }
@@ -1,7 +1,7 @@
1
1
  import type { LogFilter } from '@mattermost/types/admin';
2
2
  import type { Channel, ChannelSearchOpts } from '@mattermost/types/channels';
3
3
  import type { Compliance } from '@mattermost/types/compliance';
4
- import type { AdminConfig, AllowedIPRange } from '@mattermost/types/config';
4
+ import type { AdminConfig, AllowedIPRange, LdapSettings } from '@mattermost/types/config';
5
5
  import type { CreateDataRetentionCustomPolicy, DataRetentionCustomPolicies, GetDataRetentionCustomPoliciesRequest, PatchDataRetentionCustomPolicy } from '@mattermost/types/data_retention';
6
6
  import type { GroupSearchOpts } from '@mattermost/types/groups';
7
7
  import type { CompleteOnboardingRequest } from '@mattermost/types/setup';
@@ -27,6 +27,10 @@ export declare function uploadBrandImage(imageData: File): ActionFuncAsync<impor
27
27
  export declare function deleteBrandImage(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
28
28
  export declare function getClusterStatus(): ActionFuncAsync<import("@mattermost/types/admin").ClusterInfo[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
29
29
  export declare function testLdap(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
30
+ export declare function testLdapConnection(settings: LdapSettings): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
31
+ export declare function testLdapFilters(settings: LdapSettings): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
32
+ export declare function testLdapAttributes(settings: LdapSettings): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
33
+ export declare function testLdapGroupAttributes(settings: LdapSettings): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
30
34
  export declare function syncLdap(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
31
35
  export declare function getLdapGroups(page?: number, perPage?: number, opts?: GroupSearchOpts): ActionFuncAsync<{
32
36
  count: number;
@@ -40,6 +44,8 @@ export declare function uploadPrivateSamlCertificate(fileData: File): ActionFunc
40
44
  export declare function uploadPublicLdapCertificate(fileData: File): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
41
45
  export declare function uploadPrivateLdapCertificate(fileData: File): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
42
46
  export declare function uploadIdpSamlCertificate(fileData: File): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
47
+ export declare function uploadAuditCertificate(fileData: File): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
48
+ export declare function removeAuditCertificate(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
43
49
  export declare function removePublicSamlCertificate(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
44
50
  export declare function removePrivateSamlCertificate(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
45
51
  export declare function removePublicLdapCertificate(): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
@@ -21,6 +21,10 @@ exports.uploadBrandImage = uploadBrandImage;
21
21
  exports.deleteBrandImage = deleteBrandImage;
22
22
  exports.getClusterStatus = getClusterStatus;
23
23
  exports.testLdap = testLdap;
24
+ exports.testLdapConnection = testLdapConnection;
25
+ exports.testLdapFilters = testLdapFilters;
26
+ exports.testLdapAttributes = testLdapAttributes;
27
+ exports.testLdapGroupAttributes = testLdapGroupAttributes;
24
28
  exports.syncLdap = syncLdap;
25
29
  exports.getLdapGroups = getLdapGroups;
26
30
  exports.linkLdapGroup = linkLdapGroup;
@@ -31,6 +35,8 @@ exports.uploadPrivateSamlCertificate = uploadPrivateSamlCertificate;
31
35
  exports.uploadPublicLdapCertificate = uploadPublicLdapCertificate;
32
36
  exports.uploadPrivateLdapCertificate = uploadPrivateLdapCertificate;
33
37
  exports.uploadIdpSamlCertificate = uploadIdpSamlCertificate;
38
+ exports.uploadAuditCertificate = uploadAuditCertificate;
39
+ exports.removeAuditCertificate = removeAuditCertificate;
34
40
  exports.removePublicSamlCertificate = removePublicSamlCertificate;
35
41
  exports.removePrivateSamlCertificate = removePrivateSamlCertificate;
36
42
  exports.removePublicLdapCertificate = removePublicLdapCertificate;
@@ -230,6 +236,38 @@ function testLdap() {
230
236
  clientFunc: client_1.Client4.testLdap,
231
237
  });
232
238
  }
239
+ function testLdapConnection(settings) {
240
+ return (0, helpers_1.bindClientFunc)({
241
+ clientFunc: client_1.Client4.testLdapConnection,
242
+ params: [
243
+ settings,
244
+ ],
245
+ });
246
+ }
247
+ function testLdapFilters(settings) {
248
+ return (0, helpers_1.bindClientFunc)({
249
+ clientFunc: client_1.Client4.testLdapFilters,
250
+ params: [
251
+ settings,
252
+ ],
253
+ });
254
+ }
255
+ function testLdapAttributes(settings) {
256
+ return (0, helpers_1.bindClientFunc)({
257
+ clientFunc: client_1.Client4.testLdapAttributes,
258
+ params: [
259
+ settings,
260
+ ],
261
+ });
262
+ }
263
+ function testLdapGroupAttributes(settings) {
264
+ return (0, helpers_1.bindClientFunc)({
265
+ clientFunc: client_1.Client4.testLdapGroupAttributes,
266
+ params: [
267
+ settings,
268
+ ],
269
+ });
270
+ }
233
271
  function syncLdap() {
234
272
  return (0, helpers_1.bindClientFunc)({
235
273
  clientFunc: client_1.Client4.syncLdap,
@@ -334,6 +372,19 @@ function uploadIdpSamlCertificate(fileData) {
334
372
  ],
335
373
  });
336
374
  }
375
+ function uploadAuditCertificate(fileData) {
376
+ return (0, helpers_1.bindClientFunc)({
377
+ clientFunc: client_1.Client4.uploadAuditLogCertificate,
378
+ params: [
379
+ fileData,
380
+ ],
381
+ });
382
+ }
383
+ function removeAuditCertificate() {
384
+ return (0, helpers_1.bindClientFunc)({
385
+ clientFunc: client_1.Client4.removeAuditLogCertificate,
386
+ });
387
+ }
337
388
  function removePublicSamlCertificate() {
338
389
  return (0, helpers_1.bindClientFunc)({
339
390
  clientFunc: client_1.Client4.deletePublicSamlCertificate,
@@ -1,4 +1,5 @@
1
1
  import type { AnyAction } from 'redux';
2
+ import type { AccessControlAttributes } from '@mattermost/types/access_control';
2
3
  import type { Channel, ChannelNotifyProps, ChannelMembership, ChannelModerationPatch, ChannelsWithTotalCount, ChannelSearchOpts, ServerChannel, ChannelStats, ChannelWithTeamData } from '@mattermost/types/channels';
3
4
  import type { OptsSignalExt } from '@mattermost/types/client4';
4
5
  import type { GetStateFunc, ActionFunc, ActionFuncAsync } from 'mattermost-redux/types/actions';
@@ -40,8 +41,8 @@ export declare function unsetActiveChannelOnServer(): ActionFuncAsync;
40
41
  export declare function readMultipleChannels(channelIds: string[]): ActionFuncAsync;
41
42
  export declare function getChannels(teamId: string, page?: number, perPage?: number): ActionFuncAsync<Channel[]>;
42
43
  export declare function getArchivedChannels(teamId: string, page?: number, perPage?: number): ActionFuncAsync<Channel[]>;
43
- export declare function getAllChannelsWithCount(page?: number, perPage?: number, notAssociatedToGroup?: string, excludeDefaultChannels?: boolean, includeDeleted?: boolean, excludePolicyConstrained?: boolean): ActionFuncAsync<ChannelsWithTotalCount>;
44
- export declare function getAllChannels(page?: number, perPage?: number, notAssociatedToGroup?: string, excludeDefaultChannels?: boolean, excludePolicyConstrained?: boolean): ActionFuncAsync<ChannelWithTeamData[]>;
44
+ export declare function getAllChannelsWithCount(page?: number, perPage?: number, notAssociatedToGroup?: string, excludeDefaultChannels?: boolean, includeDeleted?: boolean, excludePolicyConstrained?: boolean, accessControlPolicyEnforced?: boolean, excludeAccessControlPolicyEnforced?: boolean): ActionFuncAsync<ChannelsWithTotalCount>;
45
+ export declare function getAllChannels(page?: number, perPage?: number, notAssociatedToGroup?: string, excludeDefaultChannels?: boolean, excludePolicyConstrained?: boolean, excludeAccessControlPolicyEnforced?: boolean, accessControlPolicyEnforced?: boolean): ActionFuncAsync<ChannelWithTeamData[]>;
45
46
  export declare function autocompleteChannels(teamId: string, term: string): ActionFuncAsync<Channel[]>;
46
47
  export declare function autocompleteChannelsForSearch(teamId: string, term: string): ActionFuncAsync<Channel[]>;
47
48
  export declare function searchChannels(teamId: string, term: string, archived?: boolean): ActionFuncAsync<Channel[]>;
@@ -91,6 +92,7 @@ export declare function getChannelMemberCountsByGroup(channelId: string): Action
91
92
  memberCounts: import("@mattermost/types/channels").ChannelMemberCountsByGroup;
92
93
  }, import("@mattermost/types/store").GlobalState, AnyAction>;
93
94
  export declare function fetchMissingChannels(channelIDs: string[]): ActionFuncAsync<Array<Channel['id']>>;
95
+ export declare function getChannelAccessControlAttributes(channelId: string): ActionFuncAsync<AccessControlAttributes>;
94
96
  declare const _default: {
95
97
  selectChannel: typeof selectChannel;
96
98
  createChannel: typeof createChannel;
@@ -120,5 +122,6 @@ declare const _default: {
120
122
  membersMinusGroupMembers: typeof membersMinusGroupMembers;
121
123
  getChannelModerations: typeof getChannelModerations;
122
124
  getChannelMemberCountsByGroup: typeof getChannelMemberCountsByGroup;
125
+ getChannelAccessControlAttributes: typeof getChannelAccessControlAttributes;
123
126
  };
124
127
  export default _default;
@@ -58,6 +58,7 @@ exports.getChannelModerations = getChannelModerations;
58
58
  exports.patchChannelModerations = patchChannelModerations;
59
59
  exports.getChannelMemberCountsByGroup = getChannelMemberCountsByGroup;
60
60
  exports.fetchMissingChannels = fetchMissingChannels;
61
+ exports.getChannelAccessControlAttributes = getChannelAccessControlAttributes;
61
62
  const redux_batched_actions_1 = require("redux-batched-actions");
62
63
  const action_types_1 = require("mattermost-redux/action_types");
63
64
  const client_1 = require("mattermost-redux/client");
@@ -411,8 +412,8 @@ function getChannelTimezones(channelId) {
411
412
  }
412
413
  function fetchChannelsAndMembers(teamId) {
413
414
  return async (dispatch, getState) => {
414
- let channels;
415
- let channelMembers;
415
+ let channels = [];
416
+ let channelMembers = [];
416
417
  try {
417
418
  [channels, channelMembers] = await Promise.all([
418
419
  client_1.Client4.getMyChannels(teamId),
@@ -451,32 +452,32 @@ function fetchAllMyChannelMembers() {
451
452
  return async (dispatch, getState) => {
452
453
  const state = getState();
453
454
  const { currentUserId } = state.entities.users;
454
- let channelsMembers = [];
455
- let hasMoreMembers = true;
456
- let page = 0;
455
+ let channelMembers = [];
457
456
  try {
458
- while (hasMoreMembers) {
459
- // Expected to disable since we don't have number of pages, so we can't use Promise.all
460
- // eslint-disable-next-line no-await-in-loop
461
- const data = await client_1.Client4.getAllChannelsMembers(currentUserId, page, 200);
462
- channelsMembers = [...channelsMembers, ...data];
463
- if (data.length < 200) {
464
- hasMoreMembers = false;
465
- }
466
- page++;
467
- }
457
+ // The server exposes a streaming API if page is set to -1
458
+ // We don't need to paginate through the responses, and thefore pageSize doesn't matter
459
+ channelMembers = await client_1.Client4.getAllChannelsMembers(currentUserId, -1);
468
460
  }
469
461
  catch (error) {
470
462
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
471
463
  dispatch((0, errors_1.logError)(error));
472
464
  return { error };
473
465
  }
466
+ const roles = new Set();
467
+ for (const member of channelMembers) {
468
+ for (const role of member.roles.split(' ')) {
469
+ roles.add(role);
470
+ }
471
+ }
472
+ if (roles.size > 0) {
473
+ dispatch((0, roles_1.loadRolesIfNeeded)(roles));
474
+ }
474
475
  dispatch({
475
476
  type: action_types_1.ChannelTypes.RECEIVED_MY_CHANNEL_MEMBERS,
476
- data: channelsMembers,
477
+ data: channelMembers,
477
478
  currentUserId,
478
479
  });
479
- return { data: channelsMembers };
480
+ return { data: channelMembers };
480
481
  };
481
482
  }
482
483
  function fetchAllMyTeamsChannels() {
@@ -491,7 +492,7 @@ function fetchAllMyTeamsChannels() {
491
492
  return { error };
492
493
  }
493
494
  dispatch({
494
- type: action_types_1.ChannelTypes.RECEIVED_ALL_CHANNELS,
495
+ type: action_types_1.ChannelTypes.RECEIVED_CHANNELS,
495
496
  data: channels,
496
497
  });
497
498
  return { data: channels };
@@ -735,12 +736,12 @@ function getArchivedChannels(teamId, page = 0, perPage = constants_1.General.CHA
735
736
  return { data: channels };
736
737
  };
737
738
  }
738
- function getAllChannelsWithCount(page = 0, perPage = constants_1.General.CHANNELS_CHUNK_SIZE, notAssociatedToGroup = '', excludeDefaultChannels = false, includeDeleted = false, excludePolicyConstrained = false) {
739
+ function getAllChannelsWithCount(page = 0, perPage = constants_1.General.CHANNELS_CHUNK_SIZE, notAssociatedToGroup = '', excludeDefaultChannels = false, includeDeleted = false, excludePolicyConstrained = false, accessControlPolicyEnforced = false, excludeAccessControlPolicyEnforced = false) {
739
740
  return async (dispatch, getState) => {
740
741
  dispatch({ type: action_types_1.ChannelTypes.GET_ALL_CHANNELS_REQUEST, data: null });
741
742
  let payload;
742
743
  try {
743
- payload = await client_1.Client4.getAllChannels(page, perPage, notAssociatedToGroup, excludeDefaultChannels, true, includeDeleted, excludePolicyConstrained);
744
+ payload = await client_1.Client4.getAllChannels(page, perPage, notAssociatedToGroup, excludeDefaultChannels, true, includeDeleted, excludePolicyConstrained, accessControlPolicyEnforced, excludeAccessControlPolicyEnforced);
744
745
  }
745
746
  catch (error) {
746
747
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -764,12 +765,12 @@ function getAllChannelsWithCount(page = 0, perPage = constants_1.General.CHANNEL
764
765
  return { data: payload };
765
766
  };
766
767
  }
767
- function getAllChannels(page = 0, perPage = constants_1.General.CHANNELS_CHUNK_SIZE, notAssociatedToGroup = '', excludeDefaultChannels = false, excludePolicyConstrained = false) {
768
+ function getAllChannels(page = 0, perPage = constants_1.General.CHANNELS_CHUNK_SIZE, notAssociatedToGroup = '', excludeDefaultChannels = false, excludePolicyConstrained = false, excludeAccessControlPolicyEnforced = false, accessControlPolicyEnforced = false) {
768
769
  return async (dispatch, getState) => {
769
770
  dispatch({ type: action_types_1.ChannelTypes.GET_ALL_CHANNELS_REQUEST, data: null });
770
771
  let channels;
771
772
  try {
772
- channels = await client_1.Client4.getAllChannels(page, perPage, notAssociatedToGroup, excludeDefaultChannels, false, false, excludePolicyConstrained);
773
+ channels = await client_1.Client4.getAllChannels(page, perPage, notAssociatedToGroup, excludeDefaultChannels, false, false, excludePolicyConstrained, accessControlPolicyEnforced, excludeAccessControlPolicyEnforced);
773
774
  }
774
775
  catch (error) {
775
776
  (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
@@ -1317,6 +1318,20 @@ function fetchMissingChannels(channelIDs) {
1317
1318
  };
1318
1319
  };
1319
1320
  }
1321
+ function getChannelAccessControlAttributes(channelId) {
1322
+ return async (dispatch, getState) => {
1323
+ let data;
1324
+ try {
1325
+ data = await client_1.Client4.getChannelAccessControlAttributes(channelId);
1326
+ }
1327
+ catch (error) {
1328
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
1329
+ dispatch((0, errors_1.logError)(error));
1330
+ return { error };
1331
+ }
1332
+ return { data };
1333
+ };
1334
+ }
1320
1335
  exports.default = {
1321
1336
  selectChannel,
1322
1337
  createChannel,
@@ -1346,4 +1361,5 @@ exports.default = {
1346
1361
  membersMinusGroupMembers,
1347
1362
  getChannelModerations,
1348
1363
  getChannelMemberCountsByGroup,
1364
+ getChannelAccessControlAttributes,
1349
1365
  };
@@ -12,6 +12,7 @@ export declare function setServerVersion(serverVersion: string): ActionFuncAsync
12
12
  export declare function setUrl(url: string): boolean;
13
13
  export declare function setFirstAdminVisitMarketplaceStatus(): ActionFuncAsync;
14
14
  export declare function getFirstAdminSetupComplete(): ActionFuncAsync<SystemSetting>;
15
+ export declare function checkCWSAvailability(): ActionFuncAsync;
15
16
  declare const _default: {
16
17
  getClientConfig: typeof getClientConfig;
17
18
  getLicenseConfig: typeof getLicenseConfig;
@@ -10,6 +10,7 @@ exports.setServerVersion = setServerVersion;
10
10
  exports.setUrl = setUrl;
11
11
  exports.setFirstAdminVisitMarketplaceStatus = setFirstAdminVisitMarketplaceStatus;
12
12
  exports.getFirstAdminSetupComplete = getFirstAdminSetupComplete;
13
+ exports.checkCWSAvailability = checkCWSAvailability;
13
14
  const redux_batched_actions_1 = require("redux-batched-actions");
14
15
  const client4_1 = require("@mattermost/types/client4");
15
16
  const action_types_1 = require("mattermost-redux/action_types");
@@ -99,6 +100,27 @@ function getFirstAdminSetupComplete() {
99
100
  return { data };
100
101
  };
101
102
  }
103
+ function checkCWSAvailability() {
104
+ return async (dispatch, getState) => {
105
+ const state = getState();
106
+ const config = state.entities.general.config;
107
+ const isEnterpriseReady = config.BuildEnterpriseReady === 'true';
108
+ if (!isEnterpriseReady) {
109
+ dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_SUCCESS, data: 'not_applicable' });
110
+ return { data: 'not_applicable' };
111
+ }
112
+ dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_REQUEST });
113
+ try {
114
+ await client_1.Client4.cwsAvailabilityCheck();
115
+ dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_SUCCESS, data: 'available' });
116
+ return { data: 'available' };
117
+ }
118
+ catch (error) {
119
+ dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_FAILURE });
120
+ return { data: 'unavailable' };
121
+ }
122
+ };
123
+ }
102
124
  exports.default = {
103
125
  getClientConfig,
104
126
  getLicenseConfig,
@@ -472,8 +472,10 @@ function deleteOutgoingOAuthConnection(id) {
472
472
  function submitInteractiveDialog(submission) {
473
473
  return async (dispatch, getState) => {
474
474
  const state = getState();
475
- submission.channel_id = (0, channels_1.getCurrentChannelId)(state);
475
+ // Use the current channel as fallback
476
+ submission.channel_id ||= (0, channels_1.getCurrentChannelId)(state);
476
477
  submission.team_id = (0, teams_1.getCurrentTeamId)(state);
478
+ submission.user_id = (0, users_1.getCurrentUserId)(state);
477
479
  let data;
478
480
  try {
479
481
  data = await client_1.Client4.submitInteractiveDialog(submission);
@@ -97,7 +97,7 @@ export declare function addReaction(postId: string, emojiName: string): ActionFu
97
97
  export declare function removeReaction(postId: string, emojiName: string): ActionFuncAsync<SubmitReactionReturnType>;
98
98
  export declare function getCustomEmojiForReaction(name: string): ActionFuncAsync;
99
99
  export declare function flagPost(postId: string): ActionFuncAsync;
100
- export declare function getPostThread(rootId: string, fetchThreads?: boolean): ActionFuncAsync<PostList>;
100
+ export declare function getPostThread(rootId: string, fetchThreads?: boolean, lastUpdateAt?: number): ActionFuncAsync<PostList>;
101
101
  export declare function getNewestPostThread(rootId: string): ActionFuncAsync;
102
102
  export declare function getPosts(channelId: string, page?: number, perPage?: number, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>;
103
103
  export declare function getPostsUnread(channelId: string, fetchThreads?: boolean, collapsedThreadsExtended?: boolean): ActionFuncAsync<PostList>;