mattermost-redux 11.4.0 → 11.6.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 +6 -0
- package/lib/action_types/content_flagging.d.ts +3 -0
- package/lib/action_types/content_flagging.js +3 -0
- package/lib/action_types/files.d.ts +1 -0
- package/lib/action_types/files.js +1 -0
- package/lib/action_types/index.d.ts +2 -1
- package/lib/action_types/index.js +3 -1
- package/lib/action_types/posts.d.ts +1 -0
- package/lib/action_types/posts.js +1 -0
- package/lib/action_types/roles.d.ts +0 -1
- package/lib/action_types/roles.js +0 -1
- package/lib/action_types/users.d.ts +0 -2
- package/lib/action_types/users.js +0 -2
- package/lib/action_types/websocket.d.ts +5 -0
- package/lib/action_types/websocket.js +12 -0
- package/lib/actions/agents.d.ts +5 -0
- package/lib/actions/agents.js +18 -0
- package/lib/actions/channels.d.ts +1 -0
- package/lib/actions/channels.js +34 -0
- package/lib/actions/content_flagging.d.ts +14 -0
- package/lib/actions/content_flagging.js +119 -0
- package/lib/actions/general.js +4 -3
- package/lib/actions/limits.js +2 -1
- package/lib/actions/posts.d.ts +2 -1
- package/lib/actions/posts.js +35 -2
- package/lib/actions/scheduled_posts.d.ts +1 -1
- package/lib/actions/search.js +14 -2
- package/lib/actions/shared_channels.d.ts +1 -1
- package/lib/actions/shared_channels.js +2 -2
- package/lib/actions/users.d.ts +3 -2
- package/lib/actions/users.js +19 -25
- package/lib/constants/general.d.ts +2 -0
- package/lib/constants/general.js +2 -0
- package/lib/constants/index.d.ts +1 -2
- package/lib/constants/index.js +1 -3
- package/lib/constants/permissions.d.ts +2 -0
- package/lib/constants/permissions.js +2 -0
- package/lib/constants/posts.d.ts +2 -0
- package/lib/constants/posts.js +1 -0
- package/lib/constants/preferences.d.ts +0 -1
- package/lib/constants/preferences.js +0 -1
- package/lib/constants/stats.d.ts +1 -0
- package/lib/constants/stats.js +1 -0
- package/lib/reducers/entities/admin.js +3 -0
- package/lib/reducers/entities/agents.d.ts +16 -1
- package/lib/reducers/entities/agents.js +22 -0
- package/lib/reducers/entities/content_flagging.d.ts +18 -0
- package/lib/reducers/entities/content_flagging.js +51 -0
- package/lib/reducers/entities/files.d.ts +3 -0
- package/lib/reducers/entities/files.js +19 -0
- package/lib/reducers/entities/index.d.ts +45 -3
- package/lib/reducers/entities/posts.js +46 -7
- package/lib/reducers/entities/roles.js +0 -8
- package/lib/reducers/entities/typing.js +3 -3
- package/lib/reducers/entities/users.d.ts +0 -2
- package/lib/reducers/entities/users.js +0 -30
- package/lib/reducers/index.d.ts +45 -3
- package/lib/selectors/entities/access_control.d.ts +0 -1
- package/lib/selectors/entities/access_control.js +0 -6
- package/lib/selectors/entities/agents.d.ts +7 -1
- package/lib/selectors/entities/agents.js +14 -1
- package/lib/selectors/entities/channels.d.ts +4 -0
- package/lib/selectors/entities/channels.js +69 -0
- package/lib/selectors/entities/content_flagging.d.ts +4 -0
- package/lib/selectors/entities/content_flagging.js +28 -1
- package/lib/selectors/entities/files.d.ts +2 -0
- package/lib/selectors/entities/files.js +9 -0
- package/lib/selectors/entities/users.d.ts +0 -3
- package/lib/selectors/entities/users.js +1 -16
- package/lib/store/initial_state.js +3 -1
- package/lib/utils/data_loader.d.ts +4 -0
- package/lib/utils/data_loader.js +22 -4
- package/lib/utils/emoji_utils.d.ts +2 -2
- package/lib/utils/emoji_utils.js +6 -10
- package/lib/utils/integration_utils.js +58 -2
- package/lib/utils/user_utils.js +2 -0
- package/package.json +3 -3
- package/lib/constants/websocket.d.ts +0 -56
- package/lib/constants/websocket.js +0 -60
|
@@ -2,5 +2,11 @@ declare const _default: {
|
|
|
2
2
|
RECEIVED_AGENTS: "RECEIVED_AGENTS";
|
|
3
3
|
AGENTS_REQUEST: "AGENTS_REQUEST";
|
|
4
4
|
AGENTS_FAILURE: "AGENTS_FAILURE";
|
|
5
|
+
RECEIVED_AGENTS_STATUS: "RECEIVED_AGENTS_STATUS";
|
|
6
|
+
AGENTS_STATUS_REQUEST: "AGENTS_STATUS_REQUEST";
|
|
7
|
+
AGENTS_STATUS_FAILURE: "AGENTS_STATUS_FAILURE";
|
|
8
|
+
RECEIVED_LLM_SERVICES: "RECEIVED_LLM_SERVICES";
|
|
9
|
+
LLM_SERVICES_REQUEST: "LLM_SERVICES_REQUEST";
|
|
10
|
+
LLM_SERVICES_FAILURE: "LLM_SERVICES_FAILURE";
|
|
5
11
|
};
|
|
6
12
|
export default _default;
|
|
@@ -10,4 +10,10 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
10
10
|
RECEIVED_AGENTS: null,
|
|
11
11
|
AGENTS_REQUEST: null,
|
|
12
12
|
AGENTS_FAILURE: null,
|
|
13
|
+
RECEIVED_AGENTS_STATUS: null,
|
|
14
|
+
AGENTS_STATUS_REQUEST: null,
|
|
15
|
+
AGENTS_STATUS_FAILURE: null,
|
|
16
|
+
RECEIVED_LLM_SERVICES: null,
|
|
17
|
+
LLM_SERVICES_REQUEST: null,
|
|
18
|
+
LLM_SERVICES_FAILURE: null,
|
|
13
19
|
});
|
|
@@ -3,5 +3,8 @@ declare const _default: {
|
|
|
3
3
|
RECEIVED_POST_CONTENT_FLAGGING_FIELDS: "RECEIVED_POST_CONTENT_FLAGGING_FIELDS";
|
|
4
4
|
RECEIVED_POST_CONTENT_FLAGGING_VALUES: "RECEIVED_POST_CONTENT_FLAGGING_VALUES";
|
|
5
5
|
CONTENT_FLAGGING_REPORT_VALUE_UPDATED: "CONTENT_FLAGGING_REPORT_VALUE_UPDATED";
|
|
6
|
+
RECEIVED_FLAGGED_POST: "RECEIVED_FLAGGED_POST";
|
|
7
|
+
RECEIVED_CONTENT_FLAGGING_CHANNEL: "RECEIVED_CONTENT_FLAGGING_CHANNEL";
|
|
8
|
+
RECEIVED_CONTENT_FLAGGING_TEAM: "RECEIVED_CONTENT_FLAGGING_TEAM";
|
|
6
9
|
};
|
|
7
10
|
export default _default;
|
|
@@ -11,4 +11,7 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
11
11
|
RECEIVED_POST_CONTENT_FLAGGING_FIELDS: null,
|
|
12
12
|
RECEIVED_POST_CONTENT_FLAGGING_VALUES: null,
|
|
13
13
|
CONTENT_FLAGGING_REPORT_VALUE_UPDATED: null,
|
|
14
|
+
RECEIVED_FLAGGED_POST: null,
|
|
15
|
+
RECEIVED_CONTENT_FLAGGING_CHANNEL: null,
|
|
16
|
+
RECEIVED_CONTENT_FLAGGING_TEAM: null,
|
|
14
17
|
});
|
|
@@ -31,7 +31,8 @@ import SharedChannelTypes from './shared_channels';
|
|
|
31
31
|
import TeamTypes from './teams';
|
|
32
32
|
import ThreadTypes from './threads';
|
|
33
33
|
import UserTypes from './users';
|
|
34
|
-
|
|
34
|
+
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, };
|
|
35
36
|
/**
|
|
36
37
|
* An MMReduxAction is any non-Thunk Redux action accepted by mattermost-redux.
|
|
37
38
|
*/
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.AgentTypes = exports.ContentFlaggingTypes = exports.SharedChannelTypes = exports.ScheduledPostTypes = exports.ChannelBookmarkTypes = exports.PlaybookType = exports.DraftTypes = exports.HostedCustomerTypes = exports.ThreadTypes = exports.AppsTypes = exports.CloudTypes = exports.ChannelCategoryTypes = exports.PluginTypes = exports.BotTypes = exports.GroupTypes = exports.SchemeTypes = exports.RoleTypes = exports.SearchTypes = exports.LimitsTypes = exports.JobTypes = exports.AdminTypes = exports.EmojiTypes = exports.IntegrationTypes = exports.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.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"));
|
|
@@ -70,3 +70,5 @@ const threads_1 = __importDefault(require("./threads"));
|
|
|
70
70
|
exports.ThreadTypes = threads_1.default;
|
|
71
71
|
const users_1 = __importDefault(require("./users"));
|
|
72
72
|
exports.UserTypes = users_1.default;
|
|
73
|
+
const websocket_1 = __importDefault(require("./websocket"));
|
|
74
|
+
exports.WebSocketTypes = websocket_1.default;
|
|
@@ -27,6 +27,7 @@ declare const _default: {
|
|
|
27
27
|
RECEIVED_POSTS_SINCE: "RECEIVED_POSTS_SINCE";
|
|
28
28
|
POST_DELETED: "POST_DELETED";
|
|
29
29
|
POST_REMOVED: "POST_REMOVED";
|
|
30
|
+
POST_TRANSLATION_UPDATED: "POST_TRANSLATION_UPDATED";
|
|
30
31
|
POST_PINNED_CHANGED: "POST_PINNED_CHANGED";
|
|
31
32
|
RECEIVED_FOCUSED_POST: "RECEIVED_FOCUSED_POST";
|
|
32
33
|
RECEIVED_EDIT_POST: "RECEIVED_EDIT_POST";
|
|
@@ -28,8 +28,6 @@ declare const _default: {
|
|
|
28
28
|
RECEIVED_PROFILE_NOT_IN_TEAM: "RECEIVED_PROFILE_NOT_IN_TEAM";
|
|
29
29
|
RECEIVED_PROFILES_LIST_NOT_IN_TEAM: "RECEIVED_PROFILES_LIST_NOT_IN_TEAM";
|
|
30
30
|
RECEIVED_PROFILES_LIST_NOT_IN_TEAM_AND_REPLACE: "RECEIVED_PROFILES_LIST_NOT_IN_TEAM_AND_REPLACE";
|
|
31
|
-
RECEIVED_PROFILE_WITHOUT_TEAM: "RECEIVED_PROFILE_WITHOUT_TEAM";
|
|
32
|
-
RECEIVED_PROFILES_LIST_WITHOUT_TEAM: "RECEIVED_PROFILES_LIST_WITHOUT_TEAM";
|
|
33
31
|
RECEIVED_PROFILES_IN_CHANNEL: "RECEIVED_PROFILES_IN_CHANNEL";
|
|
34
32
|
RECEIVED_PROFILES_LIST_IN_CHANNEL: "RECEIVED_PROFILES_LIST_IN_CHANNEL";
|
|
35
33
|
RECEIVED_PROFILE_IN_CHANNEL: "RECEIVED_PROFILE_IN_CHANNEL";
|
|
@@ -36,8 +36,6 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
36
36
|
RECEIVED_PROFILE_NOT_IN_TEAM: null,
|
|
37
37
|
RECEIVED_PROFILES_LIST_NOT_IN_TEAM: null,
|
|
38
38
|
RECEIVED_PROFILES_LIST_NOT_IN_TEAM_AND_REPLACE: null,
|
|
39
|
-
RECEIVED_PROFILE_WITHOUT_TEAM: null,
|
|
40
|
-
RECEIVED_PROFILES_LIST_WITHOUT_TEAM: null,
|
|
41
39
|
RECEIVED_PROFILES_IN_CHANNEL: null,
|
|
42
40
|
RECEIVED_PROFILES_LIST_IN_CHANNEL: null,
|
|
43
41
|
RECEIVED_PROFILE_IN_CHANNEL: null,
|
|
@@ -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
|
+
TYPING: null,
|
|
11
|
+
STOPPED_TYPING: null,
|
|
12
|
+
});
|
package/lib/actions/agents.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export declare function getAgents(): import("../types/actions").ActionFuncAsync<import("@mattermost/types/agents").Agent[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
|
2
|
+
export declare function getAgentsStatus(): import("../types/actions").ActionFuncAsync<{
|
|
3
|
+
available: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
}, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
|
6
|
+
export declare function getLLMServices(): import("../types/actions").ActionFuncAsync<import("@mattermost/types/agents").LLMService[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
package/lib/actions/agents.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// See LICENSE.txt for license information.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.getAgents = getAgents;
|
|
6
|
+
exports.getAgentsStatus = getAgentsStatus;
|
|
7
|
+
exports.getLLMServices = getLLMServices;
|
|
6
8
|
const helpers_1 = require("./helpers");
|
|
7
9
|
const action_types_1 = require("../action_types");
|
|
8
10
|
const client_1 = require("../client");
|
|
@@ -14,3 +16,19 @@ function getAgents() {
|
|
|
14
16
|
onRequest: action_types_1.AgentTypes.AGENTS_REQUEST,
|
|
15
17
|
});
|
|
16
18
|
}
|
|
19
|
+
function getAgentsStatus() {
|
|
20
|
+
return (0, helpers_1.bindClientFunc)({
|
|
21
|
+
clientFunc: client_1.Client4.getAgentsStatus,
|
|
22
|
+
onSuccess: [action_types_1.AgentTypes.RECEIVED_AGENTS_STATUS],
|
|
23
|
+
onFailure: action_types_1.AgentTypes.AGENTS_STATUS_FAILURE,
|
|
24
|
+
onRequest: action_types_1.AgentTypes.AGENTS_STATUS_REQUEST,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function getLLMServices() {
|
|
28
|
+
return (0, helpers_1.bindClientFunc)({
|
|
29
|
+
clientFunc: client_1.Client4.getLLMServices,
|
|
30
|
+
onSuccess: [action_types_1.AgentTypes.RECEIVED_LLM_SERVICES],
|
|
31
|
+
onFailure: action_types_1.AgentTypes.LLM_SERVICES_FAILURE,
|
|
32
|
+
onRequest: action_types_1.AgentTypes.LLM_SERVICES_REQUEST,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -12,6 +12,7 @@ export declare function createDirectChannel(userId: string, otherUserId: string)
|
|
|
12
12
|
export declare function markGroupChannelOpen(channelId: string): ActionFuncAsync;
|
|
13
13
|
export declare function createGroupChannel(userIds: string[]): ActionFuncAsync<Channel>;
|
|
14
14
|
export declare function patchChannel(channelId: string, patch: Partial<Channel>): ActionFuncAsync<Channel>;
|
|
15
|
+
export declare function setMyChannelAutotranslation(channelId: string, enabled: boolean): ActionFuncAsync<boolean>;
|
|
15
16
|
export declare function updateChannelPrivacy(channelId: string, privacy: string): ActionFuncAsync<Channel>;
|
|
16
17
|
export declare function convertGroupMessageToPrivateChannel(channelID: string, teamID: string, displayName: string, name: string): ActionFuncAsync<Channel>;
|
|
17
18
|
export declare function updateChannelNotifyProps(userId: string, channelId: string, props: Partial<ChannelNotifyProps>): ActionFuncAsync;
|
package/lib/actions/channels.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.createDirectChannel = createDirectChannel;
|
|
|
8
8
|
exports.markGroupChannelOpen = markGroupChannelOpen;
|
|
9
9
|
exports.createGroupChannel = createGroupChannel;
|
|
10
10
|
exports.patchChannel = patchChannel;
|
|
11
|
+
exports.setMyChannelAutotranslation = setMyChannelAutotranslation;
|
|
11
12
|
exports.updateChannelPrivacy = updateChannelPrivacy;
|
|
12
13
|
exports.convertGroupMessageToPrivateChannel = convertGroupMessageToPrivateChannel;
|
|
13
14
|
exports.updateChannelNotifyProps = updateChannelNotifyProps;
|
|
@@ -72,6 +73,7 @@ const data_loader_1 = require("mattermost-redux/utils/data_loader");
|
|
|
72
73
|
const channel_categories_3 = require("./channel_categories");
|
|
73
74
|
const errors_1 = require("./errors");
|
|
74
75
|
const helpers_1 = require("./helpers");
|
|
76
|
+
const posts_1 = require("./posts");
|
|
75
77
|
const preferences_1 = require("./preferences");
|
|
76
78
|
const roles_1 = require("./roles");
|
|
77
79
|
const users_1 = require("./users");
|
|
@@ -267,6 +269,38 @@ function patchChannel(channelId, patch) {
|
|
|
267
269
|
params: [channelId, patch],
|
|
268
270
|
});
|
|
269
271
|
}
|
|
272
|
+
function setMyChannelAutotranslation(channelId, enabled) {
|
|
273
|
+
return async (dispatch, getState) => {
|
|
274
|
+
const state = getState();
|
|
275
|
+
const myChannelMember = (0, channels_2.getMyChannelMember)(state, channelId);
|
|
276
|
+
if (!myChannelMember) {
|
|
277
|
+
return { data: false, error: 'Channel member not found' };
|
|
278
|
+
}
|
|
279
|
+
const updatedMember = {
|
|
280
|
+
...myChannelMember,
|
|
281
|
+
autotranslation_disabled: !enabled,
|
|
282
|
+
};
|
|
283
|
+
try {
|
|
284
|
+
await client_1.Client4.setMyChannelAutotranslation(channelId, enabled);
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
(0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
|
|
288
|
+
dispatch((0, errors_1.logError)(error));
|
|
289
|
+
return { data: undefined, error };
|
|
290
|
+
}
|
|
291
|
+
// We check before updating the store
|
|
292
|
+
const becameEnabled = (0, channels_2.hasAutotranslationBecomeEnabled)(state, updatedMember);
|
|
293
|
+
dispatch({
|
|
294
|
+
type: action_types_1.ChannelTypes.RECEIVED_MY_CHANNEL_MEMBER,
|
|
295
|
+
data: updatedMember,
|
|
296
|
+
});
|
|
297
|
+
// If autotranslation changed, delete posts for this channel
|
|
298
|
+
if (becameEnabled) {
|
|
299
|
+
await dispatch((0, posts_1.resetReloadPostsInChannel)(channelId));
|
|
300
|
+
}
|
|
301
|
+
return { data: true, error: undefined };
|
|
302
|
+
};
|
|
303
|
+
}
|
|
270
304
|
function updateChannelPrivacy(channelId, privacy) {
|
|
271
305
|
return (0, helpers_1.bindClientFunc)({
|
|
272
306
|
clientFunc: client_1.Client4.updateChannelPrivacy,
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
+
import type { Channel } from '@mattermost/types/channels';
|
|
1
2
|
import type { ContentFlaggingConfig } from '@mattermost/types/content_flagging';
|
|
3
|
+
import type { Post } from '@mattermost/types/posts';
|
|
2
4
|
import type { NameMappedPropertyFields, PropertyValue } from '@mattermost/types/properties';
|
|
5
|
+
import type { Team } from '@mattermost/types/teams';
|
|
3
6
|
import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
|
|
7
|
+
export type ContentFlaggingChannelRequestIdentifier = {
|
|
8
|
+
channelId?: string;
|
|
9
|
+
flaggedPostId?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ContentFlaggingTeamRequestIdentifier = {
|
|
12
|
+
teamId?: string;
|
|
13
|
+
flaggedPostId?: string;
|
|
14
|
+
};
|
|
4
15
|
export declare function getTeamContentFlaggingStatus(teamId: string): ActionFuncAsync<{
|
|
5
16
|
enabled: boolean;
|
|
6
17
|
}>;
|
|
7
18
|
export declare function getContentFlaggingConfig(teamId?: string): ActionFuncAsync<ContentFlaggingConfig>;
|
|
8
19
|
export declare function getPostContentFlaggingFields(): ActionFuncAsync<NameMappedPropertyFields>;
|
|
9
20
|
export declare function loadPostContentFlaggingFields(): ActionFuncAsync<NameMappedPropertyFields>;
|
|
21
|
+
export declare function loadFlaggedPost(flaggedPostId: string): ActionFuncAsync<Post>;
|
|
22
|
+
export declare function loadContentFlaggingChannel(identifier: ContentFlaggingChannelRequestIdentifier): ActionFuncAsync<Channel>;
|
|
23
|
+
export declare function loadContentFlaggingTeam(identifier: ContentFlaggingTeamRequestIdentifier): ActionFuncAsync<Team>;
|
|
10
24
|
export declare function getPostContentFlaggingValues(postId: string): ActionFuncAsync<Array<PropertyValue<unknown>>>;
|
|
@@ -6,12 +6,21 @@ exports.getTeamContentFlaggingStatus = getTeamContentFlaggingStatus;
|
|
|
6
6
|
exports.getContentFlaggingConfig = getContentFlaggingConfig;
|
|
7
7
|
exports.getPostContentFlaggingFields = getPostContentFlaggingFields;
|
|
8
8
|
exports.loadPostContentFlaggingFields = loadPostContentFlaggingFields;
|
|
9
|
+
exports.loadFlaggedPost = loadFlaggedPost;
|
|
10
|
+
exports.loadContentFlaggingChannel = loadContentFlaggingChannel;
|
|
11
|
+
exports.loadContentFlaggingTeam = loadContentFlaggingTeam;
|
|
9
12
|
exports.getPostContentFlaggingValues = getPostContentFlaggingValues;
|
|
10
13
|
const action_types_1 = require("mattermost-redux/action_types");
|
|
11
14
|
const errors_1 = require("mattermost-redux/actions/errors");
|
|
12
15
|
const helpers_1 = require("mattermost-redux/actions/helpers");
|
|
13
16
|
const client_1 = require("mattermost-redux/client");
|
|
14
17
|
const data_loader_1 = require("mattermost-redux/utils/data_loader");
|
|
18
|
+
function channelComparator(a, b) {
|
|
19
|
+
return a.channelId === b.channelId;
|
|
20
|
+
}
|
|
21
|
+
function teamComparator(a, b) {
|
|
22
|
+
return a.teamId === b.teamId;
|
|
23
|
+
}
|
|
15
24
|
function getTeamContentFlaggingStatus(teamId) {
|
|
16
25
|
return async (dispatch, getState) => {
|
|
17
26
|
let response;
|
|
@@ -84,6 +93,116 @@ function loadPostContentFlaggingFields() {
|
|
|
84
93
|
return {};
|
|
85
94
|
};
|
|
86
95
|
}
|
|
96
|
+
function getFlaggedPost(flaggedPostId) {
|
|
97
|
+
return async (dispatch, getState) => {
|
|
98
|
+
let data;
|
|
99
|
+
try {
|
|
100
|
+
data = await client_1.Client4.getFlaggedPost(flaggedPostId);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
(0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
|
|
104
|
+
dispatch((0, errors_1.logError)(error));
|
|
105
|
+
return { error };
|
|
106
|
+
}
|
|
107
|
+
dispatch({
|
|
108
|
+
type: action_types_1.ContentFlaggingTypes.RECEIVED_FLAGGED_POST,
|
|
109
|
+
data,
|
|
110
|
+
});
|
|
111
|
+
return { data };
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function loadFlaggedPost(flaggedPostId) {
|
|
115
|
+
return async (dispatch, getState, { loaders }) => {
|
|
116
|
+
if (!loaders.flaggedPostLoader) {
|
|
117
|
+
loaders.flaggedPostLoader = new data_loader_1.DelayedDataLoader({
|
|
118
|
+
fetchBatch: ([postId]) => dispatch(getFlaggedPost(postId)),
|
|
119
|
+
maxBatchSize: 1,
|
|
120
|
+
wait: 200,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const loader = loaders.flaggedPostLoader;
|
|
124
|
+
loader.queue([flaggedPostId]);
|
|
125
|
+
return {};
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function getContentFlaggingChannel(channelId, flaggedPostId) {
|
|
129
|
+
return async (dispatch, getState) => {
|
|
130
|
+
let data;
|
|
131
|
+
try {
|
|
132
|
+
data = await client_1.Client4.getChannel(channelId, true, flaggedPostId);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
(0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
|
|
136
|
+
dispatch((0, errors_1.logError)(error));
|
|
137
|
+
return { error };
|
|
138
|
+
}
|
|
139
|
+
dispatch({
|
|
140
|
+
type: action_types_1.ContentFlaggingTypes.RECEIVED_CONTENT_FLAGGING_CHANNEL,
|
|
141
|
+
data,
|
|
142
|
+
});
|
|
143
|
+
return { data };
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function loadContentFlaggingChannel(identifier) {
|
|
147
|
+
return async (dispatch, getState, { loaders }) => {
|
|
148
|
+
if (!loaders.contentFlaggingChannelLoader) {
|
|
149
|
+
loaders.contentFlaggingChannelLoader =
|
|
150
|
+
new data_loader_1.DelayedDataLoader({
|
|
151
|
+
fetchBatch: ([{ flaggedPostId, channelId }]) => {
|
|
152
|
+
if (channelId && flaggedPostId) {
|
|
153
|
+
return dispatch(getContentFlaggingChannel(channelId, flaggedPostId));
|
|
154
|
+
}
|
|
155
|
+
return Promise.resolve(null);
|
|
156
|
+
},
|
|
157
|
+
maxBatchSize: 1,
|
|
158
|
+
wait: 200,
|
|
159
|
+
comparator: channelComparator,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const loader = loaders.contentFlaggingChannelLoader;
|
|
163
|
+
loader.queue([identifier]);
|
|
164
|
+
return {};
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function getContentFlaggingTeam(teamId, flaggedPostId) {
|
|
168
|
+
return async (dispatch, getState) => {
|
|
169
|
+
let data;
|
|
170
|
+
try {
|
|
171
|
+
data = await client_1.Client4.getTeam(teamId, true, flaggedPostId);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
(0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
|
|
175
|
+
dispatch((0, errors_1.logError)(error));
|
|
176
|
+
return { error };
|
|
177
|
+
}
|
|
178
|
+
dispatch({
|
|
179
|
+
type: action_types_1.ContentFlaggingTypes.RECEIVED_CONTENT_FLAGGING_TEAM,
|
|
180
|
+
data,
|
|
181
|
+
});
|
|
182
|
+
return { data };
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function loadContentFlaggingTeam(identifier) {
|
|
186
|
+
return async (dispatch, getState, { loaders }) => {
|
|
187
|
+
if (!loaders.contentFlaggingTeamLoader) {
|
|
188
|
+
loaders.contentFlaggingTeamLoader =
|
|
189
|
+
new data_loader_1.DelayedDataLoader({
|
|
190
|
+
fetchBatch: ([{ flaggedPostId, teamId }]) => {
|
|
191
|
+
if (teamId && flaggedPostId) {
|
|
192
|
+
return dispatch(getContentFlaggingTeam(teamId, flaggedPostId));
|
|
193
|
+
}
|
|
194
|
+
return Promise.resolve(null);
|
|
195
|
+
},
|
|
196
|
+
maxBatchSize: 1,
|
|
197
|
+
wait: 200,
|
|
198
|
+
comparator: teamComparator,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
const loader = loaders.contentFlaggingTeamLoader;
|
|
202
|
+
loader.queue([identifier]);
|
|
203
|
+
return {};
|
|
204
|
+
};
|
|
205
|
+
}
|
|
87
206
|
function getPostContentFlaggingValues(postId) {
|
|
88
207
|
return async (dispatch, getState) => {
|
|
89
208
|
let response;
|
package/lib/actions/general.js
CHANGED
|
@@ -111,9 +111,10 @@ function checkCWSAvailability() {
|
|
|
111
111
|
}
|
|
112
112
|
dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_REQUEST });
|
|
113
113
|
try {
|
|
114
|
-
await client_1.Client4.cwsAvailabilityCheck();
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const response = await client_1.Client4.cwsAvailabilityCheck();
|
|
115
|
+
const status = response.status;
|
|
116
|
+
dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_SUCCESS, data: status });
|
|
117
|
+
return { data: status };
|
|
117
118
|
}
|
|
118
119
|
catch (error) {
|
|
119
120
|
dispatch({ type: action_types_1.GeneralTypes.CWS_AVAILABILITY_CHECK_FAILURE });
|
package/lib/actions/limits.js
CHANGED
|
@@ -23,9 +23,10 @@ function getServerLimits() {
|
|
|
23
23
|
activeUserCount: response?.data?.activeUserCount ?? 0,
|
|
24
24
|
maxUsersLimit: response?.data?.maxUsersLimit ?? 0,
|
|
25
25
|
maxUsersHardLimit: response?.data?.maxUsersHardLimit ?? 0,
|
|
26
|
-
// Post history limit fields from server response
|
|
27
26
|
lastAccessiblePostTime: response?.data?.lastAccessiblePostTime ?? 0,
|
|
28
27
|
postHistoryLimit: response?.data?.postHistoryLimit ?? 0,
|
|
28
|
+
singleChannelGuestCount: response?.data?.singleChannelGuestCount ?? 0,
|
|
29
|
+
singleChannelGuestLimit: response?.data?.singleChannelGuestLimit ?? 0,
|
|
29
30
|
};
|
|
30
31
|
dispatch({ type: action_types_1.LimitsTypes.RECEIVED_APP_LIMITS, data });
|
|
31
32
|
return { data };
|
package/lib/actions/posts.d.ts
CHANGED
|
@@ -138,10 +138,11 @@ export declare function resetHistoryIndex(index: string): {
|
|
|
138
138
|
};
|
|
139
139
|
export declare function moveHistoryIndexBack(index: string): ActionFuncAsync;
|
|
140
140
|
export declare function moveHistoryIndexForward(index: string): ActionFuncAsync;
|
|
141
|
+
export declare function resetReloadPostsInTranslatedChannels(): ActionFuncAsync;
|
|
141
142
|
/**
|
|
142
143
|
* Ensures thread-replies in channels correctly follow CRT:ON/OFF
|
|
143
144
|
*/
|
|
144
|
-
export declare function resetReloadPostsInChannel(): ActionFuncAsync;
|
|
145
|
+
export declare function resetReloadPostsInChannel(channelId?: string): ActionFuncAsync;
|
|
145
146
|
export declare function acknowledgePost(postId: string): ActionFuncAsync;
|
|
146
147
|
export declare function unacknowledgePost(postId: string): ActionFuncAsync;
|
|
147
148
|
export declare function restorePostVersion(postId: string, restoreVersionId: string, connectionId: string): ActionFuncAsync;
|
package/lib/actions/posts.js
CHANGED
|
@@ -74,6 +74,7 @@ exports.addMessageIntoHistory = addMessageIntoHistory;
|
|
|
74
74
|
exports.resetHistoryIndex = resetHistoryIndex;
|
|
75
75
|
exports.moveHistoryIndexBack = moveHistoryIndexBack;
|
|
76
76
|
exports.moveHistoryIndexForward = moveHistoryIndexForward;
|
|
77
|
+
exports.resetReloadPostsInTranslatedChannels = resetReloadPostsInTranslatedChannels;
|
|
77
78
|
exports.resetReloadPostsInChannel = resetReloadPostsInChannel;
|
|
78
79
|
exports.acknowledgePost = acknowledgePost;
|
|
79
80
|
exports.unacknowledgePost = unacknowledgePost;
|
|
@@ -234,6 +235,20 @@ function createPost(post, files = [], afterSubmit) {
|
|
|
234
235
|
update_at: timestamp,
|
|
235
236
|
reply_count: 0,
|
|
236
237
|
};
|
|
238
|
+
// Add current_team_id for DM/GM posts to enable proper channel mention resolution
|
|
239
|
+
// This prevents cross-team information disclosure and makes mention resolution deterministic
|
|
240
|
+
const channel = state.entities.channels.channels[post.channel_id];
|
|
241
|
+
const currentTeamId = state.entities.teams.currentTeamId;
|
|
242
|
+
if (channel && !channel.team_id && currentTeamId) {
|
|
243
|
+
// DM/GM channel - add current team context
|
|
244
|
+
newPost = {
|
|
245
|
+
...newPost,
|
|
246
|
+
props: {
|
|
247
|
+
...newPost.props,
|
|
248
|
+
current_team_id: currentTeamId,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
237
252
|
if (post.root_id) {
|
|
238
253
|
newPost.reply_count = PostSelectors.getPostRepliesCount(state, post.root_id) + 1;
|
|
239
254
|
}
|
|
@@ -1157,16 +1172,34 @@ function moveHistoryIndexForward(index) {
|
|
|
1157
1172
|
return { data: true };
|
|
1158
1173
|
};
|
|
1159
1174
|
}
|
|
1175
|
+
function resetReloadPostsInTranslatedChannels() {
|
|
1176
|
+
return async (dispatch, getState) => {
|
|
1177
|
+
const state = getState();
|
|
1178
|
+
const channels = (0, channels_2.getAllChannels)(state);
|
|
1179
|
+
for (const channel of Object.values(channels)) {
|
|
1180
|
+
if (!channel.autotranslation) {
|
|
1181
|
+
continue;
|
|
1182
|
+
}
|
|
1183
|
+
const myMember = (0, channels_2.getMyChannelMember)(state, channel.id);
|
|
1184
|
+
if (myMember?.autotranslation_disabled) {
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
dispatch(resetReloadPostsInChannel(channel.id));
|
|
1188
|
+
}
|
|
1189
|
+
return { data: true };
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1160
1192
|
/**
|
|
1161
1193
|
* Ensures thread-replies in channels correctly follow CRT:ON/OFF
|
|
1162
1194
|
*/
|
|
1163
|
-
function resetReloadPostsInChannel() {
|
|
1195
|
+
function resetReloadPostsInChannel(channelId) {
|
|
1164
1196
|
return async (dispatch, getState) => {
|
|
1165
1197
|
dispatch({
|
|
1166
1198
|
type: action_types_1.PostTypes.RESET_POSTS_IN_CHANNEL,
|
|
1199
|
+
channelId,
|
|
1167
1200
|
});
|
|
1168
1201
|
const currentChannelId = (0, channels_2.getCurrentChannelId)(getState());
|
|
1169
|
-
if (currentChannelId) {
|
|
1202
|
+
if (currentChannelId && (!channelId || channelId === currentChannelId)) {
|
|
1170
1203
|
// wait for channel to be fully deselected; prevent stuck loading screen
|
|
1171
1204
|
// full state-change/reconciliation will cause prefetchChannelPosts to reload posts
|
|
1172
1205
|
await dispatch((0, channels_1.selectChannel)('')); // do not remove await
|
|
@@ -7,7 +7,7 @@ export declare function createSchedulePost(schedulePost: ScheduledPost, teamId:
|
|
|
7
7
|
error: any;
|
|
8
8
|
data?: undefined;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function fetchTeamScheduledPosts(teamId: string, includeDirectChannels: boolean, prune?:
|
|
10
|
+
export declare function fetchTeamScheduledPosts(teamId: string, includeDirectChannels: boolean, prune?: boolean): (dispatch: DispatchFunc, getState: GetStateFunc) => Promise<{
|
|
11
11
|
error: any;
|
|
12
12
|
data?: undefined;
|
|
13
13
|
} | {
|
package/lib/actions/search.js
CHANGED
|
@@ -29,7 +29,13 @@ function getMissingChannelsFromPosts(posts) {
|
|
|
29
29
|
const promises = [];
|
|
30
30
|
Object.values(posts).forEach((post) => {
|
|
31
31
|
const id = post.channel_id;
|
|
32
|
-
if (!channels[id]
|
|
32
|
+
if (!channels[id]) {
|
|
33
|
+
// Fetch channel data independently so a 403 on the membership request (e.g. for public channels
|
|
34
|
+
// the user hasn't joined) doesn't prevent the channel from being loaded.
|
|
35
|
+
promises.push(dispatch((0, channels_1.getChannel)(id)));
|
|
36
|
+
}
|
|
37
|
+
if (!myMembers[id]) {
|
|
38
|
+
// Best-effort: will 403 for non-member public channels, which is fine.
|
|
33
39
|
promises.push(dispatch((0, channels_1.getChannelAndMyMember)(id)));
|
|
34
40
|
}
|
|
35
41
|
if (!membersInChannel[id]) {
|
|
@@ -45,7 +51,13 @@ function getMissingChannelsFromFiles(files) {
|
|
|
45
51
|
const promises = [];
|
|
46
52
|
Object.values(files).forEach((file) => {
|
|
47
53
|
const id = file.channel_id;
|
|
48
|
-
if (!channels[id]
|
|
54
|
+
if (!channels[id]) {
|
|
55
|
+
// Fetch channel data independently so a 403 on the membership request (e.g. for public channels
|
|
56
|
+
// the user hasn't joined) doesn't prevent the channel from being loaded.
|
|
57
|
+
promises.push(dispatch((0, channels_1.getChannel)(id)));
|
|
58
|
+
}
|
|
59
|
+
if (!myMembers[id]) {
|
|
60
|
+
// Best-effort: will 403 for non-member public channels, which is fine.
|
|
49
61
|
promises.push(dispatch((0, channels_1.getChannelAndMyMember)(id)));
|
|
50
62
|
}
|
|
51
63
|
if (!membersInChannel[id]) {
|
|
@@ -15,4 +15,4 @@ export declare function receivedRemoteClusterInfo(remoteId: string, remoteInfo:
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export declare function fetchChannelRemotes(channelId: string, forceRefresh?: boolean): ActionFuncAsync<RemoteClusterInfo[]>;
|
|
18
|
-
export declare function fetchRemoteClusterInfo(remoteId: string, forceRefresh?: boolean): ActionFuncAsync<RemoteClusterInfo>;
|
|
18
|
+
export declare function fetchRemoteClusterInfo(remoteId: string, includeDeleted?: boolean, forceRefresh?: boolean): ActionFuncAsync<RemoteClusterInfo>;
|
|
@@ -55,7 +55,7 @@ function fetchChannelRemotes(channelId, forceRefresh = false) {
|
|
|
55
55
|
return { data };
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function fetchRemoteClusterInfo(remoteId, forceRefresh = false) {
|
|
58
|
+
function fetchRemoteClusterInfo(remoteId, includeDeleted, forceRefresh = false) {
|
|
59
59
|
return async (dispatch, getState) => {
|
|
60
60
|
// Check if we already have the remote info cached
|
|
61
61
|
const state = getState();
|
|
@@ -65,7 +65,7 @@ function fetchRemoteClusterInfo(remoteId, forceRefresh = false) {
|
|
|
65
65
|
}
|
|
66
66
|
let data;
|
|
67
67
|
try {
|
|
68
|
-
data = await client_1.Client4.getRemoteClusterInfo(remoteId);
|
|
68
|
+
data = await client_1.Client4.getRemoteClusterInfo(remoteId, includeDeleted);
|
|
69
69
|
}
|
|
70
70
|
catch (error) {
|
|
71
71
|
(0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
|
package/lib/actions/users.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnyAction } from 'redux';
|
|
2
2
|
import type { UserAutocomplete } from '@mattermost/types/autocomplete';
|
|
3
3
|
import type { Channel } from '@mattermost/types/channels';
|
|
4
|
-
import type { UserProfile, UserStatus, GetFilteredUsersStatsOpts, UsersStats, UserCustomStatus, UserAccessToken } from '@mattermost/types/users';
|
|
4
|
+
import type { UserProfile, UserStatus, GetFilteredUsersStatsOpts, UsersStats, UserCustomStatus, UserAccessToken, UserAuthUpdate } from '@mattermost/types/users';
|
|
5
5
|
import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
|
|
6
6
|
export declare const maxUserIdsPerProfilesRequest = 100;
|
|
7
7
|
export declare const maxUserIdsPerStatusesRequest = 200;
|
|
@@ -18,7 +18,6 @@ export declare function getProfilesByIds(userIds: string[], options?: any): Acti
|
|
|
18
18
|
export declare function getProfilesByUsernames(usernames: string[]): ActionFuncAsync<UserProfile[]>;
|
|
19
19
|
export declare function getProfilesInTeam(teamId: string, page: number, perPage?: number, sort?: string, options?: any): ActionFuncAsync<UserProfile[]>;
|
|
20
20
|
export declare function getProfilesNotInTeam(teamId: string, groupConstrained: boolean, page: number, perPage?: number): ActionFuncAsync<UserProfile[]>;
|
|
21
|
-
export declare function getProfilesWithoutTeam(page: number, perPage?: number, options?: any): ActionFuncAsync<UserProfile[]>;
|
|
22
21
|
export declare enum ProfilesInChannelSortBy {
|
|
23
22
|
None = "",
|
|
24
23
|
Admin = "admin"
|
|
@@ -61,6 +60,7 @@ export declare function searchProfiles(term: string, options?: any): ActionFuncA
|
|
|
61
60
|
export declare function updateMe(user: Partial<UserProfile>): ActionFuncAsync<UserProfile>;
|
|
62
61
|
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string | string[]): ActionFuncAsync<Record<string, string | string[]>>;
|
|
63
62
|
export declare function patchUser(user: UserProfile): ActionFuncAsync<UserProfile>;
|
|
63
|
+
export declare function updateUserAuth(userId: string, userAuth: UserAuthUpdate): ActionFuncAsync<UserAuthUpdate>;
|
|
64
64
|
export declare function updateUserRoles(userId: string, roles: string): ActionFuncAsync;
|
|
65
65
|
export declare function updateUserMfa(userId: string, activate: boolean, code?: string): ActionFuncAsync;
|
|
66
66
|
export declare function updateUserPassword(userId: string, currentPassword: string, newPassword: string): ActionFuncAsync;
|
|
@@ -105,6 +105,7 @@ declare const _default: {
|
|
|
105
105
|
getUserAudits: typeof getUserAudits;
|
|
106
106
|
searchProfiles: typeof searchProfiles;
|
|
107
107
|
updateMe: typeof updateMe;
|
|
108
|
+
updateUserAuth: typeof updateUserAuth;
|
|
108
109
|
updateUserRoles: typeof updateUserRoles;
|
|
109
110
|
updateUserMfa: typeof updateUserMfa;
|
|
110
111
|
updateUserPassword: typeof updateUserPassword;
|