mattermost-redux 10.6.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/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/status_profile_polling.d.ts +1 -1
- package/lib/actions/status_profile_polling.js +12 -10
- package/lib/actions/users.d.ts +2 -0
- package/lib/actions/users.js +34 -0
- package/lib/reducers/entities/general.js +19 -2
- package/lib/reducers/entities/posts.js +1 -2
- package/lib/reducers/entities/users.js +9 -0
- package/lib/selectors/entities/channels.js +4 -24
- 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/store/initial_state.js +1 -0
- package/lib/utils/group_utils.d.ts +1 -0
- package/lib/utils/group_utils.js +5 -0
- package/package.json +1 -1
|
@@ -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/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
|
}
|
|
@@ -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/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[]>;
|
|
@@ -60,6 +61,7 @@ export declare function patchUser(user: UserProfile): ActionFuncAsync<UserProfil
|
|
|
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)({
|
|
@@ -976,6 +994,22 @@ function updateUserPassword(userId, currentPassword, newPassword) {
|
|
|
976
994
|
return { data: true };
|
|
977
995
|
};
|
|
978
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
|
+
}
|
|
979
1013
|
function updateUserActive(userId, active) {
|
|
980
1014
|
return async (dispatch, getState) => {
|
|
981
1015
|
try {
|
|
@@ -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
|
}
|
|
@@ -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];
|
|
@@ -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);
|
|
@@ -344,19 +344,12 @@ function basicUnreadMeta(unreadStatus) {
|
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
// muted channel will not be counted towards unreads
|
|
347
|
-
exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus', getAllChannels, exports.getMyChannelMemberships, getChannelMessageCounts, common_1.getUsers, users_1.getCurrentUserId, teams_1.getCurrentTeamId,
|
|
348
|
-
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]) => {
|
|
349
349
|
const channel = channels[channelId];
|
|
350
350
|
if (!channel || !membership) {
|
|
351
351
|
return counts;
|
|
352
352
|
}
|
|
353
|
-
if (
|
|
354
|
-
// other-team non-DM/non-GM channels
|
|
355
|
-
channel.team_id !== currentTeamId &&
|
|
356
|
-
channel.type !== constants_1.General.DM_CHANNEL &&
|
|
357
|
-
channel.type !== constants_1.General.GM_CHANNEL) {
|
|
358
|
-
return counts;
|
|
359
|
-
}
|
|
360
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;
|
|
361
354
|
if (!channelExists) {
|
|
362
355
|
return counts;
|
|
@@ -374,21 +367,8 @@ exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus
|
|
|
374
367
|
messages: 0,
|
|
375
368
|
mentions: 0,
|
|
376
369
|
});
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const { messages: otherTeamsUnreadMessages, mentions: otherTeamsUnreadMentions, } = myTeams.reduce((acc, team) => {
|
|
380
|
-
if (currentTeamId !== team.id) {
|
|
381
|
-
const member = myTeamMemberships[team.id];
|
|
382
|
-
acc.messages += collapsedThreads ? member.msg_count_root : member.msg_count;
|
|
383
|
-
acc.mentions += collapsedThreads ? member.mention_count_root : member.mention_count;
|
|
384
|
-
}
|
|
385
|
-
return acc;
|
|
386
|
-
}, {
|
|
387
|
-
messages: 0,
|
|
388
|
-
mentions: 0,
|
|
389
|
-
});
|
|
390
|
-
const totalUnreadMessages = currentTeamUnreadMessages + otherTeamsUnreadMessages;
|
|
391
|
-
let totalUnreadMentions = currentTeamUnreadMentions + otherTeamsUnreadMentions;
|
|
370
|
+
const totalUnreadMessages = unreadMessages;
|
|
371
|
+
let totalUnreadMentions = unreadMentions;
|
|
392
372
|
let anyUnreadThreads = false;
|
|
393
373
|
// when collapsed threads are enabled, we start with root-post counts from channels, then
|
|
394
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)) {
|
|
@@ -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;
|