mattermost-redux 11.1.0-2 → 11.2.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.
- package/lib/action_types/agents.d.ts +6 -0
- package/lib/action_types/agents.js +13 -0
- package/lib/action_types/index.d.ts +2 -1
- package/lib/action_types/index.js +3 -1
- package/lib/actions/agents.d.ts +1 -0
- package/lib/actions/agents.js +16 -0
- package/lib/actions/groups.d.ts +1 -1
- package/lib/actions/groups.js +1 -1
- package/lib/actions/status_profile_polling.d.ts +7 -0
- package/lib/actions/status_profile_polling.js +56 -26
- package/lib/constants/permissions.d.ts +4 -1
- package/lib/constants/permissions.js +4 -1
- package/lib/reducers/entities/agents.d.ts +10 -0
- package/lib/reducers/entities/agents.js +19 -0
- package/lib/reducers/entities/index.d.ts +8 -0
- package/lib/reducers/entities/index.js +2 -0
- package/lib/reducers/index.d.ts +8 -0
- package/lib/selectors/entities/access_control.d.ts +1 -1
- package/lib/selectors/entities/access_control.js +4 -7
- package/lib/selectors/entities/agents.d.ts +4 -0
- package/lib/selectors/entities/agents.js +13 -0
- package/lib/store/initial_state.js +3 -0
- package/lib/utils/file_utils.d.ts +1 -1
- package/lib/utils/file_utils.js +12 -2
- package/package.json +4 -4
|
@@ -0,0 +1,13 @@
|
|
|
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_AGENTS: null,
|
|
11
|
+
AGENTS_REQUEST: null,
|
|
12
|
+
AGENTS_FAILURE: null,
|
|
13
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AnyAction } from 'redux';
|
|
2
2
|
import AdminTypes from './admin';
|
|
3
|
+
import AgentTypes from './agents';
|
|
3
4
|
import AppsTypes from './apps';
|
|
4
5
|
import BotTypes from './bots';
|
|
5
6
|
import ChannelBookmarkTypes from './channel_bookmarks';
|
|
@@ -29,7 +30,7 @@ import SharedChannelTypes from './shared_channels';
|
|
|
29
30
|
import TeamTypes from './teams';
|
|
30
31
|
import ThreadTypes from './threads';
|
|
31
32
|
import UserTypes from './users';
|
|
32
|
-
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, };
|
|
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, };
|
|
33
34
|
/**
|
|
34
35
|
* An MMReduxAction is any non-Thunk Redux action accepted by mattermost-redux.
|
|
35
36
|
*/
|
|
@@ -5,9 +5,11 @@ 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.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.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
|
+
const agents_1 = __importDefault(require("./agents"));
|
|
12
|
+
exports.AgentTypes = agents_1.default;
|
|
11
13
|
const apps_1 = __importDefault(require("./apps"));
|
|
12
14
|
exports.AppsTypes = apps_1.default;
|
|
13
15
|
const bots_1 = __importDefault(require("./bots"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAgents(): import("../types/actions").ActionFuncAsync<import("@mattermost/types/agents").Agent[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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.getAgents = getAgents;
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const action_types_1 = require("../action_types");
|
|
8
|
+
const client_1 = require("../client");
|
|
9
|
+
function getAgents() {
|
|
10
|
+
return (0, helpers_1.bindClientFunc)({
|
|
11
|
+
clientFunc: client_1.Client4.getAgents,
|
|
12
|
+
onSuccess: [action_types_1.AgentTypes.RECEIVED_AGENTS],
|
|
13
|
+
onFailure: action_types_1.AgentTypes.AGENTS_FAILURE,
|
|
14
|
+
onRequest: action_types_1.AgentTypes.AGENTS_REQUEST,
|
|
15
|
+
});
|
|
16
|
+
}
|
package/lib/actions/groups.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function getGroupStats(groupID: string): ActionFuncAsync<import("
|
|
|
33
33
|
export declare function createGroupWithUserIds(group: GroupCreateWithUserIds): ActionFuncAsync<Group>;
|
|
34
34
|
export declare function addUsersToGroup(groupId: string, userIds: string[]): ActionFuncAsync<GroupMember[]>;
|
|
35
35
|
export declare function removeUsersFromGroup(groupId: string, userIds: string[]): ActionFuncAsync<GroupMember[]>;
|
|
36
|
-
export declare function searchGroups(params: GroupSearchParams): ActionFuncAsync
|
|
36
|
+
export declare function searchGroups(params: GroupSearchParams): ActionFuncAsync<Group[]>;
|
|
37
37
|
export declare function archiveGroup(groupId: string): ActionFuncAsync<Group>;
|
|
38
38
|
export declare function restoreGroup(groupId: string): ActionFuncAsync<Group>;
|
|
39
39
|
export declare function createGroupTeamsAndChannels(userID: string): ActionFuncAsync<{
|
package/lib/actions/groups.js
CHANGED
|
@@ -402,7 +402,7 @@ function searchGroups(params) {
|
|
|
402
402
|
dispatches.push({ type: action_types_1.ChannelTypes.RECEIVED_CHANNEL_MEMBER_COUNTS_FROM_GROUPS_LIST, data, channelId: params.include_channel_member_count });
|
|
403
403
|
}
|
|
404
404
|
dispatch((0, redux_batched_actions_1.batchActions)(dispatches));
|
|
405
|
-
return { data
|
|
405
|
+
return { data };
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
408
|
function archiveGroup(groupId) {
|
|
@@ -12,9 +12,16 @@ export declare function addUserIdsForStatusFetchingPoll(userIdsForStatus: Array<
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function addUserIdsForProfileFetchingPoll(userIdsForProfile: Array<UserProfile['id']>): ActionFunc<boolean>;
|
|
14
14
|
export declare function cleanUpStatusAndProfileFetchingPoll(): ThunkActionFunc<void>;
|
|
15
|
+
interface UserIdsAndMentions {
|
|
16
|
+
userIdsForProfilePoll: Array<UserProfile['id']>;
|
|
17
|
+
userIdsForStatusPoll: Array<UserProfile['id']>;
|
|
18
|
+
mentionedUsernamesAndGroups: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function extractUserIdsAndMentionsFromPosts(posts: Post[]): ActionFunc<UserIdsAndMentions>;
|
|
15
21
|
/**
|
|
16
22
|
* Gets in batch the user profiles, user statuses and user groups for the users in the posts list
|
|
17
23
|
* This action however doesn't refetch the profiles and statuses except for groups if they are already fetched once
|
|
18
24
|
*/
|
|
19
25
|
export declare function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap: Post[] | PostList['posts'] | Post): ActionFunc<boolean>;
|
|
20
26
|
export declare function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups: string[], isLicensed: boolean): ActionFuncAsync<string[]>;
|
|
27
|
+
export {};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.addUserIdsForStatusFetchingPoll = addUserIdsForStatusFetchingPoll;
|
|
6
6
|
exports.addUserIdsForProfileFetchingPoll = addUserIdsForProfileFetchingPoll;
|
|
7
7
|
exports.cleanUpStatusAndProfileFetchingPoll = cleanUpStatusAndProfileFetchingPoll;
|
|
8
|
+
exports.extractUserIdsAndMentionsFromPosts = extractUserIdsAndMentionsFromPosts;
|
|
8
9
|
exports.batchFetchStatusesProfilesGroupsFromPosts = batchFetchStatusesProfilesGroupsFromPosts;
|
|
9
10
|
exports.getUsersFromMentionedUsernamesAndGroups = getUsersFromMentionedUsernamesAndGroups;
|
|
10
11
|
const groups_1 = require("mattermost-redux/actions/groups");
|
|
@@ -72,28 +73,17 @@ function cleanUpStatusAndProfileFetchingPoll() {
|
|
|
72
73
|
loaders.pollingProfileLoader?.stopInterval();
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
* Gets in batch the user profiles, user statuses and user groups for the users in the posts list
|
|
77
|
-
* This action however doesn't refetch the profiles and statuses except for groups if they are already fetched once
|
|
78
|
-
*/
|
|
79
|
-
function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
76
|
+
function extractUserIdsAndMentionsFromPosts(posts) {
|
|
80
77
|
return (dispatch, getState) => {
|
|
81
|
-
if (!postsArrayOrMap) {
|
|
82
|
-
return { data: false };
|
|
83
|
-
}
|
|
84
|
-
let posts = [];
|
|
85
|
-
if (Array.isArray(postsArrayOrMap)) {
|
|
86
|
-
posts = postsArrayOrMap;
|
|
87
|
-
}
|
|
88
|
-
else if (typeof postsArrayOrMap === 'object' && 'id' in postsArrayOrMap) {
|
|
89
|
-
posts = [postsArrayOrMap];
|
|
90
|
-
}
|
|
91
|
-
else if (typeof postsArrayOrMap === 'object') {
|
|
92
|
-
posts = Object.values(postsArrayOrMap);
|
|
93
|
-
}
|
|
94
78
|
if (posts.length === 0) {
|
|
95
|
-
return { data:
|
|
79
|
+
return { data: {
|
|
80
|
+
userIdsForProfilePoll: [],
|
|
81
|
+
userIdsForStatusPoll: [],
|
|
82
|
+
mentionedUsernamesAndGroups: [],
|
|
83
|
+
} };
|
|
96
84
|
}
|
|
85
|
+
const userIdsForProfilePoll = new Set();
|
|
86
|
+
const userIdsForStatusPoll = new Set();
|
|
97
87
|
const mentionedUsernamesAndGroupsInPosts = new Set();
|
|
98
88
|
const state = getState();
|
|
99
89
|
const currentUser = (0, common_1.getCurrentUser)(state);
|
|
@@ -109,10 +99,10 @@ function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
|
109
99
|
if (embed.type === 'permalink' && embed.data) {
|
|
110
100
|
const permalinkPostPreviewMetaData = embed.data;
|
|
111
101
|
if (permalinkPostPreviewMetaData.post?.user_id && !users[permalinkPostPreviewMetaData.post.user_id] && permalinkPostPreviewMetaData.post.user_id !== currentUserId) {
|
|
112
|
-
|
|
102
|
+
userIdsForProfilePoll.add(permalinkPostPreviewMetaData.post.user_id);
|
|
113
103
|
}
|
|
114
104
|
if (permalinkPostPreviewMetaData.post?.user_id && !userStatuses[permalinkPostPreviewMetaData.post.user_id] && permalinkPostPreviewMetaData.post.user_id !== currentUserId && isUserStatusesConfigEnabled) {
|
|
115
|
-
|
|
105
|
+
userIdsForStatusPoll.add(permalinkPostPreviewMetaData.post.user_id);
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
});
|
|
@@ -121,7 +111,7 @@ function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
|
121
111
|
if (post.metadata.acknowledgements) {
|
|
122
112
|
post.metadata.acknowledgements.forEach((ack) => {
|
|
123
113
|
if (ack.acknowledged_at > 0 && ack.user_id && !users[ack.user_id] && ack.user_id !== currentUserId) {
|
|
124
|
-
|
|
114
|
+
userIdsForProfilePoll.add(ack.user_id);
|
|
125
115
|
}
|
|
126
116
|
});
|
|
127
117
|
}
|
|
@@ -129,12 +119,12 @@ function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
|
129
119
|
// This is sufficient to check if the profile is already fetched
|
|
130
120
|
// as we receive the websocket events for the profiles changes
|
|
131
121
|
if (!users[post.user_id] && post.user_id !== currentUserId) {
|
|
132
|
-
|
|
122
|
+
userIdsForProfilePoll.add(post.user_id);
|
|
133
123
|
}
|
|
134
124
|
// This is sufficient to check if the status is already fetched
|
|
135
125
|
// as we do the polling for statuses for current channel's channel members every 1 minute in channel_controller
|
|
136
126
|
if (!userStatuses[post.user_id] && post.user_id !== currentUserId && isUserStatusesConfigEnabled) {
|
|
137
|
-
|
|
127
|
+
userIdsForStatusPoll.add(post.user_id);
|
|
138
128
|
}
|
|
139
129
|
// We need to check for all @mentions in the post, they can be either users or groups
|
|
140
130
|
const mentioned = (0, posts_1.getNeededAtMentionedUsernamesAndGroups)(state, [post]);
|
|
@@ -146,8 +136,48 @@ function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
|
146
136
|
});
|
|
147
137
|
}
|
|
148
138
|
});
|
|
149
|
-
|
|
150
|
-
|
|
139
|
+
return { data: {
|
|
140
|
+
userIdsForProfilePoll: Array.from(userIdsForProfilePoll),
|
|
141
|
+
userIdsForStatusPoll: Array.from(userIdsForStatusPoll),
|
|
142
|
+
mentionedUsernamesAndGroups: Array.from(mentionedUsernamesAndGroupsInPosts),
|
|
143
|
+
} };
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Gets in batch the user profiles, user statuses and user groups for the users in the posts list
|
|
148
|
+
* This action however doesn't refetch the profiles and statuses except for groups if they are already fetched once
|
|
149
|
+
*/
|
|
150
|
+
function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
151
|
+
return (dispatch, getState) => {
|
|
152
|
+
if (!postsArrayOrMap) {
|
|
153
|
+
return { data: false };
|
|
154
|
+
}
|
|
155
|
+
let posts = [];
|
|
156
|
+
if (Array.isArray(postsArrayOrMap)) {
|
|
157
|
+
posts = postsArrayOrMap;
|
|
158
|
+
}
|
|
159
|
+
else if (typeof postsArrayOrMap === 'object' && 'id' in postsArrayOrMap) {
|
|
160
|
+
posts = [postsArrayOrMap];
|
|
161
|
+
}
|
|
162
|
+
else if (typeof postsArrayOrMap === 'object') {
|
|
163
|
+
posts = Object.values(postsArrayOrMap);
|
|
164
|
+
}
|
|
165
|
+
if (posts.length === 0) {
|
|
166
|
+
return { data: false };
|
|
167
|
+
}
|
|
168
|
+
const state = getState();
|
|
169
|
+
const { data: result } = dispatch(extractUserIdsAndMentionsFromPosts(posts));
|
|
170
|
+
if (!result) {
|
|
171
|
+
return { data: false };
|
|
172
|
+
}
|
|
173
|
+
if (result.userIdsForProfilePoll.length > 0) {
|
|
174
|
+
dispatch(addUserIdsForProfileFetchingPoll(result.userIdsForProfilePoll));
|
|
175
|
+
}
|
|
176
|
+
if (result.userIdsForStatusPoll.length > 0) {
|
|
177
|
+
dispatch(addUserIdsForStatusFetchingPoll(result.userIdsForStatusPoll));
|
|
178
|
+
}
|
|
179
|
+
if (result.mentionedUsernamesAndGroups.length > 0) {
|
|
180
|
+
dispatch(getUsersFromMentionedUsernamesAndGroups(result.mentionedUsernamesAndGroups, (0, general_1.getLicense)(state).IsLicensed === 'true'));
|
|
151
181
|
}
|
|
152
182
|
return { data: true };
|
|
153
183
|
};
|
|
@@ -2,6 +2,7 @@ declare const values: {
|
|
|
2
2
|
INVITE_USER: string;
|
|
3
3
|
ADD_USER_TO_TEAM: string;
|
|
4
4
|
MANAGE_SLASH_COMMANDS: string;
|
|
5
|
+
MANAGE_OWN_SLASH_COMMANDS: string;
|
|
5
6
|
MANAGE_OTHERS_SLASH_COMMANDS: string;
|
|
6
7
|
CREATE_PUBLIC_CHANNEL: string;
|
|
7
8
|
CREATE_PRIVATE_CHANNEL: string;
|
|
@@ -44,12 +45,14 @@ declare const values: {
|
|
|
44
45
|
MANAGE_WEBHOOKS: string;
|
|
45
46
|
MANAGE_OTHERS_WEBHOOKS: string;
|
|
46
47
|
MANAGE_INCOMING_WEBHOOKS: string;
|
|
48
|
+
MANAGE_OWN_INCOMING_WEBHOOKS: string;
|
|
49
|
+
BYPASS_INCOMING_WEBHOOK_CHANNEL_LOCK: string;
|
|
47
50
|
MANAGE_OTHERS_INCOMING_WEBHOOKS: string;
|
|
48
51
|
MANAGE_OUTGOING_WEBHOOKS: string;
|
|
52
|
+
MANAGE_OWN_OUTGOING_WEBHOOKS: string;
|
|
49
53
|
MANAGE_OTHERS_OUTGOING_WEBHOOKS: string;
|
|
50
54
|
MANAGE_OAUTH: string;
|
|
51
55
|
MANAGE_OUTGOING_OAUTH_CONNECTIONS: string;
|
|
52
|
-
MANAGE_SYSTEM_WIDE_OAUTH: string;
|
|
53
56
|
CREATE_POST: string;
|
|
54
57
|
CREATE_POST_PUBLIC: string;
|
|
55
58
|
EDIT_POST: string;
|
|
@@ -6,6 +6,7 @@ const values = {
|
|
|
6
6
|
INVITE_USER: 'invite_user',
|
|
7
7
|
ADD_USER_TO_TEAM: 'add_user_to_team',
|
|
8
8
|
MANAGE_SLASH_COMMANDS: 'manage_slash_commands',
|
|
9
|
+
MANAGE_OWN_SLASH_COMMANDS: 'manage_own_slash_commands',
|
|
9
10
|
MANAGE_OTHERS_SLASH_COMMANDS: 'manage_others_slash_commands',
|
|
10
11
|
CREATE_PUBLIC_CHANNEL: 'create_public_channel',
|
|
11
12
|
CREATE_PRIVATE_CHANNEL: 'create_private_channel',
|
|
@@ -48,12 +49,14 @@ const values = {
|
|
|
48
49
|
MANAGE_WEBHOOKS: 'manage_webhooks',
|
|
49
50
|
MANAGE_OTHERS_WEBHOOKS: 'manage_others_webhooks',
|
|
50
51
|
MANAGE_INCOMING_WEBHOOKS: 'manage_incoming_webhooks',
|
|
52
|
+
MANAGE_OWN_INCOMING_WEBHOOKS: 'manage_own_incoming_webhooks',
|
|
53
|
+
BYPASS_INCOMING_WEBHOOK_CHANNEL_LOCK: 'bypass_incoming_webhook_channel_lock',
|
|
51
54
|
MANAGE_OTHERS_INCOMING_WEBHOOKS: 'manage_others_incoming_webhooks',
|
|
52
55
|
MANAGE_OUTGOING_WEBHOOKS: 'manage_outgoing_webhooks',
|
|
56
|
+
MANAGE_OWN_OUTGOING_WEBHOOKS: 'manage_own_outgoing_webhooks',
|
|
53
57
|
MANAGE_OTHERS_OUTGOING_WEBHOOKS: 'manage_others_outgoing_webhooks',
|
|
54
58
|
MANAGE_OAUTH: 'manage_oauth',
|
|
55
59
|
MANAGE_OUTGOING_OAUTH_CONNECTIONS: 'manage_outgoing_oauth_connections',
|
|
56
|
-
MANAGE_SYSTEM_WIDE_OAUTH: 'manage_system_wide_oauth',
|
|
57
60
|
CREATE_POST: 'create_post',
|
|
58
61
|
CREATE_POST_PUBLIC: 'create_post_public',
|
|
59
62
|
EDIT_POST: 'edit_post',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Agent } from '@mattermost/types/agents';
|
|
2
|
+
export interface AgentsState {
|
|
3
|
+
agents: Agent[];
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("redux").Reducer<{
|
|
6
|
+
agents: Agent[];
|
|
7
|
+
}, import("redux").AnyAction, Partial<{
|
|
8
|
+
agents: Agent[] | undefined;
|
|
9
|
+
}>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
const redux_1 = require("redux");
|
|
6
|
+
const action_types_1 = require("../../action_types");
|
|
7
|
+
function agents(state = [], action) {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case action_types_1.AgentTypes.RECEIVED_AGENTS:
|
|
10
|
+
return action.data || [];
|
|
11
|
+
case action_types_1.AgentTypes.AGENTS_FAILURE:
|
|
12
|
+
return [];
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = (0, redux_1.combineReducers)({
|
|
18
|
+
agents,
|
|
19
|
+
});
|
|
@@ -8,6 +8,9 @@ declare const _default: import("redux").Reducer<{
|
|
|
8
8
|
firstAdminCompleteSetup: any;
|
|
9
9
|
cwsAvailability: import("./general").CWSAvailabilityState;
|
|
10
10
|
};
|
|
11
|
+
agents: {
|
|
12
|
+
agents: import("@mattermost/types/agents").Agent[];
|
|
13
|
+
};
|
|
11
14
|
users: {
|
|
12
15
|
currentUserId: any;
|
|
13
16
|
mySessions: any[];
|
|
@@ -337,6 +340,11 @@ declare const _default: import("redux").Reducer<{
|
|
|
337
340
|
firstAdminCompleteSetup: boolean | undefined;
|
|
338
341
|
cwsAvailability: import("./general").CWSAvailabilityState | undefined;
|
|
339
342
|
}> | undefined;
|
|
343
|
+
agents: {
|
|
344
|
+
agents: import("@mattermost/types/agents").Agent[];
|
|
345
|
+
} | Partial<{
|
|
346
|
+
agents: import("@mattermost/types/agents").Agent[] | undefined;
|
|
347
|
+
}> | undefined;
|
|
340
348
|
users: {
|
|
341
349
|
currentUserId: any;
|
|
342
350
|
mySessions: any[];
|
|
@@ -7,6 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
const redux_1 = require("redux");
|
|
9
9
|
const admin_1 = __importDefault(require("./admin"));
|
|
10
|
+
const agents_1 = __importDefault(require("./agents"));
|
|
10
11
|
const apps_1 = __importDefault(require("./apps"));
|
|
11
12
|
const bots_1 = __importDefault(require("./bots"));
|
|
12
13
|
const channel_bookmarks_1 = __importDefault(require("./channel_bookmarks"));
|
|
@@ -36,6 +37,7 @@ const usage_1 = __importDefault(require("./usage"));
|
|
|
36
37
|
const users_1 = __importDefault(require("./users"));
|
|
37
38
|
exports.default = (0, redux_1.combineReducers)({
|
|
38
39
|
general: general_1.default,
|
|
40
|
+
agents: agents_1.default,
|
|
39
41
|
users: users_1.default,
|
|
40
42
|
limits: limits_1.default,
|
|
41
43
|
teams: teams_1.default,
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ declare const _default: {
|
|
|
10
10
|
firstAdminCompleteSetup: any;
|
|
11
11
|
cwsAvailability: import("./entities/general").CWSAvailabilityState;
|
|
12
12
|
};
|
|
13
|
+
agents: {
|
|
14
|
+
agents: import("@mattermost/types/agents").Agent[];
|
|
15
|
+
};
|
|
13
16
|
users: {
|
|
14
17
|
currentUserId: any;
|
|
15
18
|
mySessions: any[];
|
|
@@ -339,6 +342,11 @@ declare const _default: {
|
|
|
339
342
|
firstAdminCompleteSetup: boolean | undefined;
|
|
340
343
|
cwsAvailability: import("./entities/general").CWSAvailabilityState | undefined;
|
|
341
344
|
}> | undefined;
|
|
345
|
+
agents: {
|
|
346
|
+
agents: import("@mattermost/types/agents").Agent[];
|
|
347
|
+
} | Partial<{
|
|
348
|
+
agents: import("@mattermost/types/agents").Agent[] | undefined;
|
|
349
|
+
}> | undefined;
|
|
342
350
|
users: {
|
|
343
351
|
currentUserId: any;
|
|
344
352
|
mySessions: any[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Channel, ChannelWithTeamData, ChannelSearchOpts } from '@mattermost/types/channels';
|
|
2
2
|
import type { AccessControlSettings } from '@mattermost/types/config';
|
|
3
3
|
import type { GlobalState } from '@mattermost/types/store';
|
|
4
|
-
export declare
|
|
4
|
+
export declare const getAccessControlSettings: import("../create_selector").OutputSelector<GlobalState, AccessControlSettings, (res1: AccessControlSettings, res2: any) => AccessControlSettings>;
|
|
5
5
|
export declare function isChannelScopeAccessControlEnabled(state: GlobalState): boolean;
|
|
6
6
|
export declare function getAccessControlPolicy(state: GlobalState, id: string): import("@mattermost/types/access_control").AccessControlPolicy;
|
|
7
7
|
export declare const getChannelIdsForAccessControlPolicy: (state: GlobalState, parentId: string) => string[];
|
|
@@ -2,8 +2,7 @@
|
|
|
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.getChannelIdsForAccessControlPolicy = void 0;
|
|
6
|
-
exports.getAccessControlSettings = getAccessControlSettings;
|
|
5
|
+
exports.getChannelIdsForAccessControlPolicy = exports.getAccessControlSettings = void 0;
|
|
7
6
|
exports.isChannelScopeAccessControlEnabled = isChannelScopeAccessControlEnabled;
|
|
8
7
|
exports.getAccessControlPolicy = getAccessControlPolicy;
|
|
9
8
|
exports.makeGetChannelsInAccessControlPolicy = makeGetChannelsInAccessControlPolicy;
|
|
@@ -12,22 +11,20 @@ const general_1 = require("mattermost-redux/selectors/entities/general");
|
|
|
12
11
|
const channel_utils_1 = require("mattermost-redux/utils/channel_utils");
|
|
13
12
|
const channels_1 = require("./channels");
|
|
14
13
|
const create_selector_1 = require("../create_selector");
|
|
15
|
-
|
|
14
|
+
exports.getAccessControlSettings = (0, create_selector_1.createSelector)('getAccessControlSettings', (state) => state.entities.admin.config.AccessControlSettings, (state) => (0, general_1.getConfig)(state), (adminConfig, config) => {
|
|
16
15
|
// First try to get from admin config (for admin console pages)
|
|
17
|
-
const adminConfig = state.entities.admin.config.AccessControlSettings;
|
|
18
16
|
if (adminConfig) {
|
|
19
17
|
return adminConfig;
|
|
20
18
|
}
|
|
21
19
|
// Otherwise, build from client config (for regular users/channel admins)
|
|
22
|
-
const config = (0, general_1.getConfig)(state);
|
|
23
20
|
return {
|
|
24
21
|
EnableAttributeBasedAccessControl: config?.EnableAttributeBasedAccessControl === 'true',
|
|
25
22
|
EnableChannelScopeAccessControl: config?.EnableChannelScopeAccessControl === 'true',
|
|
26
23
|
EnableUserManagedAttributes: config?.EnableUserManagedAttributes === 'true',
|
|
27
24
|
};
|
|
28
|
-
}
|
|
25
|
+
});
|
|
29
26
|
function isChannelScopeAccessControlEnabled(state) {
|
|
30
|
-
const settings = getAccessControlSettings(state);
|
|
27
|
+
const settings = (0, exports.getAccessControlSettings)(state);
|
|
31
28
|
return settings?.EnableChannelScopeAccessControl || false;
|
|
32
29
|
}
|
|
33
30
|
function getAccessControlPolicy(state, id) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Agent } from '@mattermost/types/agents';
|
|
2
|
+
import type { GlobalState } from '@mattermost/types/store';
|
|
3
|
+
export declare function getAgents(state: GlobalState): Agent[];
|
|
4
|
+
export declare function getAgent(state: GlobalState, agentId: string): Agent | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.getAgents = getAgents;
|
|
6
|
+
exports.getAgent = getAgent;
|
|
7
|
+
function getAgents(state) {
|
|
8
|
+
return state.entities.agents?.agents;
|
|
9
|
+
}
|
|
10
|
+
function getAgent(state, agentId) {
|
|
11
|
+
const agents = getAgents(state);
|
|
12
|
+
return agents.find((agent) => agent.id === agentId);
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { FileInfo } from '@mattermost/types/files';
|
|
|
2
2
|
export declare function getFormattedFileSize(bytes: number): string;
|
|
3
3
|
export declare function getFileType(file: FileInfo): string;
|
|
4
4
|
export declare function getFileUrl(fileId: string): string;
|
|
5
|
-
export declare function getFileDownloadUrl(fileId: string): string;
|
|
5
|
+
export declare function getFileDownloadUrl(fileId: string, asContentReviewer?: boolean, flaggedPostId?: string): string;
|
|
6
6
|
export declare function getFileThumbnailUrl(fileId: string): string;
|
|
7
7
|
export declare function getFilePreviewUrl(fileId: string): string;
|
|
8
8
|
export declare function getFileMiniPreviewUrl(fileInfo?: FileInfo): string | undefined;
|
package/lib/utils/file_utils.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.getFileThumbnailUrl = getFileThumbnailUrl;
|
|
|
10
10
|
exports.getFilePreviewUrl = getFilePreviewUrl;
|
|
11
11
|
exports.getFileMiniPreviewUrl = getFileMiniPreviewUrl;
|
|
12
12
|
exports.sortFileInfos = sortFileInfos;
|
|
13
|
+
const helpers_1 = require("@mattermost/client/lib/helpers");
|
|
13
14
|
const client_1 = require("mattermost-redux/client");
|
|
14
15
|
const constants_1 = require("../constants");
|
|
15
16
|
function getFormattedFileSize(bytes) {
|
|
@@ -54,8 +55,17 @@ function getFileType(file) {
|
|
|
54
55
|
function getFileUrl(fileId) {
|
|
55
56
|
return client_1.Client4.getFileRoute(fileId);
|
|
56
57
|
}
|
|
57
|
-
function getFileDownloadUrl(fileId) {
|
|
58
|
-
|
|
58
|
+
function getFileDownloadUrl(fileId, asContentReviewer, flaggedPostId) {
|
|
59
|
+
const queryParamsArgs = {};
|
|
60
|
+
queryParamsArgs.download = 1;
|
|
61
|
+
if (asContentReviewer) {
|
|
62
|
+
queryParamsArgs.as_content_reviewer = true;
|
|
63
|
+
}
|
|
64
|
+
if (flaggedPostId) {
|
|
65
|
+
queryParamsArgs.flagged_post_id = flaggedPostId;
|
|
66
|
+
}
|
|
67
|
+
const queryParams = (0, helpers_1.buildQueryString)(queryParamsArgs);
|
|
68
|
+
return `${client_1.Client4.getFileRoute(fileId)}${queryParams}`;
|
|
59
69
|
}
|
|
60
70
|
function getFileThumbnailUrl(fileId) {
|
|
61
71
|
return `${client_1.Client4.getFileRoute(fileId)}/thumbnail`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mattermost-redux",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.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.
|
|
43
|
-
"@mattermost/types": "11.
|
|
42
|
+
"@mattermost/client": "11.2.0",
|
|
43
|
+
"@mattermost/types": "11.2.0",
|
|
44
44
|
"@redux-devtools/extension": "3.3.0",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"moment-timezone": "^0.5.38",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsc --build --verbose",
|
|
64
|
-
"postbuild": "sh
|
|
64
|
+
"postbuild": "sh postbuild.sh",
|
|
65
65
|
"clean": "rm -rf lib node_modules *.tsbuildinfo"
|
|
66
66
|
}
|
|
67
67
|
}
|