mattermost-redux 10.6.0-0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/action_types/general.d.ts +4 -1
- package/lib/action_types/general.js +4 -1
- package/lib/action_types/users.d.ts +1 -0
- package/lib/action_types/users.js +1 -0
- package/lib/actions/errors.d.ts +26 -1
- package/lib/actions/errors.js +31 -9
- package/lib/actions/general.d.ts +0 -7
- package/lib/actions/general.js +1 -14
- package/lib/actions/groups.d.ts +2 -2
- package/lib/actions/groups.js +4 -2
- package/lib/actions/posts.js +1 -1
- package/lib/actions/search.d.ts +2 -2
- package/lib/actions/search.js +4 -7
- package/lib/actions/status_profile_polling.d.ts +1 -1
- package/lib/actions/status_profile_polling.js +12 -10
- package/lib/actions/threads.js +5 -0
- package/lib/actions/users.d.ts +3 -1
- package/lib/actions/users.js +37 -2
- package/lib/constants/stats.d.ts +2 -2
- package/lib/constants/stats.js +2 -2
- package/lib/constants/telemetry.d.ts +4 -0
- package/lib/constants/telemetry.js +8 -1
- package/lib/reducers/entities/admin.js +6 -6
- package/lib/reducers/entities/general.js +19 -2
- package/lib/reducers/entities/index.d.ts +3 -1
- package/lib/reducers/entities/posts.js +1 -2
- package/lib/reducers/entities/search.js +2 -1
- package/lib/reducers/entities/threads/index.js +1 -0
- package/lib/reducers/entities/threads/threadsInTeam.js +2 -0
- package/lib/reducers/entities/users.js +9 -0
- package/lib/reducers/index.d.ts +3 -1
- package/lib/selectors/entities/channels.d.ts +1 -0
- package/lib/selectors/entities/channels.js +21 -30
- package/lib/selectors/entities/general.d.ts +1 -2
- package/lib/selectors/entities/general.js +4 -5
- package/lib/selectors/entities/groups.js +2 -2
- package/lib/selectors/entities/roles.js +6 -5
- package/lib/selectors/entities/threads.d.ts +2 -2
- package/lib/selectors/entities/threads.js +2 -8
- package/lib/store/initial_state.js +1 -0
- package/lib/utils/channel_utils.js +4 -0
- package/lib/utils/file_utils.d.ts +1 -1
- package/lib/utils/file_utils.js +1 -2
- package/lib/utils/group_utils.d.ts +1 -0
- package/lib/utils/group_utils.js +5 -0
- package/package.json +3 -5
- package/lib/client/rudder.d.ts +0 -8
- package/lib/client/rudder.js +0 -112
|
@@ -4,7 +4,10 @@ declare const _default: {
|
|
|
4
4
|
CLIENT_CONFIG_RESET: "CLIENT_CONFIG_RESET";
|
|
5
5
|
CLIENT_LICENSE_RECEIVED: "CLIENT_LICENSE_RECEIVED";
|
|
6
6
|
CLIENT_LICENSE_RESET: "CLIENT_LICENSE_RESET";
|
|
7
|
-
|
|
7
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELDS_RECEIVED: "CUSTOM_PROFILE_ATTRIBUTE_FIELDS_RECEIVED";
|
|
8
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_CREATED: "CUSTOM_PROFILE_ATTRIBUTE_FIELD_CREATED";
|
|
9
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_DELETED: "CUSTOM_PROFILE_ATTRIBUTE_FIELD_DELETED";
|
|
10
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_PATCHED: "CUSTOM_PROFILE_ATTRIBUTE_FIELD_PATCHED";
|
|
8
11
|
LOG_CLIENT_ERROR_REQUEST: "LOG_CLIENT_ERROR_REQUEST";
|
|
9
12
|
LOG_CLIENT_ERROR_SUCCESS: "LOG_CLIENT_ERROR_SUCCESS";
|
|
10
13
|
LOG_CLIENT_ERROR_FAILURE: "LOG_CLIENT_ERROR_FAILURE";
|
|
@@ -12,7 +12,10 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
12
12
|
CLIENT_CONFIG_RESET: null,
|
|
13
13
|
CLIENT_LICENSE_RECEIVED: null,
|
|
14
14
|
CLIENT_LICENSE_RESET: null,
|
|
15
|
-
|
|
15
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELDS_RECEIVED: null,
|
|
16
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_CREATED: null,
|
|
17
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_DELETED: null,
|
|
18
|
+
CUSTOM_PROFILE_ATTRIBUTE_FIELD_PATCHED: null,
|
|
16
19
|
LOG_CLIENT_ERROR_REQUEST: null,
|
|
17
20
|
LOG_CLIENT_ERROR_SUCCESS: null,
|
|
18
21
|
LOG_CLIENT_ERROR_FAILURE: null,
|
|
@@ -20,6 +20,7 @@ declare const _default: {
|
|
|
20
20
|
RECEIVED_TERMS_OF_SERVICE_STATUS: "RECEIVED_TERMS_OF_SERVICE_STATUS";
|
|
21
21
|
RECEIVED_PROFILE: "RECEIVED_PROFILE";
|
|
22
22
|
RECEIVED_PROFILES: "RECEIVED_PROFILES";
|
|
23
|
+
RECEIVED_CPA_VALUES: "RECEIVED_CPA_VALUES";
|
|
23
24
|
RECEIVED_PROFILES_LIST: "RECEIVED_PROFILES_LIST";
|
|
24
25
|
RECEIVED_PROFILES_IN_TEAM: "RECEIVED_PROFILES_IN_TEAM";
|
|
25
26
|
RECEIVED_PROFILE_IN_TEAM: "RECEIVED_PROFILE_IN_TEAM";
|
|
@@ -28,6 +28,7 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
28
28
|
RECEIVED_TERMS_OF_SERVICE_STATUS: null,
|
|
29
29
|
RECEIVED_PROFILE: null,
|
|
30
30
|
RECEIVED_PROFILES: null,
|
|
31
|
+
RECEIVED_CPA_VALUES: null,
|
|
31
32
|
RECEIVED_PROFILES_LIST: null,
|
|
32
33
|
RECEIVED_PROFILES_IN_TEAM: null,
|
|
33
34
|
RECEIVED_PROFILE_IN_TEAM: null,
|
package/lib/actions/errors.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ErrorObject } from 'serialize-error';
|
|
2
2
|
import type { ServerError } from '@mattermost/types/errors';
|
|
3
|
+
import type { GlobalState } from '@mattermost/types/store';
|
|
3
4
|
import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
|
|
4
5
|
export declare function dismissError(index: number): {
|
|
5
6
|
type: "DISMISS_ERROR";
|
|
@@ -12,7 +13,31 @@ export declare function getLogErrorAction(error: ErrorObject, displayable?: bool
|
|
|
12
13
|
error: ErrorObject;
|
|
13
14
|
data: null;
|
|
14
15
|
};
|
|
15
|
-
export
|
|
16
|
+
export type LogErrorOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* errorBarMode controls how and when the error bar is shown for this error.
|
|
19
|
+
*
|
|
20
|
+
* If unspecified, this defaults to DontShow.
|
|
21
|
+
*/
|
|
22
|
+
errorBarMode?: LogErrorBarMode;
|
|
23
|
+
};
|
|
24
|
+
export declare enum LogErrorBarMode {
|
|
25
|
+
/**
|
|
26
|
+
* Always show the error bar for this error.
|
|
27
|
+
*/
|
|
28
|
+
Always = "Always",
|
|
29
|
+
/**
|
|
30
|
+
* Never show the error bar for this error.
|
|
31
|
+
*/
|
|
32
|
+
Never = "Never",
|
|
33
|
+
/**
|
|
34
|
+
* Only shows the error bar if Developer Mode is enabled, and the message displayed will tell the user to check the
|
|
35
|
+
* JS console for more information.
|
|
36
|
+
*/
|
|
37
|
+
InDevMode = "InDevMode"
|
|
38
|
+
}
|
|
39
|
+
export declare function logError(error: ServerError, options?: LogErrorOptions): ActionFuncAsync<boolean>;
|
|
40
|
+
export declare function shouldShowErrorBar(state: GlobalState, options: LogErrorOptions): boolean;
|
|
16
41
|
export declare function clearErrors(): {
|
|
17
42
|
type: "CLEAR_ERRORS";
|
|
18
43
|
data: null;
|
package/lib/actions/errors.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
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.LogErrorBarMode = void 0;
|
|
5
6
|
exports.dismissError = dismissError;
|
|
6
7
|
exports.getLogErrorAction = getLogErrorAction;
|
|
7
8
|
exports.logError = logError;
|
|
9
|
+
exports.shouldShowErrorBar = shouldShowErrorBar;
|
|
8
10
|
exports.clearErrors = clearErrors;
|
|
9
11
|
const serialize_error_1 = require("serialize-error");
|
|
10
12
|
const client4_1 = require("@mattermost/types/client4");
|
|
@@ -25,7 +27,23 @@ function getLogErrorAction(error, displayable = false) {
|
|
|
25
27
|
data: null,
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
var LogErrorBarMode;
|
|
31
|
+
(function (LogErrorBarMode) {
|
|
32
|
+
/**
|
|
33
|
+
* Always show the error bar for this error.
|
|
34
|
+
*/
|
|
35
|
+
LogErrorBarMode["Always"] = "Always";
|
|
36
|
+
/**
|
|
37
|
+
* Never show the error bar for this error.
|
|
38
|
+
*/
|
|
39
|
+
LogErrorBarMode["Never"] = "Never";
|
|
40
|
+
/**
|
|
41
|
+
* Only shows the error bar if Developer Mode is enabled, and the message displayed will tell the user to check the
|
|
42
|
+
* JS console for more information.
|
|
43
|
+
*/
|
|
44
|
+
LogErrorBarMode["InDevMode"] = "InDevMode";
|
|
45
|
+
})(LogErrorBarMode || (exports.LogErrorBarMode = LogErrorBarMode = {}));
|
|
46
|
+
function logError(error, options = {}) {
|
|
29
47
|
return async (dispatch, getState) => {
|
|
30
48
|
if (error.server_error_id === 'api.context.session_expired.app_error') {
|
|
31
49
|
return { data: true };
|
|
@@ -48,19 +66,23 @@ function logError(error, displayable = false, consoleError = false) {
|
|
|
48
66
|
// avoid crashing the app if an error sending "the error" occurs.
|
|
49
67
|
}
|
|
50
68
|
}
|
|
51
|
-
if (
|
|
69
|
+
if (options && options.errorBarMode === LogErrorBarMode.InDevMode) {
|
|
52
70
|
serializedError.message = 'A JavaScript error has occurred. Please use the JavaScript console to capture and report the error';
|
|
53
71
|
}
|
|
54
|
-
|
|
55
|
-
let shouldDisplay = displayable;
|
|
56
|
-
// Display announcements bar if error is a developer error and we are in dev mode
|
|
57
|
-
if (isDevMode && error.type === 'developer') {
|
|
58
|
-
shouldDisplay = true;
|
|
59
|
-
}
|
|
60
|
-
dispatch(getLogErrorAction(serializedError, shouldDisplay));
|
|
72
|
+
dispatch(getLogErrorAction(serializedError, shouldShowErrorBar(getState(), options)));
|
|
61
73
|
return { data: true };
|
|
62
74
|
};
|
|
63
75
|
}
|
|
76
|
+
function shouldShowErrorBar(state, options) {
|
|
77
|
+
if (options && options.errorBarMode === LogErrorBarMode.Always) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
if (options && options.errorBarMode === LogErrorBarMode.InDevMode) {
|
|
81
|
+
const isDevMode = state.entities.general.config?.EnableDeveloper === 'true';
|
|
82
|
+
return isDevMode;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
64
86
|
function clearErrors() {
|
|
65
87
|
return {
|
|
66
88
|
type: action_types_1.ErrorTypes.CLEAR_ERRORS,
|
package/lib/actions/general.d.ts
CHANGED
|
@@ -5,13 +5,6 @@ import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
|
|
|
5
5
|
export declare function getClientConfig(): ActionFuncAsync<ClientConfig>;
|
|
6
6
|
export declare function getLicenseConfig(): ActionFuncAsync<import("@mattermost/types/config").ClientLicense, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
|
7
7
|
export declare function getCustomProfileAttributeFields(): ActionFuncAsync<import("@mattermost/types/properties").UserPropertyField[], import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
|
8
|
-
export declare function getCustomProfileAttributeValues(userID: string): () => Promise<{
|
|
9
|
-
error: any;
|
|
10
|
-
data?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
data: Record<string, string>;
|
|
13
|
-
error?: undefined;
|
|
14
|
-
}>;
|
|
15
8
|
export declare function logClientError(message: string, level?: LogLevel): ActionFuncAsync<{
|
|
16
9
|
message: string;
|
|
17
10
|
}, import("@mattermost/types/store").GlobalState, import("redux").AnyAction>;
|
package/lib/actions/general.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.getClientConfig = getClientConfig;
|
|
6
6
|
exports.getLicenseConfig = getLicenseConfig;
|
|
7
7
|
exports.getCustomProfileAttributeFields = getCustomProfileAttributeFields;
|
|
8
|
-
exports.getCustomProfileAttributeValues = getCustomProfileAttributeValues;
|
|
9
8
|
exports.logClientError = logClientError;
|
|
10
9
|
exports.setServerVersion = setServerVersion;
|
|
11
10
|
exports.setUrl = setUrl;
|
|
@@ -45,21 +44,9 @@ function getLicenseConfig() {
|
|
|
45
44
|
function getCustomProfileAttributeFields() {
|
|
46
45
|
return (0, helpers_1.bindClientFunc)({
|
|
47
46
|
clientFunc: client_1.Client4.getCustomProfileAttributeFields,
|
|
48
|
-
onSuccess: [action_types_1.GeneralTypes.
|
|
47
|
+
onSuccess: [action_types_1.GeneralTypes.CUSTOM_PROFILE_ATTRIBUTE_FIELDS_RECEIVED],
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
|
-
function getCustomProfileAttributeValues(userID) {
|
|
52
|
-
return async () => {
|
|
53
|
-
let data;
|
|
54
|
-
try {
|
|
55
|
-
data = await client_1.Client4.getUserCustomProfileAttributesValues(userID);
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
return { error };
|
|
59
|
-
}
|
|
60
|
-
return { data };
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
50
|
function logClientError(message, level = client4_1.LogLevel.Error) {
|
|
64
51
|
return (0, helpers_1.bindClientFunc)({
|
|
65
52
|
clientFunc: client_1.Client4.logClientError,
|
package/lib/actions/groups.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export declare function getGroupSyncables(groupID: string, syncableType: Syncabl
|
|
|
9
9
|
export declare function patchGroupSyncable(groupID: string, syncableID: string, syncableType: SyncableType, patch: Partial<SyncablePatch>): ActionFuncAsync;
|
|
10
10
|
export declare function getGroup(id: string, includeMemberCount?: boolean): ActionFuncAsync<Group, import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
11
11
|
export declare function getGroups(opts: GetGroupsParams): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
12
|
-
export declare function getGroupsNotAssociatedToTeam(teamID: string, q?: string, page?: number, perPage?: number, source?: GroupSource): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
13
|
-
export declare function getGroupsNotAssociatedToChannel(channelID: string, q?: string, page?: number, perPage?: number, filterParentTeamPermitted?: boolean, source?: GroupSource): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
12
|
+
export declare function getGroupsNotAssociatedToTeam(teamID: string, q?: string, page?: number, perPage?: number, source?: GroupSource | string, onlySyncableSources?: boolean): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
13
|
+
export declare function getGroupsNotAssociatedToChannel(channelID: string, q?: string, page?: number, perPage?: number, filterParentTeamPermitted?: boolean, source?: GroupSource | string, onlySyncableSources?: boolean): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
14
14
|
export declare function getAllGroupsAssociatedToTeam(teamID: string, filterAllowReference?: boolean, includeMemberCount?: boolean): ActionFuncAsync<import("@mattermost/types/groups").GroupsWithCount, import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
15
15
|
export declare function getAllGroupsAssociatedToChannelsInTeam(teamID: string, filterAllowReference?: boolean): ActionFuncAsync<{
|
|
16
16
|
groupsByChannelId: import("@mattermost/types/utilities").RelationOneToOne<import("@mattermost/types/channels").Channel, Group>;
|
package/lib/actions/groups.js
CHANGED
|
@@ -170,7 +170,7 @@ function getGroups(opts) {
|
|
|
170
170
|
],
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
function getGroupsNotAssociatedToTeam(teamID, q = '', page = 0, perPage = constants_1.General.PAGE_SIZE_DEFAULT, source = groups_1.GroupSource.Ldap) {
|
|
173
|
+
function getGroupsNotAssociatedToTeam(teamID, q = '', page = 0, perPage = constants_1.General.PAGE_SIZE_DEFAULT, source = groups_1.GroupSource.Ldap, onlySyncableSources = false) {
|
|
174
174
|
return (0, helpers_1.bindClientFunc)({
|
|
175
175
|
clientFunc: client_1.Client4.getGroupsNotAssociatedToTeam,
|
|
176
176
|
onSuccess: [action_types_1.GroupTypes.RECEIVED_GROUPS],
|
|
@@ -180,10 +180,11 @@ function getGroupsNotAssociatedToTeam(teamID, q = '', page = 0, perPage = consta
|
|
|
180
180
|
page,
|
|
181
181
|
perPage,
|
|
182
182
|
source,
|
|
183
|
+
onlySyncableSources,
|
|
183
184
|
],
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
|
-
function getGroupsNotAssociatedToChannel(channelID, q = '', page = 0, perPage = constants_1.General.PAGE_SIZE_DEFAULT, filterParentTeamPermitted = false, source = groups_1.GroupSource.Ldap) {
|
|
187
|
+
function getGroupsNotAssociatedToChannel(channelID, q = '', page = 0, perPage = constants_1.General.PAGE_SIZE_DEFAULT, filterParentTeamPermitted = false, source = groups_1.GroupSource.Ldap, onlySyncableSources = false) {
|
|
187
188
|
return (0, helpers_1.bindClientFunc)({
|
|
188
189
|
clientFunc: client_1.Client4.getGroupsNotAssociatedToChannel,
|
|
189
190
|
onSuccess: [action_types_1.GroupTypes.RECEIVED_GROUPS],
|
|
@@ -194,6 +195,7 @@ function getGroupsNotAssociatedToChannel(channelID, q = '', page = 0, perPage =
|
|
|
194
195
|
perPage,
|
|
195
196
|
filterParentTeamPermitted,
|
|
196
197
|
source,
|
|
198
|
+
onlySyncableSources,
|
|
197
199
|
],
|
|
198
200
|
});
|
|
199
201
|
}
|
package/lib/actions/posts.js
CHANGED
|
@@ -1191,7 +1191,7 @@ function restorePostVersion(postId, restoreVersionId, connectionId) {
|
|
|
1191
1191
|
catch (error) {
|
|
1192
1192
|
// Send to error bar if it's an edit post error about time limit.
|
|
1193
1193
|
if (error.server_error_id === 'api.post.update_post.permissions_time_limit.app_error') {
|
|
1194
|
-
dispatch((0, errors_1.logError)({ type: 'announcement', message: error.message },
|
|
1194
|
+
dispatch((0, errors_1.logError)({ type: 'announcement', message: error.message }, { errorBarMode: errors_1.LogErrorBarMode.Always }));
|
|
1195
1195
|
}
|
|
1196
1196
|
else {
|
|
1197
1197
|
dispatch((0, errors_1.logError)(error));
|
package/lib/actions/search.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export declare function getMissingChannelsFromPosts(posts: PostList['posts']): T
|
|
|
7
7
|
export declare function getMissingChannelsFromFiles(files: Map<string, FileSearchResultItem>): ThunkActionFunc<Promise<ActionResult[]>>;
|
|
8
8
|
export declare function searchPostsWithParams(teamId: string, params: SearchParameter): ActionFuncAsync<PostSearchResults>;
|
|
9
9
|
export declare function searchPosts(teamId: string, terms: string, isOrSearch: boolean, includeDeletedChannels: boolean): ActionFuncAsync<PostSearchResults>;
|
|
10
|
-
export declare function getMorePostsForSearch(): ActionFuncAsync;
|
|
10
|
+
export declare function getMorePostsForSearch(teamId: string): ActionFuncAsync;
|
|
11
11
|
export declare function clearSearch(): ActionFuncAsync;
|
|
12
12
|
export declare function searchFilesWithParams(teamId: string, params: SearchParameter): ActionFuncAsync;
|
|
13
|
-
export declare function getMoreFilesForSearch(): ActionFuncAsync;
|
|
13
|
+
export declare function getMoreFilesForSearch(teamId: string): ActionFuncAsync;
|
|
14
14
|
export declare function getFlaggedPosts(): ActionFuncAsync<PostList>;
|
|
15
15
|
export declare function getPinnedPosts(channelId: string): ActionFuncAsync;
|
|
16
16
|
declare const _default: {
|
package/lib/actions/search.js
CHANGED
|
@@ -16,7 +16,6 @@ exports.getPinnedPosts = getPinnedPosts;
|
|
|
16
16
|
const redux_batched_actions_1 = require("redux-batched-actions");
|
|
17
17
|
const action_types_1 = require("mattermost-redux/action_types");
|
|
18
18
|
const client_1 = require("mattermost-redux/client");
|
|
19
|
-
const teams_1 = require("mattermost-redux/selectors/entities/teams");
|
|
20
19
|
const users_1 = require("mattermost-redux/selectors/entities/users");
|
|
21
20
|
const channels_1 = require("./channels");
|
|
22
21
|
const errors_1 = require("./errors");
|
|
@@ -101,10 +100,9 @@ function searchPostsWithParams(teamId, params) {
|
|
|
101
100
|
function searchPosts(teamId, terms, isOrSearch, includeDeletedChannels) {
|
|
102
101
|
return searchPostsWithParams(teamId, { terms, is_or_search: isOrSearch, include_deleted_channels: includeDeletedChannels, page: 0, per_page: exports.WEBAPP_SEARCH_PER_PAGE });
|
|
103
102
|
}
|
|
104
|
-
function getMorePostsForSearch() {
|
|
103
|
+
function getMorePostsForSearch(teamId) {
|
|
105
104
|
return async (dispatch, getState) => {
|
|
106
|
-
const
|
|
107
|
-
const { params, isEnd } = getState().entities.search.current[teamId];
|
|
105
|
+
const { params, isEnd } = getState().entities.search.current[teamId || 'ALL_TEAMS'];
|
|
108
106
|
if (!isEnd) {
|
|
109
107
|
const newParams = Object.assign({}, params);
|
|
110
108
|
newParams.page += 1;
|
|
@@ -159,10 +157,9 @@ function searchFilesWithParams(teamId, params) {
|
|
|
159
157
|
return { data: files };
|
|
160
158
|
};
|
|
161
159
|
}
|
|
162
|
-
function getMoreFilesForSearch() {
|
|
160
|
+
function getMoreFilesForSearch(teamId) {
|
|
163
161
|
return async (dispatch, getState) => {
|
|
164
|
-
const
|
|
165
|
-
const { params, isFilesEnd } = getState().entities.search.current[teamId];
|
|
162
|
+
const { params, isFilesEnd } = getState().entities.search.current[teamId || 'ALL_TEAMS'];
|
|
166
163
|
if (!isFilesEnd) {
|
|
167
164
|
const newParams = Object.assign({}, params);
|
|
168
165
|
newParams.page += 1;
|
|
@@ -17,4 +17,4 @@ export declare function cleanUpStatusAndProfileFetchingPoll(): ThunkActionFunc<v
|
|
|
17
17
|
* This action however doesn't refetch the profiles and statuses except for groups if they are already fetched once
|
|
18
18
|
*/
|
|
19
19
|
export declare function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap: Post[] | PostList['posts'] | Post): ActionFunc<boolean>;
|
|
20
|
-
export declare function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups: string[]): ActionFuncAsync<string[]>;
|
|
20
|
+
export declare function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups: string[], isLicensed: boolean): ActionFuncAsync<string[]>;
|
|
@@ -147,12 +147,12 @@ function batchFetchStatusesProfilesGroupsFromPosts(postsArrayOrMap) {
|
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
if (mentionedUsernamesAndGroupsInPosts.size > 0) {
|
|
150
|
-
dispatch(getUsersFromMentionedUsernamesAndGroups(Array.from(mentionedUsernamesAndGroupsInPosts)));
|
|
150
|
+
dispatch(getUsersFromMentionedUsernamesAndGroups(Array.from(mentionedUsernamesAndGroupsInPosts), (0, general_1.getLicense)(state).IsLicensed === 'true'));
|
|
151
151
|
}
|
|
152
152
|
return { data: true };
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups) {
|
|
155
|
+
function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups, isLicensed) {
|
|
156
156
|
return async (dispatch) => {
|
|
157
157
|
// We run the at-mentioned be it user or group through the user profile search
|
|
158
158
|
const { data: userProfiles } = await dispatch((0, users_1.getProfilesByUsernames)(usernamesAndGroups));
|
|
@@ -167,14 +167,16 @@ function getUsersFromMentionedUsernamesAndGroups(usernamesAndGroups) {
|
|
|
167
167
|
}
|
|
168
168
|
// Removing usernames from the list will leave only the group names
|
|
169
169
|
const mentionedGroups = usernamesAndGroups.filter((name) => !mentionedUsernames.includes(name));
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
if (isLicensed) {
|
|
171
|
+
for (const group of mentionedGroups) {
|
|
172
|
+
const groupSearchParam = {
|
|
173
|
+
q: group,
|
|
174
|
+
filter_allow_reference: true,
|
|
175
|
+
page: 0,
|
|
176
|
+
per_page: 60,
|
|
177
|
+
};
|
|
178
|
+
dispatch((0, groups_1.searchGroups)(groupSearchParam));
|
|
179
|
+
}
|
|
178
180
|
}
|
|
179
181
|
return { data: mentionedGroups };
|
|
180
182
|
};
|
package/lib/actions/threads.js
CHANGED
|
@@ -37,6 +37,7 @@ const users_2 = require("mattermost-redux/selectors/entities/users");
|
|
|
37
37
|
const errors_1 = require("./errors");
|
|
38
38
|
const helpers_1 = require("./helpers");
|
|
39
39
|
const posts_2 = require("./posts");
|
|
40
|
+
const teams_2 = require("./teams");
|
|
40
41
|
function fetchThreads(userId, teamId, { before = '', after = '', perPage = threads_1.default.THREADS_CHUNK_SIZE, unread = false, totalsOnly = false, threadsOnly = false, extended = false, since = 0 } = {}) {
|
|
41
42
|
return async (dispatch, getState) => {
|
|
42
43
|
let data;
|
|
@@ -329,6 +330,10 @@ function setThreadFollow(userId, teamId, threadId, newState) {
|
|
|
329
330
|
dispatch((0, errors_1.logError)(error));
|
|
330
331
|
return { error };
|
|
331
332
|
}
|
|
333
|
+
// As a short term fix for https://mattermost.atlassian.net/browse/MM-62113, we will fetch
|
|
334
|
+
// the users team unreads after following or unfollowing a thread. This will ensure that the unreads are
|
|
335
|
+
// updated correctly in the case where the user is following or unfollowing a thread that has unread messages.
|
|
336
|
+
dispatch((0, teams_2.getMyTeamUnreads)((0, preferences_1.isCollapsedThreadsEnabled)(getState())));
|
|
332
337
|
return {};
|
|
333
338
|
};
|
|
334
339
|
}
|
package/lib/actions/users.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare function batchGetProfilesInChannel(channelId: string): ActionFunc
|
|
|
30
30
|
export declare function getProfilesInGroupChannels(channelsIds: string[]): ActionFuncAsync;
|
|
31
31
|
export declare function getProfilesNotInChannel(teamId: string, channelId: string, groupConstrained: boolean, page: number, perPage?: number): ActionFuncAsync<UserProfile[]>;
|
|
32
32
|
export declare function getMe(): ActionFuncAsync<UserProfile>;
|
|
33
|
+
export declare function getCustomProfileAttributeValues(userID: string): ActionFuncAsync<Record<string, string>>;
|
|
33
34
|
export declare function updateMyTermsOfServiceStatus(termsOfServiceId: string, accepted: boolean): ActionFuncAsync;
|
|
34
35
|
export declare function getProfilesInGroup(groupId: string, page?: number, perPage?: number, sort?: string): ActionFuncAsync<UserProfile[]>;
|
|
35
36
|
export declare function getProfilesNotInGroup(groupId: string, page?: number, perPage?: number): ActionFuncAsync<UserProfile[]>;
|
|
@@ -55,11 +56,12 @@ export declare function autocompleteUsers(term: string, teamId?: string, channel
|
|
|
55
56
|
}): ActionFuncAsync<UserAutocomplete>;
|
|
56
57
|
export declare function searchProfiles(term: string, options?: any): ActionFuncAsync<UserProfile[]>;
|
|
57
58
|
export declare function updateMe(user: Partial<UserProfile>): ActionFuncAsync<UserProfile>;
|
|
58
|
-
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string): ActionFuncAsync
|
|
59
|
+
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string): ActionFuncAsync<Record<string, string>>;
|
|
59
60
|
export declare function patchUser(user: UserProfile): ActionFuncAsync<UserProfile>;
|
|
60
61
|
export declare function updateUserRoles(userId: string, roles: string): ActionFuncAsync;
|
|
61
62
|
export declare function updateUserMfa(userId: string, activate: boolean, code?: string): ActionFuncAsync;
|
|
62
63
|
export declare function updateUserPassword(userId: string, currentPassword: string, newPassword: string): ActionFuncAsync;
|
|
64
|
+
export declare function resetFailedAttempts(userId: string): ActionFuncAsync<true>;
|
|
63
65
|
export declare function updateUserActive(userId: string, active: boolean): ActionFuncAsync<true>;
|
|
64
66
|
export declare function verifyUserEmail(token: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
65
67
|
export declare function sendVerificationEmail(email: string): ActionFuncAsync<import("@mattermost/types/client4").StatusOK, import("@mattermost/types/store").GlobalState, AnyAction>;
|
package/lib/actions/users.js
CHANGED
|
@@ -22,6 +22,7 @@ exports.batchGetProfilesInChannel = batchGetProfilesInChannel;
|
|
|
22
22
|
exports.getProfilesInGroupChannels = getProfilesInGroupChannels;
|
|
23
23
|
exports.getProfilesNotInChannel = getProfilesNotInChannel;
|
|
24
24
|
exports.getMe = getMe;
|
|
25
|
+
exports.getCustomProfileAttributeValues = getCustomProfileAttributeValues;
|
|
25
26
|
exports.updateMyTermsOfServiceStatus = updateMyTermsOfServiceStatus;
|
|
26
27
|
exports.getProfilesInGroup = getProfilesInGroup;
|
|
27
28
|
exports.getProfilesNotInGroup = getProfilesNotInGroup;
|
|
@@ -50,6 +51,7 @@ exports.patchUser = patchUser;
|
|
|
50
51
|
exports.updateUserRoles = updateUserRoles;
|
|
51
52
|
exports.updateUserMfa = updateUserMfa;
|
|
52
53
|
exports.updateUserPassword = updateUserPassword;
|
|
54
|
+
exports.resetFailedAttempts = resetFailedAttempts;
|
|
53
55
|
exports.updateUserActive = updateUserActive;
|
|
54
56
|
exports.verifyUserEmail = verifyUserEmail;
|
|
55
57
|
exports.sendVerificationEmail = sendVerificationEmail;
|
|
@@ -470,6 +472,22 @@ function getMe() {
|
|
|
470
472
|
return me;
|
|
471
473
|
};
|
|
472
474
|
}
|
|
475
|
+
function getCustomProfileAttributeValues(userID) {
|
|
476
|
+
return async (dispatch) => {
|
|
477
|
+
let data;
|
|
478
|
+
try {
|
|
479
|
+
data = await client_1.Client4.getUserCustomProfileAttributesValues(userID);
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
return { error };
|
|
483
|
+
}
|
|
484
|
+
dispatch({
|
|
485
|
+
type: action_types_1.UserTypes.RECEIVED_CPA_VALUES,
|
|
486
|
+
data: { userID, customAttributeValues: data },
|
|
487
|
+
});
|
|
488
|
+
return { data };
|
|
489
|
+
};
|
|
490
|
+
}
|
|
473
491
|
function updateMyTermsOfServiceStatus(termsOfServiceId, accepted) {
|
|
474
492
|
return async (dispatch, getState) => {
|
|
475
493
|
const response = await dispatch((0, helpers_1.bindClientFunc)({
|
|
@@ -905,13 +923,14 @@ function updateMe(user) {
|
|
|
905
923
|
function saveCustomProfileAttribute(userID, attributeID, attributeValue) {
|
|
906
924
|
return async (dispatch) => {
|
|
907
925
|
try {
|
|
908
|
-
|
|
926
|
+
const values = { [attributeID]: attributeValue.trim() };
|
|
927
|
+
const data = await client_1.Client4.updateCustomProfileAttributeValues(values);
|
|
928
|
+
return { data };
|
|
909
929
|
}
|
|
910
930
|
catch (error) {
|
|
911
931
|
dispatch((0, errors_1.logError)(error));
|
|
912
932
|
return { error };
|
|
913
933
|
}
|
|
914
|
-
return { data: true };
|
|
915
934
|
};
|
|
916
935
|
}
|
|
917
936
|
function patchUser(user) {
|
|
@@ -975,6 +994,22 @@ function updateUserPassword(userId, currentPassword, newPassword) {
|
|
|
975
994
|
return { data: true };
|
|
976
995
|
};
|
|
977
996
|
}
|
|
997
|
+
function resetFailedAttempts(userId) {
|
|
998
|
+
return async (dispatch, getState) => {
|
|
999
|
+
try {
|
|
1000
|
+
await client_1.Client4.resetFailedAttempts(userId);
|
|
1001
|
+
}
|
|
1002
|
+
catch (error) {
|
|
1003
|
+
dispatch((0, errors_1.logError)(error));
|
|
1004
|
+
return { error };
|
|
1005
|
+
}
|
|
1006
|
+
const profile = getState().entities.users.profiles[userId];
|
|
1007
|
+
if (profile) {
|
|
1008
|
+
dispatch({ type: action_types_1.UserTypes.RECEIVED_PROFILE, data: { ...profile, failed_attempts: 0 } });
|
|
1009
|
+
}
|
|
1010
|
+
return { data: true };
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
978
1013
|
function updateUserActive(userId, active) {
|
|
979
1014
|
return async (dispatch, getState) => {
|
|
980
1015
|
try {
|
package/lib/constants/stats.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ declare const _default: {
|
|
|
5
5
|
TOTAL_PRIVATE_GROUPS: "TOTAL_PRIVATE_GROUPS";
|
|
6
6
|
TOTAL_POSTS: "TOTAL_POSTS";
|
|
7
7
|
TOTAL_TEAMS: "TOTAL_TEAMS";
|
|
8
|
-
TOTAL_FILE_POSTS: "TOTAL_FILE_POSTS";
|
|
9
|
-
TOTAL_HASHTAG_POSTS: "TOTAL_HASHTAG_POSTS";
|
|
10
8
|
TOTAL_IHOOKS: "TOTAL_IHOOKS";
|
|
11
9
|
TOTAL_OHOOKS: "TOTAL_OHOOKS";
|
|
12
10
|
TOTAL_COMMANDS: "TOTAL_COMMANDS";
|
|
@@ -22,5 +20,7 @@ declare const _default: {
|
|
|
22
20
|
DAILY_ACTIVE_USERS: "DAILY_ACTIVE_USERS";
|
|
23
21
|
MONTHLY_ACTIVE_USERS: "MONTHLY_ACTIVE_USERS";
|
|
24
22
|
REGISTERED_USERS: "REGISTERED_USERS";
|
|
23
|
+
TOTAL_FILE_COUNT: "TOTAL_FILE_COUNT";
|
|
24
|
+
TOTAL_FILE_SIZE: "TOTAL_FILE_SIZE";
|
|
25
25
|
};
|
|
26
26
|
export default _default;
|
package/lib/constants/stats.js
CHANGED
|
@@ -13,8 +13,6 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
13
13
|
TOTAL_PRIVATE_GROUPS: null,
|
|
14
14
|
TOTAL_POSTS: null,
|
|
15
15
|
TOTAL_TEAMS: null,
|
|
16
|
-
TOTAL_FILE_POSTS: null,
|
|
17
|
-
TOTAL_HASHTAG_POSTS: null,
|
|
18
16
|
TOTAL_IHOOKS: null,
|
|
19
17
|
TOTAL_OHOOKS: null,
|
|
20
18
|
TOTAL_COMMANDS: null,
|
|
@@ -30,4 +28,6 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
30
28
|
DAILY_ACTIVE_USERS: null,
|
|
31
29
|
MONTHLY_ACTIVE_USERS: null,
|
|
32
30
|
REGISTERED_USERS: null,
|
|
31
|
+
TOTAL_FILE_COUNT: null,
|
|
32
|
+
TOTAL_FILE_SIZE: null,
|
|
33
33
|
});
|
|
@@ -3,8 +3,12 @@ export declare const TrackEnterpriseSKU = "enterprise";
|
|
|
3
3
|
export declare const TrackGroupsFeature = "custom_groups";
|
|
4
4
|
export declare const TrackPassiveKeywordsFeature = "passive_keywords";
|
|
5
5
|
export declare const TrackScheduledPostsFeature = "scheduled_posts";
|
|
6
|
+
export declare const TrackCrossTeamSearchFeature = "cross_team_search";
|
|
6
7
|
export declare const TrackInviteGroupEvent = "invite_group_to_channel__add_member";
|
|
7
8
|
export declare const TrackPassiveKeywordsEvent = "update_passive_keywords";
|
|
9
|
+
export declare const TrackCrossTeamSearchCurrentTeamEvent = "cross_team_search__current_team";
|
|
10
|
+
export declare const TrackCrossTeamSearchDifferentTeamEvent = "cross_team_search__different_team";
|
|
11
|
+
export declare const TrackCrossTeamSearchAllTeamsEvent = "cross_team_search__all_teams";
|
|
8
12
|
export declare const TrackActionCategory = "action";
|
|
9
13
|
export declare const TrackMiscCategory = "miscellaneous";
|
|
10
14
|
export declare const TrackPropertyUser = "user_actual_id";
|
|
@@ -2,7 +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.eventCategory = exports.eventSKUs = exports.TrackPropertyUserAgent = exports.TrackPropertyUser = exports.TrackMiscCategory = exports.TrackActionCategory = exports.TrackPassiveKeywordsEvent = exports.TrackInviteGroupEvent = exports.TrackScheduledPostsFeature = exports.TrackPassiveKeywordsFeature = exports.TrackGroupsFeature = exports.TrackEnterpriseSKU = exports.TrackProfessionalSKU = void 0;
|
|
5
|
+
exports.eventCategory = exports.eventSKUs = exports.TrackPropertyUserAgent = exports.TrackPropertyUser = exports.TrackMiscCategory = exports.TrackActionCategory = exports.TrackCrossTeamSearchAllTeamsEvent = exports.TrackCrossTeamSearchDifferentTeamEvent = exports.TrackCrossTeamSearchCurrentTeamEvent = exports.TrackPassiveKeywordsEvent = exports.TrackInviteGroupEvent = exports.TrackCrossTeamSearchFeature = exports.TrackScheduledPostsFeature = exports.TrackPassiveKeywordsFeature = exports.TrackGroupsFeature = exports.TrackEnterpriseSKU = exports.TrackProfessionalSKU = void 0;
|
|
6
6
|
// SKUs
|
|
7
7
|
exports.TrackProfessionalSKU = 'professional';
|
|
8
8
|
exports.TrackEnterpriseSKU = 'enterprise';
|
|
@@ -10,9 +10,13 @@ exports.TrackEnterpriseSKU = 'enterprise';
|
|
|
10
10
|
exports.TrackGroupsFeature = 'custom_groups';
|
|
11
11
|
exports.TrackPassiveKeywordsFeature = 'passive_keywords';
|
|
12
12
|
exports.TrackScheduledPostsFeature = 'scheduled_posts';
|
|
13
|
+
exports.TrackCrossTeamSearchFeature = 'cross_team_search';
|
|
13
14
|
// Events
|
|
14
15
|
exports.TrackInviteGroupEvent = 'invite_group_to_channel__add_member';
|
|
15
16
|
exports.TrackPassiveKeywordsEvent = 'update_passive_keywords';
|
|
17
|
+
exports.TrackCrossTeamSearchCurrentTeamEvent = 'cross_team_search__current_team';
|
|
18
|
+
exports.TrackCrossTeamSearchDifferentTeamEvent = 'cross_team_search__different_team';
|
|
19
|
+
exports.TrackCrossTeamSearchAllTeamsEvent = 'cross_team_search__all_teams';
|
|
16
20
|
// Categories
|
|
17
21
|
exports.TrackActionCategory = 'action';
|
|
18
22
|
exports.TrackMiscCategory = 'miscellaneous';
|
|
@@ -26,4 +30,7 @@ exports.eventSKUs = {
|
|
|
26
30
|
exports.eventCategory = {
|
|
27
31
|
[exports.TrackInviteGroupEvent]: exports.TrackActionCategory,
|
|
28
32
|
[exports.TrackPassiveKeywordsEvent]: exports.TrackActionCategory,
|
|
33
|
+
[exports.TrackCrossTeamSearchAllTeamsEvent]: exports.TrackActionCategory,
|
|
34
|
+
[exports.TrackCrossTeamSearchCurrentTeamEvent]: exports.TrackActionCategory,
|
|
35
|
+
[exports.TrackCrossTeamSearchDifferentTeamEvent]: exports.TrackActionCategory,
|
|
29
36
|
};
|
|
@@ -188,12 +188,6 @@ function convertAnalyticsRowsToStats(data, name) {
|
|
|
188
188
|
case 'monthly_active_users':
|
|
189
189
|
key = constants_1.Stats.MONTHLY_ACTIVE_USERS;
|
|
190
190
|
break;
|
|
191
|
-
case 'file_post_count':
|
|
192
|
-
key = constants_1.Stats.TOTAL_FILE_POSTS;
|
|
193
|
-
break;
|
|
194
|
-
case 'hashtag_post_count':
|
|
195
|
-
key = constants_1.Stats.TOTAL_HASHTAG_POSTS;
|
|
196
|
-
break;
|
|
197
191
|
case 'incoming_webhook_count':
|
|
198
192
|
key = constants_1.Stats.TOTAL_IHOOKS;
|
|
199
193
|
break;
|
|
@@ -209,6 +203,12 @@ function convertAnalyticsRowsToStats(data, name) {
|
|
|
209
203
|
case 'registered_users':
|
|
210
204
|
key = constants_1.Stats.REGISTERED_USERS;
|
|
211
205
|
break;
|
|
206
|
+
case 'total_file_count':
|
|
207
|
+
key = constants_1.Stats.TOTAL_FILE_COUNT;
|
|
208
|
+
break;
|
|
209
|
+
case 'total_file_size':
|
|
210
|
+
key = constants_1.Stats.TOTAL_FILE_SIZE;
|
|
211
|
+
break;
|
|
212
212
|
}
|
|
213
213
|
if (key) {
|
|
214
214
|
stats[key] = row.value;
|
|
@@ -32,13 +32,30 @@ function license(state = {}, action) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function customProfileAttributes(state = {}, action) {
|
|
35
|
-
const data = action.data;
|
|
36
35
|
switch (action.type) {
|
|
37
|
-
case action_types_1.GeneralTypes.
|
|
36
|
+
case action_types_1.GeneralTypes.CUSTOM_PROFILE_ATTRIBUTE_FIELDS_RECEIVED: {
|
|
37
|
+
const data = action.data;
|
|
38
38
|
return data.reduce((acc, field) => {
|
|
39
39
|
acc[field.id] = field;
|
|
40
40
|
return acc;
|
|
41
41
|
}, {});
|
|
42
|
+
}
|
|
43
|
+
case action_types_1.GeneralTypes.CUSTOM_PROFILE_ATTRIBUTE_FIELD_DELETED: {
|
|
44
|
+
const nextState = { ...state };
|
|
45
|
+
const fieldId = action.data;
|
|
46
|
+
if (Object.hasOwn(nextState, fieldId)) {
|
|
47
|
+
Reflect.deleteProperty(nextState, fieldId);
|
|
48
|
+
return nextState;
|
|
49
|
+
}
|
|
50
|
+
return state;
|
|
51
|
+
}
|
|
52
|
+
case action_types_1.GeneralTypes.CUSTOM_PROFILE_ATTRIBUTE_FIELD_CREATED:
|
|
53
|
+
case action_types_1.GeneralTypes.CUSTOM_PROFILE_ATTRIBUTE_FIELD_PATCHED: {
|
|
54
|
+
return {
|
|
55
|
+
...state,
|
|
56
|
+
[action.data.id]: action.data,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
42
59
|
default:
|
|
43
60
|
return state;
|
|
44
61
|
}
|
|
@@ -67,7 +67,9 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
67
67
|
}>;
|
|
68
68
|
preferences: import("redux").CombinedState<{
|
|
69
69
|
myPreferences: any;
|
|
70
|
-
userPreferences:
|
|
70
|
+
userPreferences: {
|
|
71
|
+
[key: string]: import("@mattermost/types/preferences").PreferencesType;
|
|
72
|
+
};
|
|
71
73
|
}>;
|
|
72
74
|
typing: import("@mattermost/types/typing").Typing;
|
|
73
75
|
integrations: import("redux").CombinedState<{
|
|
@@ -20,7 +20,6 @@ exports.limitedViews = limitedViews;
|
|
|
20
20
|
exports.default = reducer;
|
|
21
21
|
const action_types_1 = require("mattermost-redux/action_types");
|
|
22
22
|
const constants_1 = require("mattermost-redux/constants");
|
|
23
|
-
const posts_1 = require("mattermost-redux/constants/posts");
|
|
24
23
|
const post_utils_1 = require("mattermost-redux/utils/post_utils");
|
|
25
24
|
function removeUnneededMetadata(post) {
|
|
26
25
|
if (!post.metadata) {
|
|
@@ -387,7 +386,7 @@ function postsInChannel(state = {}, action, prevPosts, nextPosts) {
|
|
|
387
386
|
}
|
|
388
387
|
case action_types_1.PostTypes.RECEIVED_NEW_POST: {
|
|
389
388
|
const post = action.data;
|
|
390
|
-
if (action.features?.crtEnabled && post.root_id
|
|
389
|
+
if (action.features?.crtEnabled && post.root_id) {
|
|
391
390
|
return state;
|
|
392
391
|
}
|
|
393
392
|
const postsForChannel = state[post.channel_id];
|
|
@@ -180,7 +180,8 @@ function current(state = {}, action) {
|
|
|
180
180
|
switch (action.type) {
|
|
181
181
|
case action_types_1.SearchTypes.RECEIVED_SEARCH_TERM: {
|
|
182
182
|
const nextState = { ...state };
|
|
183
|
-
const {
|
|
183
|
+
const { params, isEnd, isFilesEnd } = action.data;
|
|
184
|
+
const teamId = action.data.teamId || 'ALL_TEAMS';
|
|
184
185
|
return {
|
|
185
186
|
...nextState,
|
|
186
187
|
[teamId]: {
|
|
@@ -188,6 +188,7 @@ const threadsInTeamReducer = (state = {}, action, extra) => {
|
|
|
188
188
|
switch (action.type) {
|
|
189
189
|
case action_types_1.ThreadTypes.RECEIVED_THREAD:
|
|
190
190
|
return handleReceivedThread(state, action, extra);
|
|
191
|
+
case action_types_1.PostTypes.POST_DELETED:
|
|
191
192
|
case action_types_1.PostTypes.POST_REMOVED:
|
|
192
193
|
return handlePostRemoved(state, action);
|
|
193
194
|
case action_types_1.ThreadTypes.RECEIVED_THREADS:
|
|
@@ -230,6 +231,7 @@ const unreadThreadsInTeamReducer = (state = {}, action, extra) => {
|
|
|
230
231
|
threads: action.data.threads.filter((thread) => thread.unread_replies > 0 || thread.unread_mentions > 0),
|
|
231
232
|
},
|
|
232
233
|
});
|
|
234
|
+
case action_types_1.PostTypes.POST_DELETED:
|
|
233
235
|
case action_types_1.PostTypes.POST_REMOVED:
|
|
234
236
|
return handlePostRemoved(state, action);
|
|
235
237
|
case action_types_1.ThreadTypes.RECEIVED_UNREAD_THREADS:
|
|
@@ -187,6 +187,15 @@ function profiles(state = {}, action) {
|
|
|
187
187
|
const user = action.data;
|
|
188
188
|
return receiveUserProfile(state, user);
|
|
189
189
|
}
|
|
190
|
+
case action_types_1.UserTypes.RECEIVED_CPA_VALUES: {
|
|
191
|
+
const { userID, customAttributeValues } = action.data;
|
|
192
|
+
const existingProfile = state[userID];
|
|
193
|
+
if (!existingProfile) {
|
|
194
|
+
return state;
|
|
195
|
+
}
|
|
196
|
+
const profileAttributes = { ...existingProfile.custom_profile_attributes, ...customAttributeValues };
|
|
197
|
+
return receiveUserProfile(state, { ...existingProfile, custom_profile_attributes: profileAttributes });
|
|
198
|
+
}
|
|
190
199
|
case action_types_1.UserTypes.RECEIVED_PROFILES_LIST: {
|
|
191
200
|
const users = action.data;
|
|
192
201
|
return users.reduce(receiveUserProfile, state);
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -69,7 +69,9 @@ declare const _default: {
|
|
|
69
69
|
}>;
|
|
70
70
|
preferences: import("redux").CombinedState<{
|
|
71
71
|
myPreferences: any;
|
|
72
|
-
userPreferences:
|
|
72
|
+
userPreferences: {
|
|
73
|
+
[key: string]: import("@mattermost/types/preferences").PreferencesType;
|
|
74
|
+
};
|
|
73
75
|
}>;
|
|
74
76
|
typing: import("@mattermost/types/typing").Typing;
|
|
75
77
|
integrations: import("redux").CombinedState<{
|
|
@@ -25,6 +25,7 @@ export declare function getMyChannelMembership(state: GlobalState, channelId: st
|
|
|
25
25
|
export declare function makeGetChannelsForIds(): (state: GlobalState, ids: string[]) => Channel[];
|
|
26
26
|
export declare const getCurrentChannel: (state: GlobalState) => Channel | undefined;
|
|
27
27
|
export declare const getCurrentChannelNameForSearchShortcut: (state: GlobalState) => string | undefined;
|
|
28
|
+
export declare const getChannelNameForSearchShortcut: (state: GlobalState, channelId: string) => string | undefined;
|
|
28
29
|
export declare const getMyChannelMember: (state: GlobalState, channelId: string) => ChannelMembership | undefined;
|
|
29
30
|
export declare const getCurrentChannelStats: (state: GlobalState) => ChannelStats | undefined;
|
|
30
31
|
export declare function isCurrentChannelFavorite(state: GlobalState): boolean;
|
|
@@ -5,7 +5,8 @@ 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.
|
|
8
|
+
exports.getRecentProfilesFromDMs = exports.getMyActiveChannelIds = exports.getRedirectChannelNameForTeam = exports.getMyFirstChannelForTeams = exports.getDefaultChannelForTeams = exports.getChannelsWithUserProfiles = exports.getDirectAndGroupChannels = exports.getSortedAllTeamsUnreadChannels = exports.sortUnreadChannels = exports.getUnsortedAllTeamsUnreadChannels = exports.getUnreadChannels = exports.getAllTeamsUnreadChannelIds = exports.getUnreadChannelIds = exports.getChannelIdsForAllTeams = exports.getChannelIdsInAllTeams = exports.getChannelIdsForCurrentTeam = exports.getChannelIdsInCurrentTeam = exports.getAllDirectChannelIds = exports.canManageChannelMembers = exports.getUnreadStatusInCurrentTeam = exports.getTeamsUnreadStatuses = exports.getUnreadStatus = exports.getMembersInCurrentChannel = exports.getOtherChannels = exports.getMyChannels = exports.getGroupChannels = exports.getAllDirectChannelsNameMapInCurrentTeam = exports.getAllDirectChannels = exports.getChannelNameToDisplayNameMap = exports.getChannelsNameMapInCurrentTeam = exports.getChannelsNameMapInTeam = exports.getChannelsInAllTeams = exports.getChannelsInCurrentTeam = exports.getChannelSetForAllTeams = exports.getChannelSetInCurrentTeam = exports.countCurrentChannelUnreadMessages = exports.isCurrentChannelDefault = exports.isCurrentChannelArchived = exports.isMutedChannel = exports.isCurrentChannelMuted = exports.getCurrentChannelStats = exports.getMyChannelMember = exports.getChannelNameForSearchShortcut = exports.getCurrentChannelNameForSearchShortcut = exports.getCurrentChannel = exports.getDirectChannelsSet = exports.getAllDmChannels = exports.getMyCurrentChannelMembership = exports.getMyChannelMemberships = exports.getCurrentChannelId = void 0;
|
|
9
|
+
exports.isDeactivatedDirectChannel = void 0;
|
|
9
10
|
exports.getAllChannels = getAllChannels;
|
|
10
11
|
exports.getAllChannelStats = getAllChannelStats;
|
|
11
12
|
exports.getChannelsMemberCount = getChannelsMemberCount;
|
|
@@ -161,19 +162,29 @@ exports.getCurrentChannel = (0, create_selector_1.createSelector)('getCurrentCha
|
|
|
161
162
|
}
|
|
162
163
|
return channel;
|
|
163
164
|
});
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
const getChannelNameForSearch = (channel, users) => {
|
|
166
|
+
if (!channel) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
166
169
|
// Only get the extra info from users if we need it
|
|
167
|
-
if (channel
|
|
170
|
+
if (channel.type === constants_1.General.DM_CHANNEL) {
|
|
168
171
|
const dmChannelWithInfo = (0, channel_utils_1.completeDirectChannelInfo)(users, constants_1.Preferences.DISPLAY_PREFER_USERNAME, channel);
|
|
169
172
|
return `@${dmChannelWithInfo.display_name}`;
|
|
170
173
|
}
|
|
171
174
|
// Replace spaces in GM channel names
|
|
172
|
-
if (channel
|
|
175
|
+
if (channel.type === constants_1.General.GM_CHANNEL) {
|
|
173
176
|
const gmChannelWithInfo = (0, channel_utils_1.completeDirectGroupInfo)(users, constants_1.Preferences.DISPLAY_PREFER_USERNAME, channel, false);
|
|
174
177
|
return `@${gmChannelWithInfo.display_name.replace(/\s/g, '')}`;
|
|
175
178
|
}
|
|
176
|
-
return channel
|
|
179
|
+
return channel.name;
|
|
180
|
+
};
|
|
181
|
+
exports.getCurrentChannelNameForSearchShortcut = (0, create_selector_1.createSelector)('getCurrentChannelNameForSearchShortcut', getAllChannels, exports.getCurrentChannelId, (state) => state.entities.users, (allChannels, currentChannelId, users) => {
|
|
182
|
+
const channel = allChannels[currentChannelId];
|
|
183
|
+
return getChannelNameForSearch(channel, users);
|
|
184
|
+
});
|
|
185
|
+
exports.getChannelNameForSearchShortcut = (0, create_selector_1.createSelector)('getChannelNameForSearchShortcut', getAllChannels, (state) => state.entities.users, (state, channelId) => channelId, (allChannels, users, channelId) => {
|
|
186
|
+
const channel = allChannels[channelId];
|
|
187
|
+
return getChannelNameForSearch(channel, users);
|
|
177
188
|
});
|
|
178
189
|
exports.getMyChannelMember = (0, create_selector_1.createSelector)('getMyChannelMember', exports.getMyChannelMemberships, (state, channelId) => channelId, (channelMemberships, channelId) => {
|
|
179
190
|
return channelMemberships[channelId];
|
|
@@ -333,19 +344,12 @@ function basicUnreadMeta(unreadStatus) {
|
|
|
333
344
|
};
|
|
334
345
|
}
|
|
335
346
|
// muted channel will not be counted towards unreads
|
|
336
|
-
exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus', getAllChannels, exports.getMyChannelMemberships, getChannelMessageCounts, common_1.getUsers, users_1.getCurrentUserId, teams_1.getCurrentTeamId,
|
|
337
|
-
const { messages:
|
|
347
|
+
exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus', getAllChannels, exports.getMyChannelMemberships, getChannelMessageCounts, common_1.getUsers, users_1.getCurrentUserId, teams_1.getCurrentTeamId, preferences_1.isCollapsedThreadsEnabled, threads_1.getThreadCounts, threads_1.getThreadCountsIncludingDirect, (channels, myMembers, messageCounts, users, currentUserId, currentTeamId, collapsedThreads, threadCounts, threadCountsIncludingDirect) => {
|
|
348
|
+
const { messages: unreadMessages, mentions: unreadMentions, } = Object.entries(myMembers).reduce((counts, [channelId, membership]) => {
|
|
338
349
|
const channel = channels[channelId];
|
|
339
350
|
if (!channel || !membership) {
|
|
340
351
|
return counts;
|
|
341
352
|
}
|
|
342
|
-
if (
|
|
343
|
-
// other-team non-DM/non-GM channels
|
|
344
|
-
channel.team_id !== currentTeamId &&
|
|
345
|
-
channel.type !== constants_1.General.DM_CHANNEL &&
|
|
346
|
-
channel.type !== constants_1.General.GM_CHANNEL) {
|
|
347
|
-
return counts;
|
|
348
|
-
}
|
|
349
353
|
const channelExists = channel.type === constants_1.General.DM_CHANNEL ? users[(0, channel_utils_1.getUserIdFromChannelName)(currentUserId, channel.name)]?.delete_at === 0 : channel.delete_at === 0;
|
|
350
354
|
if (!channelExists) {
|
|
351
355
|
return counts;
|
|
@@ -363,21 +367,8 @@ exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus
|
|
|
363
367
|
messages: 0,
|
|
364
368
|
mentions: 0,
|
|
365
369
|
});
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const { messages: otherTeamsUnreadMessages, mentions: otherTeamsUnreadMentions, } = myTeams.reduce((acc, team) => {
|
|
369
|
-
if (currentTeamId !== team.id) {
|
|
370
|
-
const member = myTeamMemberships[team.id];
|
|
371
|
-
acc.messages += collapsedThreads ? member.msg_count_root : member.msg_count;
|
|
372
|
-
acc.mentions += collapsedThreads ? member.mention_count_root : member.mention_count;
|
|
373
|
-
}
|
|
374
|
-
return acc;
|
|
375
|
-
}, {
|
|
376
|
-
messages: 0,
|
|
377
|
-
mentions: 0,
|
|
378
|
-
});
|
|
379
|
-
const totalUnreadMessages = currentTeamUnreadMessages + otherTeamsUnreadMessages;
|
|
380
|
-
let totalUnreadMentions = currentTeamUnreadMentions + otherTeamsUnreadMentions;
|
|
370
|
+
const totalUnreadMessages = unreadMessages;
|
|
371
|
+
let totalUnreadMentions = unreadMentions;
|
|
381
372
|
let anyUnreadThreads = false;
|
|
382
373
|
// when collapsed threads are enabled, we start with root-post counts from channels, then
|
|
383
374
|
// add the same thread-reply counts from the global threads view
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ClientConfig, FeatureFlags, ClientLicense } from '@mattermost/types/config';
|
|
2
2
|
import type { UserPropertyField } from '@mattermost/types/properties';
|
|
3
3
|
import type { GlobalState } from '@mattermost/types/store';
|
|
4
|
-
import type { IDMappedObjects } from '@mattermost/types/utilities';
|
|
5
4
|
export declare function getConfig(state: GlobalState): Partial<ClientConfig>;
|
|
6
5
|
/**
|
|
7
6
|
* Safely get value of a specific or known FeatureFlag
|
|
@@ -30,4 +29,4 @@ export declare const isMarketplaceEnabled: (state: GlobalState) => boolean;
|
|
|
30
29
|
export declare const getUsersStatusAndProfileFetchingPollInterval: (state: GlobalState) => number | null;
|
|
31
30
|
export declare function developerModeEnabled(state: GlobalState): boolean;
|
|
32
31
|
export declare function testingEnabled(state: GlobalState): boolean;
|
|
33
|
-
export declare
|
|
32
|
+
export declare const getCustomProfileAttributes: (state: GlobalState) => UserPropertyField[];
|
|
@@ -2,7 +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.getUsersStatusAndProfileFetchingPollInterval = exports.isMarketplaceEnabled = exports.getServerVersion = exports.getManagedResourcePaths = exports.getAutolinkedUrlSchemes = exports.canDownloadFilesOnMobile = exports.canUploadFilesOnMobile = exports.isCloudLicense = exports.getPasswordConfig = void 0;
|
|
5
|
+
exports.getCustomProfileAttributes = exports.getUsersStatusAndProfileFetchingPollInterval = exports.isMarketplaceEnabled = exports.getServerVersion = exports.getManagedResourcePaths = exports.getAutolinkedUrlSchemes = exports.canDownloadFilesOnMobile = exports.canUploadFilesOnMobile = exports.isCloudLicense = exports.getPasswordConfig = void 0;
|
|
6
6
|
exports.getConfig = getConfig;
|
|
7
7
|
exports.getFeatureFlagValue = getFeatureFlagValue;
|
|
8
8
|
exports.getLicense = getLicense;
|
|
@@ -12,7 +12,6 @@ exports.getFirstAdminSetupComplete = getFirstAdminSetupComplete;
|
|
|
12
12
|
exports.isPerformanceDebuggingEnabled = isPerformanceDebuggingEnabled;
|
|
13
13
|
exports.developerModeEnabled = developerModeEnabled;
|
|
14
14
|
exports.testingEnabled = testingEnabled;
|
|
15
|
-
exports.getCustomProfileAttributes = getCustomProfileAttributes;
|
|
16
15
|
const constants_1 = require("mattermost-redux/constants");
|
|
17
16
|
const create_selector_1 = require("mattermost-redux/selectors/create_selector");
|
|
18
17
|
const helpers_1 = require("mattermost-redux/utils/helpers");
|
|
@@ -97,6 +96,6 @@ function developerModeEnabled(state) {
|
|
|
97
96
|
function testingEnabled(state) {
|
|
98
97
|
return state.entities.general.config.EnableTesting === 'true';
|
|
99
98
|
}
|
|
100
|
-
|
|
101
|
-
return
|
|
102
|
-
}
|
|
99
|
+
exports.getCustomProfileAttributes = (0, create_selector_1.createSelector)('getCustomProfileAttributes', (state) => state.entities.general.customProfileAttributes, (fields) => {
|
|
100
|
+
return Object.values(fields).sort((a, b) => (a.attrs?.sort_order ?? 0) - (b.attrs?.sort_order ?? 0));
|
|
101
|
+
});
|
|
@@ -116,13 +116,13 @@ exports.getMyGroups = (0, create_selector_1.createSelector)('getGroupsNotAssocia
|
|
|
116
116
|
return (0, group_utils_1.sortGroups)(getGroupInfoForIds(allGroups, myGroupIds));
|
|
117
117
|
});
|
|
118
118
|
exports.getGroupsNotAssociatedToTeam = (0, create_selector_1.createSelector)('getGroupsNotAssociatedToTeam', getAllGroups, (state, teamID) => getTeamGroupIDSet(state, teamID), (allGroups, teamGroupIDSet) => {
|
|
119
|
-
return Object.entries(allGroups).filter(([groupID, group]) => !teamGroupIDSet.has(groupID) && group.source
|
|
119
|
+
return Object.entries(allGroups).filter(([groupID, group]) => !teamGroupIDSet.has(groupID) && (0, group_utils_1.isSyncableSource)(group.source)).map((entry) => entry[1]);
|
|
120
120
|
});
|
|
121
121
|
exports.getGroupsAssociatedToTeam = (0, create_selector_1.createSelector)('getGroupsAssociatedToTeam', getAllGroups, (state, teamID) => getTeamGroupIDSet(state, teamID), (allGroups, teamGroupIDSet) => {
|
|
122
122
|
return Object.entries(allGroups).filter(([groupID]) => teamGroupIDSet.has(groupID)).map((entry) => entry[1]);
|
|
123
123
|
});
|
|
124
124
|
exports.getGroupsNotAssociatedToChannel = (0, create_selector_1.createSelector)('getGroupsNotAssociatedToChannel', getAllGroups, (state, channelID) => getChannelGroupIDSet(state, channelID), (state, channelID, teamID) => (0, teams_1.getTeam)(state, teamID), (state, channelID, teamID) => (0, exports.getGroupsAssociatedToTeam)(state, teamID), (allGroups, channelGroupIDSet, team, teamGroups) => {
|
|
125
|
-
let result = Object.values(allGroups).filter((group) => !channelGroupIDSet.has(group.id) && group.source
|
|
125
|
+
let result = Object.values(allGroups).filter((group) => !channelGroupIDSet.has(group.id) && (0, group_utils_1.isSyncableSource)(group.source));
|
|
126
126
|
if (team?.group_constrained) {
|
|
127
127
|
const gids = teamGroups.map((group) => group.id);
|
|
128
128
|
result = result.filter((group) => gids?.includes(group.id));
|
|
@@ -13,6 +13,7 @@ const create_selector_1 = require("mattermost-redux/selectors/create_selector");
|
|
|
13
13
|
const common_1 = require("mattermost-redux/selectors/entities/common");
|
|
14
14
|
const roles_helpers_1 = require("mattermost-redux/selectors/entities/roles_helpers");
|
|
15
15
|
const teams_1 = require("mattermost-redux/selectors/entities/teams");
|
|
16
|
+
const group_utils_1 = require("mattermost-redux/utils/group_utils");
|
|
16
17
|
// Re-define these types to ensure that these are typed correctly when mattermost-redux is published
|
|
17
18
|
exports.getMySystemPermissions = roles_helpers_1.getMySystemPermissions;
|
|
18
19
|
exports.getMySystemRoles = roles_helpers_1.getMySystemRoles;
|
|
@@ -60,9 +61,9 @@ exports.getGroupListPermissions = (0, create_selector_1.createSelector)('getGrou
|
|
|
60
61
|
const groupPermissionsMap = {};
|
|
61
62
|
groups.forEach((g) => {
|
|
62
63
|
groupPermissionsMap[g.id] = {
|
|
63
|
-
can_delete: permissions.has(constants_1.Permissions.DELETE_CUSTOM_GROUP) && g.source
|
|
64
|
-
can_manage_members: permissions.has(constants_1.Permissions.MANAGE_CUSTOM_GROUP_MEMBERS) && g.source
|
|
65
|
-
can_restore: permissions.has(constants_1.Permissions.RESTORE_CUSTOM_GROUP) && g.source
|
|
64
|
+
can_delete: permissions.has(constants_1.Permissions.DELETE_CUSTOM_GROUP) && !(0, group_utils_1.isSyncableSource)(g.source) && g.delete_at === 0,
|
|
65
|
+
can_manage_members: permissions.has(constants_1.Permissions.MANAGE_CUSTOM_GROUP_MEMBERS) && !(0, group_utils_1.isSyncableSource)(g.source) && g.delete_at === 0,
|
|
66
|
+
can_restore: permissions.has(constants_1.Permissions.RESTORE_CUSTOM_GROUP) && !(0, group_utils_1.isSyncableSource)(g.source) && g.delete_at !== 0,
|
|
66
67
|
};
|
|
67
68
|
});
|
|
68
69
|
return groupPermissionsMap;
|
|
@@ -120,12 +121,12 @@ function haveITeamPermission(state, teamId, permission) {
|
|
|
120
121
|
}
|
|
121
122
|
exports.haveIGroupPermission = (0, create_selector_1.createSelector)('haveIGroupPermission', exports.getMySystemPermissions, getMyPermissionsByGroup, (state, groupID) => state.entities.groups.groups[groupID], (state, groupID, permission) => permission, (systemPermissions, permissionGroups, group, permission) => {
|
|
122
123
|
if (permission === constants_1.Permissions.RESTORE_CUSTOM_GROUP) {
|
|
123
|
-
if ((group.source
|
|
124
|
+
if ((!(0, group_utils_1.isSyncableSource)(group.source) && group.delete_at !== 0) && (systemPermissions.has(permission) || (permissionGroups[group.id] && permissionGroups[group.id].has(permission)))) {
|
|
124
125
|
return true;
|
|
125
126
|
}
|
|
126
127
|
return false;
|
|
127
128
|
}
|
|
128
|
-
if (group.source
|
|
129
|
+
if ((0, group_utils_1.isSyncableSource)(group.source) || group.delete_at !== 0) {
|
|
129
130
|
return false;
|
|
130
131
|
}
|
|
131
132
|
if (systemPermissions.has(permission)) {
|
|
@@ -13,7 +13,7 @@ export declare const getThreadCountsInCurrentTeam: (state: GlobalState) => Threa
|
|
|
13
13
|
export declare function getThreads(state: GlobalState): IDMappedObjects<UserThread>;
|
|
14
14
|
export declare function getThread(state: GlobalState, threadId?: UserThread['id']): UserThread | null;
|
|
15
15
|
export declare function makeGetThreadOrSynthetic(): (state: GlobalState, rootPost: Post) => UserThread | UserThreadSynthetic;
|
|
16
|
-
export declare const getThreadOrderInCurrentTeam: (state: GlobalState
|
|
16
|
+
export declare const getThreadOrderInCurrentTeam: (state: GlobalState) => Array<UserThread['id']>;
|
|
17
17
|
export declare const getNewestThreadInTeam: (state: GlobalState, teamID: string) => (UserThread | null);
|
|
18
|
-
export declare const getUnreadThreadOrderInCurrentTeam: (state: GlobalState
|
|
18
|
+
export declare const getUnreadThreadOrderInCurrentTeam: (state: GlobalState) => Array<UserThread['id']>;
|
|
19
19
|
export declare const getThreadsInChannel: (state: GlobalState, channelID: string) => UserThread[];
|
|
@@ -64,11 +64,8 @@ function makeGetThreadOrSynthetic() {
|
|
|
64
64
|
};
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
exports.getThreadOrderInCurrentTeam = (0, create_selector_1.createSelector)('getThreadOrderInCurrentTeam', exports.getThreadsInCurrentTeam, getThreads, (
|
|
67
|
+
exports.getThreadOrderInCurrentTeam = (0, create_selector_1.createSelector)('getThreadOrderInCurrentTeam', exports.getThreadsInCurrentTeam, getThreads, (threadsInTeam, threads) => {
|
|
68
68
|
const ids = [...threadsInTeam.filter((id) => threads[id].is_following)];
|
|
69
|
-
if (selectedThreadIdInTeam && !ids.includes(selectedThreadIdInTeam)) {
|
|
70
|
-
ids.push(selectedThreadIdInTeam);
|
|
71
|
-
}
|
|
72
69
|
return sortByLastReply(ids, threads);
|
|
73
70
|
});
|
|
74
71
|
exports.getNewestThreadInTeam = (0, create_selector_1.createSelector)('getNewestThreadInTeam', getThreadsInTeam, getThreads, (state, teamID) => teamID, (threadsInTeam, threads, teamID) => {
|
|
@@ -79,14 +76,11 @@ exports.getNewestThreadInTeam = (0, create_selector_1.createSelector)('getNewest
|
|
|
79
76
|
const ids = [...threadsInGivenTeam.filter((id) => threads[id].is_following)];
|
|
80
77
|
return threads[sortByLastReply(ids, threads)[0]];
|
|
81
78
|
});
|
|
82
|
-
exports.getUnreadThreadOrderInCurrentTeam = (0, create_selector_1.createSelector)('getUnreadThreadOrderInCurrentTeam', exports.getUnreadThreadsInCurrentTeam, getThreads, (
|
|
79
|
+
exports.getUnreadThreadOrderInCurrentTeam = (0, create_selector_1.createSelector)('getUnreadThreadOrderInCurrentTeam', exports.getUnreadThreadsInCurrentTeam, getThreads, (threadsInTeam, threads) => {
|
|
83
80
|
const ids = threadsInTeam.filter((id) => {
|
|
84
81
|
const thread = threads[id];
|
|
85
82
|
return thread.is_following && (thread.unread_replies || thread.unread_mentions);
|
|
86
83
|
});
|
|
87
|
-
if (selectedThreadIdInTeam && !ids.includes(selectedThreadIdInTeam)) {
|
|
88
|
-
ids.push(selectedThreadIdInTeam);
|
|
89
|
-
}
|
|
90
84
|
return sortByLastReply(ids, threads);
|
|
91
85
|
});
|
|
92
86
|
function sortByLastReply(ids, threads) {
|
|
@@ -157,6 +157,10 @@ function completeDirectGroupInfo(usersState, teammateNameDisplay, channel, omitC
|
|
|
157
157
|
const profilesIds = profilesInChannel[channel.id];
|
|
158
158
|
const gm = { ...channel };
|
|
159
159
|
if (profilesIds) {
|
|
160
|
+
// sometimes the current user is not part of the profilesInChannel
|
|
161
|
+
if (!omitCurrentUser) {
|
|
162
|
+
profilesIds.add(currentUserId);
|
|
163
|
+
}
|
|
160
164
|
gm.display_name = getGroupDisplayNameFromUserIds(profilesIds, profiles, currentUserId, teammateNameDisplay, omitCurrentUser);
|
|
161
165
|
return gm;
|
|
162
166
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FileInfo } from '@mattermost/types/files';
|
|
2
|
-
export declare function getFormattedFileSize(
|
|
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
5
|
export declare function getFileDownloadUrl(fileId: string): string;
|
package/lib/utils/file_utils.js
CHANGED
|
@@ -12,8 +12,7 @@ exports.getFileMiniPreviewUrl = getFileMiniPreviewUrl;
|
|
|
12
12
|
exports.sortFileInfos = sortFileInfos;
|
|
13
13
|
const client_1 = require("mattermost-redux/client");
|
|
14
14
|
const constants_1 = require("../constants");
|
|
15
|
-
function getFormattedFileSize(
|
|
16
|
-
const bytes = file.size;
|
|
15
|
+
function getFormattedFileSize(bytes) {
|
|
17
16
|
const fileSizes = [
|
|
18
17
|
['TB', 1024 * 1024 * 1024 * 1024],
|
|
19
18
|
['GB', 1024 * 1024 * 1024],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Group } from '@mattermost/types/groups';
|
|
2
|
+
export declare function isSyncableSource(source: string): boolean;
|
|
2
3
|
export declare function filterGroupsMatchingTerm(groups: Group[], term: string): Group[];
|
|
3
4
|
export declare function sortGroups(groups?: Group[], locale?: string): Group[];
|
package/lib/utils/group_utils.js
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
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.isSyncableSource = isSyncableSource;
|
|
5
6
|
exports.filterGroupsMatchingTerm = filterGroupsMatchingTerm;
|
|
6
7
|
exports.sortGroups = sortGroups;
|
|
8
|
+
const groups_1 = require("@mattermost/types/groups");
|
|
7
9
|
const user_utils_1 = require("./user_utils");
|
|
8
10
|
const constants_1 = require("../constants");
|
|
11
|
+
function isSyncableSource(source) {
|
|
12
|
+
return source.toLowerCase() === groups_1.GroupSource.Ldap || source.toLowerCase().startsWith(groups_1.PluginGroupSourcePrefix.Plugin);
|
|
13
|
+
}
|
|
9
14
|
function filterGroupsMatchingTerm(groups, term) {
|
|
10
15
|
const lowercasedTerm = term.toLowerCase();
|
|
11
16
|
let trimmedTerm = lowercasedTerm;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mattermost-redux",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mattermost"
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"directory": "webapp/platform/mattermost-redux"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@mattermost/client": "10.6.0
|
|
35
|
-
"@mattermost/types": "10.6.0
|
|
34
|
+
"@mattermost/client": "10.6.0",
|
|
35
|
+
"@mattermost/types": "10.6.0",
|
|
36
36
|
"@redux-devtools/extension": "^3.2.3",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
38
|
"moment-timezone": "^0.5.38",
|
|
@@ -54,8 +54,6 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsc --build --verbose",
|
|
56
56
|
"postbuild": "cp ../../channels/src/packages/mattermost-redux/src/selectors/create_selector/index.d.ts lib/selectors/create_selector/index.d.ts",
|
|
57
|
-
"check": "eslint --ext .js,.jsx,.tsx,.ts ./src --quiet",
|
|
58
|
-
"run": "tsc --watch --preserveWatchOutput",
|
|
59
57
|
"clean": "rm -rf lib node_modules *.tsbuildinfo"
|
|
60
58
|
}
|
|
61
59
|
}
|
package/lib/client/rudder.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as rudderAnalytics from 'rudder-sdk-js';
|
|
2
|
-
import type { TelemetryHandler } from '@mattermost/client';
|
|
3
|
-
export { rudderAnalytics };
|
|
4
|
-
export declare class RudderTelemetryHandler implements TelemetryHandler {
|
|
5
|
-
trackEvent(userId: string, userRoles: string, category: string, event: string, props?: Record<string, unknown>): void;
|
|
6
|
-
trackFeatureEvent(userId: string, userRoles: string, featureName: string, event: string, props?: Record<string, unknown>): void;
|
|
7
|
-
pageVisited(userId: string, userRoles: string, category: string, name: string): void;
|
|
8
|
-
}
|
package/lib/client/rudder.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
-
// See LICENSE.txt for license information.
|
|
4
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
-
if (k2 === undefined) k2 = k;
|
|
6
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(o, k2, desc);
|
|
11
|
-
}) : (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
}));
|
|
15
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
-
}) : function(o, v) {
|
|
18
|
-
o["default"] = v;
|
|
19
|
-
});
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
-
if (mod && mod.__esModule) return mod;
|
|
22
|
-
var result = {};
|
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
-
__setModuleDefault(result, mod);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.RudderTelemetryHandler = exports.rudderAnalytics = void 0;
|
|
29
|
-
// As per rudder-sdk-js documentation, import this only once and use like a singleton.
|
|
30
|
-
// See https://github.com/rudderlabs/rudder-sdk-js#step-1-install-rudderstack-using-the-code-snippet
|
|
31
|
-
const rudderAnalytics = __importStar(require("rudder-sdk-js"));
|
|
32
|
-
exports.rudderAnalytics = rudderAnalytics;
|
|
33
|
-
const telemetry_1 = require("mattermost-redux/constants/telemetry");
|
|
34
|
-
const user_utils_1 = require("mattermost-redux/utils/user_utils");
|
|
35
|
-
class RudderTelemetryHandler {
|
|
36
|
-
trackEvent(userId, userRoles, category, event, props = {}) {
|
|
37
|
-
const properties = Object.assign({
|
|
38
|
-
category,
|
|
39
|
-
type: event,
|
|
40
|
-
user_actual_role: getActualRoles(userRoles),
|
|
41
|
-
[telemetry_1.TrackPropertyUser]: userId,
|
|
42
|
-
}, props);
|
|
43
|
-
const options = {
|
|
44
|
-
context: {
|
|
45
|
-
ip: '0.0.0.0',
|
|
46
|
-
},
|
|
47
|
-
page: {
|
|
48
|
-
path: '',
|
|
49
|
-
referrer: '',
|
|
50
|
-
search: '',
|
|
51
|
-
title: '',
|
|
52
|
-
url: '',
|
|
53
|
-
},
|
|
54
|
-
anonymousId: '00000000000000000000000000',
|
|
55
|
-
};
|
|
56
|
-
rudderAnalytics.track('event', properties, options);
|
|
57
|
-
}
|
|
58
|
-
trackFeatureEvent(userId, userRoles, featureName, event, props = {}) {
|
|
59
|
-
const properties = Object.assign({
|
|
60
|
-
category: getEventCategory(event),
|
|
61
|
-
type: event,
|
|
62
|
-
[telemetry_1.TrackPropertyUser]: userId,
|
|
63
|
-
user_actual_role: getActualRoles(userRoles),
|
|
64
|
-
}, props);
|
|
65
|
-
const options = {
|
|
66
|
-
context: {
|
|
67
|
-
feature: {
|
|
68
|
-
name: featureName,
|
|
69
|
-
skus: getSKUs(event),
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
rudderAnalytics.track(event, properties, options);
|
|
74
|
-
}
|
|
75
|
-
pageVisited(userId, userRoles, category, name) {
|
|
76
|
-
rudderAnalytics.page(category, name, {
|
|
77
|
-
path: '',
|
|
78
|
-
referrer: '',
|
|
79
|
-
search: '',
|
|
80
|
-
title: '',
|
|
81
|
-
url: '',
|
|
82
|
-
user_actual_role: getActualRoles(userRoles),
|
|
83
|
-
[telemetry_1.TrackPropertyUser]: userId,
|
|
84
|
-
}, {
|
|
85
|
-
context: {
|
|
86
|
-
ip: '0.0.0.0',
|
|
87
|
-
},
|
|
88
|
-
anonymousId: '00000000000000000000000000',
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.RudderTelemetryHandler = RudderTelemetryHandler;
|
|
93
|
-
function getActualRoles(userRoles) {
|
|
94
|
-
return userRoles && (0, user_utils_1.isSystemAdmin)(userRoles) ? 'system_admin, system_user' : 'system_user';
|
|
95
|
-
}
|
|
96
|
-
function getSKUs(eventName) {
|
|
97
|
-
const skus = telemetry_1.eventSKUs[eventName];
|
|
98
|
-
if (skus === undefined) {
|
|
99
|
-
// Next line is to be aware if you've forgotten to add a SKU, add an empty array for Team edition
|
|
100
|
-
// eslint-disable-next-line
|
|
101
|
-
console.warn(`Event ${eventName} has no SKUs attached`);
|
|
102
|
-
}
|
|
103
|
-
return skus ?? [];
|
|
104
|
-
}
|
|
105
|
-
function getEventCategory(eventName) {
|
|
106
|
-
const category = telemetry_1.eventCategory[eventName];
|
|
107
|
-
if (category === undefined) {
|
|
108
|
-
// eslint-disable-next-line
|
|
109
|
-
console.warn(`Event ${eventName} doesn't have a category`);
|
|
110
|
-
}
|
|
111
|
-
return category ?? telemetry_1.TrackMiscCategory;
|
|
112
|
-
}
|