mattermost-redux 10.7.0 → 10.8.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/groups.d.ts +2 -0
- package/lib/action_types/groups.js +2 -0
- package/lib/actions/groups.d.ts +3 -4
- package/lib/actions/posts.d.ts +1 -0
- package/lib/actions/posts.js +17 -1
- package/lib/actions/users.d.ts +1 -1
- package/lib/actions/users.js +4 -1
- package/lib/constants/general.d.ts +2 -0
- package/lib/constants/general.js +2 -0
- package/lib/constants/permissions.d.ts +2 -0
- package/lib/constants/permissions.js +4 -0
- package/lib/constants/permissions_sysconsole.d.ts +1 -0
- package/lib/constants/permissions_sysconsole.js +2 -0
- package/lib/constants/preferences.d.ts +0 -1
- package/lib/constants/preferences.js +0 -1
- package/lib/reducers/entities/groups.js +34 -0
- package/lib/selectors/entities/channel_banner.d.ts +2 -0
- package/lib/selectors/entities/channel_banner.js +18 -0
- package/lib/selectors/entities/channels.d.ts +3 -1
- package/lib/selectors/entities/channels.js +12 -2
- package/lib/selectors/entities/general.d.ts +1 -0
- package/lib/selectors/entities/general.js +4 -0
- package/lib/utils/theme_utils.d.ts +1 -0
- package/lib/utils/theme_utils.js +25 -0
- package/package.json +13 -5
|
@@ -19,6 +19,8 @@ declare const _default: {
|
|
|
19
19
|
RECEIVED_GROUPS_NOT_ASSOCIATED_TO_TEAM: "RECEIVED_GROUPS_NOT_ASSOCIATED_TO_TEAM";
|
|
20
20
|
RECEIVED_GROUP_NOT_ASSOCIATED_TO_CHANNEL: "RECEIVED_GROUP_NOT_ASSOCIATED_TO_CHANNEL";
|
|
21
21
|
RECEIVED_GROUPS_NOT_ASSOCIATED_TO_CHANNEL: "RECEIVED_GROUPS_NOT_ASSOCIATED_TO_CHANNEL";
|
|
22
|
+
RECEIVED_MEMBER_TO_REMOVE_FROM_GROUP: "RECEIVED_MEMBER_TO_REMOVE_FROM_GROUP";
|
|
23
|
+
RECEIVED_MEMBER_TO_ADD_TO_GROUP: "RECEIVED_MEMBER_TO_ADD_TO_GROUP";
|
|
22
24
|
PATCHED_GROUP_TEAM: "PATCHED_GROUP_TEAM";
|
|
23
25
|
PATCHED_GROUP_CHANNEL: "PATCHED_GROUP_CHANNEL";
|
|
24
26
|
RECEIVED_MY_GROUPS: "RECEIVED_MY_GROUPS";
|
|
@@ -27,6 +27,8 @@ exports.default = (0, key_mirror_1.default)({
|
|
|
27
27
|
RECEIVED_GROUPS_NOT_ASSOCIATED_TO_TEAM: null,
|
|
28
28
|
RECEIVED_GROUP_NOT_ASSOCIATED_TO_CHANNEL: null,
|
|
29
29
|
RECEIVED_GROUPS_NOT_ASSOCIATED_TO_CHANNEL: null,
|
|
30
|
+
RECEIVED_MEMBER_TO_REMOVE_FROM_GROUP: null,
|
|
31
|
+
RECEIVED_MEMBER_TO_ADD_TO_GROUP: null,
|
|
30
32
|
PATCHED_GROUP_TEAM: null,
|
|
31
33
|
PATCHED_GROUP_CHANNEL: null,
|
|
32
34
|
RECEIVED_MY_GROUPS: null,
|
package/lib/actions/groups.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AnyAction } from 'redux';
|
|
2
|
-
import type { GroupPatch, SyncablePatch, GroupCreateWithUserIds, CustomGroupPatch, GroupSearchParams, GetGroupsParams, GetGroupsForUserParams, Group } from '@mattermost/types/groups';
|
|
2
|
+
import type { GroupPatch, SyncablePatch, GroupCreateWithUserIds, CustomGroupPatch, GroupSearchParams, GetGroupsParams, GetGroupsForUserParams, Group, GroupMember } from '@mattermost/types/groups';
|
|
3
3
|
import { SyncableType, GroupSource } from '@mattermost/types/groups';
|
|
4
|
-
import type { UserProfile } from '@mattermost/types/users';
|
|
5
4
|
import type { ActionFuncAsync } from 'mattermost-redux/types/actions';
|
|
6
5
|
export declare function linkGroupSyncable(groupID: string, syncableID: string, syncableType: SyncableType, patch: Partial<SyncablePatch>): ActionFuncAsync;
|
|
7
6
|
export declare function unlinkGroupSyncable(groupID: string, syncableID: string, syncableType: SyncableType): ActionFuncAsync;
|
|
@@ -31,8 +30,8 @@ export declare function getGroupsByUserId(userID: string): ActionFuncAsync<Group
|
|
|
31
30
|
export declare function getGroupsByUserIdPaginated(opts: GetGroupsForUserParams): ActionFuncAsync<Group[], import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
32
31
|
export declare function getGroupStats(groupID: string): ActionFuncAsync<import("@mattermost/types/groups").GroupStats, import("@mattermost/types/store").GlobalState, AnyAction>;
|
|
33
32
|
export declare function createGroupWithUserIds(group: GroupCreateWithUserIds): ActionFuncAsync<Group>;
|
|
34
|
-
export declare function addUsersToGroup(groupId: string, userIds: string[]): ActionFuncAsync<
|
|
35
|
-
export declare function removeUsersFromGroup(groupId: string, userIds: string[]): ActionFuncAsync<
|
|
33
|
+
export declare function addUsersToGroup(groupId: string, userIds: string[]): ActionFuncAsync<GroupMember[]>;
|
|
34
|
+
export declare function removeUsersFromGroup(groupId: string, userIds: string[]): ActionFuncAsync<GroupMember[]>;
|
|
36
35
|
export declare function searchGroups(params: GroupSearchParams): ActionFuncAsync;
|
|
37
36
|
export declare function archiveGroup(groupId: string): ActionFuncAsync<Group>;
|
|
38
37
|
export declare function restoreGroup(groupId: string): ActionFuncAsync<Group>;
|
package/lib/actions/posts.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ export declare function getPostsAround(channelId: string, postId: string, perPag
|
|
|
112
112
|
export declare function getPostThreads(posts: Post[], fetchThreads?: boolean): ThunkActionFunc<unknown>;
|
|
113
113
|
export declare function getMentionsAndStatusesForPosts(postsArrayOrMap: Post[] | PostList['posts'], dispatch: DispatchFunc, getState: GetStateFunc): Promise<void | any[]>;
|
|
114
114
|
export declare function getPostsByIds(ids: string[]): ActionFuncAsync;
|
|
115
|
+
export declare function getPostsByIdsBatched(postIds: string[]): ActionFuncAsync<true>;
|
|
115
116
|
export declare function getPostEditHistory(postId: string): ActionFuncAsync<Post[], GlobalState, AnyAction>;
|
|
116
117
|
export declare function getNeededAtMentionedUsernamesAndGroups(state: GlobalState, posts: Post[]): Set<string>;
|
|
117
118
|
export type ExtendedPost = Post & {
|
package/lib/actions/posts.js
CHANGED
|
@@ -60,6 +60,7 @@ exports.getPostsAround = getPostsAround;
|
|
|
60
60
|
exports.getPostThreads = getPostThreads;
|
|
61
61
|
exports.getMentionsAndStatusesForPosts = getMentionsAndStatusesForPosts;
|
|
62
62
|
exports.getPostsByIds = getPostsByIds;
|
|
63
|
+
exports.getPostsByIdsBatched = getPostsByIdsBatched;
|
|
63
64
|
exports.getPostEditHistory = getPostEditHistory;
|
|
64
65
|
exports.getNeededAtMentionedUsernamesAndGroups = getNeededAtMentionedUsernamesAndGroups;
|
|
65
66
|
exports.removePost = removePost;
|
|
@@ -97,6 +98,7 @@ const groups_2 = require("mattermost-redux/selectors/entities/groups");
|
|
|
97
98
|
const PostSelectors = __importStar(require("mattermost-redux/selectors/entities/posts"));
|
|
98
99
|
const preferences_2 = require("mattermost-redux/selectors/entities/preferences");
|
|
99
100
|
const users_2 = require("mattermost-redux/selectors/entities/users");
|
|
101
|
+
const data_loader_1 = require("mattermost-redux/utils/data_loader");
|
|
100
102
|
const post_list_1 = require("mattermost-redux/utils/post_list");
|
|
101
103
|
const errors_1 = require("./errors");
|
|
102
104
|
// receivedPost should be dispatched after a single post from the server. This typically happens when an existing post
|
|
@@ -212,7 +214,6 @@ function getPost(postId) {
|
|
|
212
214
|
return { error };
|
|
213
215
|
}
|
|
214
216
|
dispatch(receivedPost(post, crtEnabled));
|
|
215
|
-
dispatch((0, status_profile_polling_1.batchFetchStatusesProfilesGroupsFromPosts)([post]));
|
|
216
217
|
return { data: post };
|
|
217
218
|
};
|
|
218
219
|
}
|
|
@@ -942,6 +943,21 @@ function getPostsByIds(ids) {
|
|
|
942
943
|
return { data: { posts } };
|
|
943
944
|
};
|
|
944
945
|
}
|
|
946
|
+
function getPostsByIdsBatched(postIds) {
|
|
947
|
+
const maxBatchSize = 100;
|
|
948
|
+
const wait = 100;
|
|
949
|
+
return async (dispatch, getState, { loaders }) => {
|
|
950
|
+
if (!loaders.postsByIdsLoader) {
|
|
951
|
+
loaders.postsByIdsLoader = new data_loader_1.DelayedDataLoader({
|
|
952
|
+
fetchBatch: (postIds) => dispatch(getPostsByIds(postIds)),
|
|
953
|
+
maxBatchSize,
|
|
954
|
+
wait,
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
loaders.postsByIdsLoader.queue(postIds);
|
|
958
|
+
return { data: true };
|
|
959
|
+
};
|
|
960
|
+
}
|
|
945
961
|
function getPostEditHistory(postId) {
|
|
946
962
|
return (0, helpers_1.bindClientFunc)({
|
|
947
963
|
clientFunc: client_1.Client4.getPostEditHistory,
|
package/lib/actions/users.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export declare function autocompleteUsers(term: string, teamId?: string, channel
|
|
|
56
56
|
}): ActionFuncAsync<UserAutocomplete>;
|
|
57
57
|
export declare function searchProfiles(term: string, options?: any): ActionFuncAsync<UserProfile[]>;
|
|
58
58
|
export declare function updateMe(user: Partial<UserProfile>): ActionFuncAsync<UserProfile>;
|
|
59
|
-
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string): ActionFuncAsync<Record<string, string>>;
|
|
59
|
+
export declare function saveCustomProfileAttribute(userID: string, attributeID: string, attributeValue: string | string[]): ActionFuncAsync<Record<string, string | string[]>>;
|
|
60
60
|
export declare function patchUser(user: UserProfile): ActionFuncAsync<UserProfile>;
|
|
61
61
|
export declare function updateUserRoles(userId: string, roles: string): ActionFuncAsync;
|
|
62
62
|
export declare function updateUserMfa(userId: string, activate: boolean, code?: string): ActionFuncAsync;
|
package/lib/actions/users.js
CHANGED
|
@@ -133,6 +133,9 @@ function loadMe() {
|
|
|
133
133
|
dispatch((0, teams_1.getMyTeams)()),
|
|
134
134
|
dispatch((0, teams_1.getMyTeamMembers)()),
|
|
135
135
|
]);
|
|
136
|
+
if ((0, general_2.getFeatureFlagValue)(getState(), 'CustomProfileAttributes') === 'true') {
|
|
137
|
+
dispatch((0, general_1.getCustomProfileAttributeFields)());
|
|
138
|
+
}
|
|
136
139
|
const isCollapsedThreads = (0, preferences_2.isCollapsedThreadsEnabled)(getState());
|
|
137
140
|
await dispatch((0, teams_1.getMyTeamUnreads)(isCollapsedThreads));
|
|
138
141
|
await dispatch((0, limits_1.getServerLimits)());
|
|
@@ -923,7 +926,7 @@ function updateMe(user) {
|
|
|
923
926
|
function saveCustomProfileAttribute(userID, attributeID, attributeValue) {
|
|
924
927
|
return async (dispatch) => {
|
|
925
928
|
try {
|
|
926
|
-
const values = { [attributeID]: attributeValue
|
|
929
|
+
const values = { [attributeID]: attributeValue || '' };
|
|
927
930
|
const data = await client_1.Client4.updateCustomProfileAttributeValues(values);
|
|
928
931
|
return { data };
|
|
929
932
|
}
|
package/lib/constants/general.js
CHANGED
|
@@ -177,6 +177,8 @@ declare const values: {
|
|
|
177
177
|
SYSCONSOLE_WRITE_ENVIRONMENT_PERFORMANCE_MONITORING: string;
|
|
178
178
|
SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER: string;
|
|
179
179
|
SYSCONSOLE_WRITE_ENVIRONMENT_DEVELOPER: string;
|
|
180
|
+
SYSCONSOLE_READ_ENVIRONMENT_MOBILE_SECURITY: string;
|
|
181
|
+
SYSCONSOLE_WRITE_ENVIRONMENT_MOBILE_SECURITY: string;
|
|
180
182
|
SYSCONSOLE_READ_AUTHENTICATION_SIGNUP: string;
|
|
181
183
|
SYSCONSOLE_WRITE_AUTHENTICATION_SIGNUP: string;
|
|
182
184
|
SYSCONSOLE_READ_AUTHENTICATION_EMAIL: string;
|
|
@@ -181,6 +181,8 @@ const values = {
|
|
|
181
181
|
SYSCONSOLE_WRITE_ENVIRONMENT_PERFORMANCE_MONITORING: 'sysconsole_write_environment_performance_monitoring',
|
|
182
182
|
SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER: 'sysconsole_read_environment_developer',
|
|
183
183
|
SYSCONSOLE_WRITE_ENVIRONMENT_DEVELOPER: 'sysconsole_write_environment_developer',
|
|
184
|
+
SYSCONSOLE_READ_ENVIRONMENT_MOBILE_SECURITY: 'sysconsole_read_environment_mobile_security',
|
|
185
|
+
SYSCONSOLE_WRITE_ENVIRONMENT_MOBILE_SECURITY: 'sysconsole_write_environment_mobile_security',
|
|
184
186
|
SYSCONSOLE_READ_AUTHENTICATION_SIGNUP: 'sysconsole_read_authentication_signup',
|
|
185
187
|
SYSCONSOLE_WRITE_AUTHENTICATION_SIGNUP: 'sysconsole_write_authentication_signup',
|
|
186
188
|
SYSCONSOLE_READ_AUTHENTICATION_EMAIL: 'sysconsole_read_authentication_email',
|
|
@@ -298,6 +300,7 @@ values.SYSCONSOLE_READ_PERMISSIONS = [
|
|
|
298
300
|
values.SYSCONSOLE_READ_ENVIRONMENT_SESSION_LENGTHS,
|
|
299
301
|
values.SYSCONSOLE_READ_ENVIRONMENT_PERFORMANCE_MONITORING,
|
|
300
302
|
values.SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER,
|
|
303
|
+
values.SYSCONSOLE_READ_ENVIRONMENT_MOBILE_SECURITY,
|
|
301
304
|
values.SYSCONSOLE_READ_AUTHENTICATION_SIGNUP,
|
|
302
305
|
values.SYSCONSOLE_READ_AUTHENTICATION_EMAIL,
|
|
303
306
|
values.SYSCONSOLE_READ_AUTHENTICATION_PASSWORD,
|
|
@@ -354,6 +357,7 @@ values.SYSCONSOLE_WRITE_PERMISSIONS = [
|
|
|
354
357
|
values.SYSCONSOLE_WRITE_ENVIRONMENT_SESSION_LENGTHS,
|
|
355
358
|
values.SYSCONSOLE_WRITE_ENVIRONMENT_PERFORMANCE_MONITORING,
|
|
356
359
|
values.SYSCONSOLE_WRITE_ENVIRONMENT_DEVELOPER,
|
|
360
|
+
values.SYSCONSOLE_WRITE_ENVIRONMENT_MOBILE_SECURITY,
|
|
357
361
|
values.SYSCONSOLE_WRITE_AUTHENTICATION_SIGNUP,
|
|
358
362
|
values.SYSCONSOLE_WRITE_AUTHENTICATION_EMAIL,
|
|
359
363
|
values.SYSCONSOLE_WRITE_AUTHENTICATION_PASSWORD,
|
|
@@ -81,6 +81,7 @@ exports.RESOURCE_KEYS = {
|
|
|
81
81
|
SESSION_LENGTHS: 'environment.session_lengths',
|
|
82
82
|
PERFORMANCE_MONITORING: 'environment.performance_monitoring',
|
|
83
83
|
DEVELOPER: 'environment.developer',
|
|
84
|
+
MOBILE_SECURITY: 'environment.mobile_security',
|
|
84
85
|
},
|
|
85
86
|
};
|
|
86
87
|
exports.ResourceToSysConsolePermissionsTable = {
|
|
@@ -119,6 +120,7 @@ exports.ResourceToSysConsolePermissionsTable = {
|
|
|
119
120
|
[exports.RESOURCE_KEYS.ENVIRONMENT.SESSION_LENGTHS]: [permissions_1.default.SYSCONSOLE_READ_ENVIRONMENT_SESSION_LENGTHS, permissions_1.default.SYSCONSOLE_WRITE_ENVIRONMENT_SESSION_LENGTHS],
|
|
120
121
|
[exports.RESOURCE_KEYS.ENVIRONMENT.PERFORMANCE_MONITORING]: [permissions_1.default.SYSCONSOLE_READ_ENVIRONMENT_PERFORMANCE_MONITORING, permissions_1.default.SYSCONSOLE_WRITE_ENVIRONMENT_PERFORMANCE_MONITORING],
|
|
121
122
|
[exports.RESOURCE_KEYS.ENVIRONMENT.DEVELOPER]: [permissions_1.default.SYSCONSOLE_READ_ENVIRONMENT_DEVELOPER, permissions_1.default.SYSCONSOLE_WRITE_ENVIRONMENT_DEVELOPER],
|
|
123
|
+
[exports.RESOURCE_KEYS.ENVIRONMENT.MOBILE_SECURITY]: [permissions_1.default.SYSCONSOLE_READ_ENVIRONMENT_MOBILE_SECURITY, permissions_1.default.SYSCONSOLE_WRITE_ENVIRONMENT_MOBILE_SECURITY],
|
|
122
124
|
[exports.RESOURCE_KEYS.AUTHENTICATION.SIGNUP]: [permissions_1.default.SYSCONSOLE_READ_AUTHENTICATION_SIGNUP, permissions_1.default.SYSCONSOLE_WRITE_AUTHENTICATION_SIGNUP],
|
|
123
125
|
[exports.RESOURCE_KEYS.AUTHENTICATION.EMAIL]: [permissions_1.default.SYSCONSOLE_READ_AUTHENTICATION_EMAIL, permissions_1.default.SYSCONSOLE_WRITE_AUTHENTICATION_EMAIL],
|
|
124
126
|
[exports.RESOURCE_KEYS.AUTHENTICATION.PASSWORD]: [permissions_1.default.SYSCONSOLE_READ_AUTHENTICATION_PASSWORD, permissions_1.default.SYSCONSOLE_WRITE_AUTHENTICATION_PASSWORD],
|
|
@@ -57,7 +57,6 @@ declare const Preferences: {
|
|
|
57
57
|
NEW_CHANNEL_WITH_BOARD_TOUR_SHOWED: string;
|
|
58
58
|
CATEGORY_ONBOARDING: string;
|
|
59
59
|
CATEGORY_DRAFTS: string;
|
|
60
|
-
DRAFTS_TOUR_TIP_SHOWED: string;
|
|
61
60
|
CATEGORY_REPORTING: string;
|
|
62
61
|
HIDE_BATCH_EXPORT_CONFIRM_MODAL: string;
|
|
63
62
|
HIDE_MYSQL_STATS_NOTIFICATION: string;
|
|
@@ -61,7 +61,6 @@ const Preferences = {
|
|
|
61
61
|
NEW_CHANNEL_WITH_BOARD_TOUR_SHOWED: 'channel_with_board_tip_showed',
|
|
62
62
|
CATEGORY_ONBOARDING: 'category_onboarding',
|
|
63
63
|
CATEGORY_DRAFTS: 'drafts',
|
|
64
|
-
DRAFTS_TOUR_TIP_SHOWED: 'drafts_tour_tip_showed',
|
|
65
64
|
CATEGORY_REPORTING: 'reporting',
|
|
66
65
|
HIDE_BATCH_EXPORT_CONFIRM_MODAL: 'hide_batch_export_confirm_modal',
|
|
67
66
|
HIDE_MYSQL_STATS_NOTIFICATION: 'hide_mysql_stats_notifcation',
|
|
@@ -217,6 +217,40 @@ function groups(state = {}, action) {
|
|
|
217
217
|
}
|
|
218
218
|
return nextState;
|
|
219
219
|
}
|
|
220
|
+
case action_types_1.GroupTypes.RECEIVED_MEMBER_TO_REMOVE_FROM_GROUP: {
|
|
221
|
+
const dataInfo = action.data;
|
|
222
|
+
const group = state[dataInfo.group_id];
|
|
223
|
+
if (Array.isArray(group?.member_ids)) {
|
|
224
|
+
const newMemberIds = new Set(group.member_ids);
|
|
225
|
+
newMemberIds.delete(dataInfo.user_id);
|
|
226
|
+
const newGroup = { ...group,
|
|
227
|
+
member_ids: [...newMemberIds],
|
|
228
|
+
member_count: newMemberIds.size,
|
|
229
|
+
};
|
|
230
|
+
return {
|
|
231
|
+
...state,
|
|
232
|
+
[group.id]: newGroup,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
return state;
|
|
236
|
+
}
|
|
237
|
+
case action_types_1.GroupTypes.RECEIVED_MEMBER_TO_ADD_TO_GROUP: {
|
|
238
|
+
const { group_id: groupId, user_id: userId } = action.data;
|
|
239
|
+
const group = state[groupId];
|
|
240
|
+
if (Array.isArray(group?.member_ids)) {
|
|
241
|
+
const newMemberIds = new Set(group.member_ids);
|
|
242
|
+
newMemberIds.add(userId);
|
|
243
|
+
const newGroup = { ...group,
|
|
244
|
+
member_ids: [...newMemberIds],
|
|
245
|
+
member_count: newMemberIds.size,
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
...state,
|
|
249
|
+
[group.id]: newGroup,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return state;
|
|
253
|
+
}
|
|
220
254
|
default:
|
|
221
255
|
return state;
|
|
222
256
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
3
|
+
// See LICENSE.txt for license information.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.selectShowChannelBanner = void 0;
|
|
6
|
+
const channels_1 = require("@mattermost/types/channels");
|
|
7
|
+
const constants_1 = require("mattermost-redux/constants");
|
|
8
|
+
const channels_2 = require("mattermost-redux/selectors/entities/channels");
|
|
9
|
+
const general_1 = require("mattermost-redux/selectors/entities/general");
|
|
10
|
+
const selectShowChannelBanner = (state, channelId) => {
|
|
11
|
+
const license = (0, general_1.getLicense)(state);
|
|
12
|
+
const isPremiumLicense = license?.SkuShortName === constants_1.General.SKUPremium;
|
|
13
|
+
const channelBannerInfo = (0, channels_2.getChannelBanner)(state, channelId);
|
|
14
|
+
const channel = (0, channels_2.getChannel)(state, channelId);
|
|
15
|
+
const isValidChannelType = Boolean(channel && (channel.type === constants_1.General.OPEN_CHANNEL || channel.type === constants_1.General.PRIVATE_CHANNEL));
|
|
16
|
+
return isPremiumLicense && isValidChannelType && (0, channels_1.channelBannerEnabled)(channelBannerInfo);
|
|
17
|
+
};
|
|
18
|
+
exports.selectShowChannelBanner = selectShowChannelBanner;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Channel, ChannelMemberCountsByGroup, ChannelMembership, ChannelMessageCount, ChannelModeration, ChannelSearchOpts, ChannelStats } from '@mattermost/types/channels';
|
|
1
|
+
import type { Channel, ChannelBanner, ChannelMemberCountsByGroup, ChannelMembership, ChannelMessageCount, ChannelModeration, ChannelSearchOpts, ChannelStats } from '@mattermost/types/channels';
|
|
2
2
|
import type { GlobalState } from '@mattermost/types/store';
|
|
3
3
|
import type { Team } from '@mattermost/types/teams';
|
|
4
4
|
import type { UserProfile } from '@mattermost/types/users';
|
|
@@ -96,6 +96,7 @@ export declare const getChannelsWithUserProfiles: (state: GlobalState) => Array<
|
|
|
96
96
|
} & Channel>;
|
|
97
97
|
export declare const getDefaultChannelForTeams: (state: GlobalState) => RelationOneToOne<Team, Channel>;
|
|
98
98
|
export declare const getMyFirstChannelForTeams: (state: GlobalState) => RelationOneToOne<Team, Channel>;
|
|
99
|
+
export declare const getRedirectChannelNameForCurrentTeam: (state: GlobalState) => string;
|
|
99
100
|
export declare const getRedirectChannelNameForTeam: (state: GlobalState, teamId: string) => string;
|
|
100
101
|
export declare function isManuallyUnread(state: GlobalState, channelId?: string): boolean;
|
|
101
102
|
export declare function getChannelModerations(state: GlobalState, channelId: string): ChannelModeration[];
|
|
@@ -108,3 +109,4 @@ export declare function makeGetGmChannelMemberCount(): (state: GlobalState, chan
|
|
|
108
109
|
export declare const getMyActiveChannelIds: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, string[], (res: Channel[]) => string[]>;
|
|
109
110
|
export declare const getRecentProfilesFromDMs: (state: GlobalState) => UserProfile[];
|
|
110
111
|
export declare const isDeactivatedDirectChannel: (state: GlobalState, channelId: string) => boolean;
|
|
112
|
+
export declare function getChannelBanner(state: GlobalState, channelId: string): ChannelBanner | undefined;
|
|
@@ -5,8 +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.
|
|
9
|
-
exports.isDeactivatedDirectChannel = void 0;
|
|
8
|
+
exports.getMyActiveChannelIds = exports.getRedirectChannelNameForTeam = exports.getRedirectChannelNameForCurrentTeam = 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 = exports.getRecentProfilesFromDMs = void 0;
|
|
10
10
|
exports.getAllChannels = getAllChannels;
|
|
11
11
|
exports.getAllChannelStats = getAllChannelStats;
|
|
12
12
|
exports.getChannelsMemberCount = getChannelsMemberCount;
|
|
@@ -38,6 +38,7 @@ exports.filterChannelList = filterChannelList;
|
|
|
38
38
|
exports.searchChannelsInPolicy = searchChannelsInPolicy;
|
|
39
39
|
exports.getDirectTeammate = getDirectTeammate;
|
|
40
40
|
exports.makeGetGmChannelMemberCount = makeGetGmChannelMemberCount;
|
|
41
|
+
exports.getChannelBanner = getChannelBanner;
|
|
41
42
|
const max_1 = __importDefault(require("lodash/max"));
|
|
42
43
|
const constants_1 = require("mattermost-redux/constants");
|
|
43
44
|
const channel_categories_1 = require("mattermost-redux/constants/channel_categories");
|
|
@@ -705,6 +706,11 @@ exports.getMyFirstChannelForTeams = (0, create_selector_1.createSelector)('getMy
|
|
|
705
706
|
}
|
|
706
707
|
return result;
|
|
707
708
|
});
|
|
709
|
+
const getRedirectChannelNameForCurrentTeam = (state) => {
|
|
710
|
+
const currentTeamId = (0, teams_1.getCurrentTeamId)(state);
|
|
711
|
+
return (0, exports.getRedirectChannelNameForTeam)(state, currentTeamId);
|
|
712
|
+
};
|
|
713
|
+
exports.getRedirectChannelNameForCurrentTeam = getRedirectChannelNameForCurrentTeam;
|
|
708
714
|
const getRedirectChannelNameForTeam = (state, teamId) => {
|
|
709
715
|
const defaultChannelForTeam = (0, exports.getDefaultChannelForTeams)(state)[teamId];
|
|
710
716
|
const canIJoinPublicChannelsInTeam = (0, roles_1.haveITeamPermission)(state, teamId, constants_1.Permissions.JOIN_PUBLIC_CHANNELS);
|
|
@@ -868,3 +874,7 @@ const isDeactivatedDirectChannel = (state, channelId) => {
|
|
|
868
874
|
return Boolean(teammate && teammate.delete_at);
|
|
869
875
|
};
|
|
870
876
|
exports.isDeactivatedDirectChannel = isDeactivatedDirectChannel;
|
|
877
|
+
function getChannelBanner(state, channelId) {
|
|
878
|
+
const channel = getChannel(state, channelId);
|
|
879
|
+
return channel ? channel.banner_info : undefined;
|
|
880
|
+
}
|
|
@@ -30,3 +30,4 @@ export declare const getUsersStatusAndProfileFetchingPollInterval: (state: Globa
|
|
|
30
30
|
export declare function developerModeEnabled(state: GlobalState): boolean;
|
|
31
31
|
export declare function testingEnabled(state: GlobalState): boolean;
|
|
32
32
|
export declare const getCustomProfileAttributes: (state: GlobalState) => UserPropertyField[];
|
|
33
|
+
export declare function getIsCrossTeamSearchEnabled(state: GlobalState): boolean;
|
|
@@ -12,6 +12,7 @@ exports.getFirstAdminSetupComplete = getFirstAdminSetupComplete;
|
|
|
12
12
|
exports.isPerformanceDebuggingEnabled = isPerformanceDebuggingEnabled;
|
|
13
13
|
exports.developerModeEnabled = developerModeEnabled;
|
|
14
14
|
exports.testingEnabled = testingEnabled;
|
|
15
|
+
exports.getIsCrossTeamSearchEnabled = getIsCrossTeamSearchEnabled;
|
|
15
16
|
const constants_1 = require("mattermost-redux/constants");
|
|
16
17
|
const create_selector_1 = require("mattermost-redux/selectors/create_selector");
|
|
17
18
|
const helpers_1 = require("mattermost-redux/utils/helpers");
|
|
@@ -99,3 +100,6 @@ function testingEnabled(state) {
|
|
|
99
100
|
exports.getCustomProfileAttributes = (0, create_selector_1.createSelector)('getCustomProfileAttributes', (state) => state.entities.general.customProfileAttributes, (fields) => {
|
|
100
101
|
return Object.values(fields).sort((a, b) => (a.attrs?.sort_order ?? 0) - (b.attrs?.sort_order ?? 0));
|
|
101
102
|
});
|
|
103
|
+
function getIsCrossTeamSearchEnabled(state) {
|
|
104
|
+
return state.entities.general.config.EnableCrossTeamSearch === 'true';
|
|
105
|
+
}
|
|
@@ -9,3 +9,4 @@ export declare function getComponents(inColor: string): {
|
|
|
9
9
|
export declare function changeOpacity(oldColor: string, opacity: number): string;
|
|
10
10
|
export declare const blendColors: (background: string, foreground: string, opacity: number, hex?: boolean) => string;
|
|
11
11
|
export declare function setThemeDefaults(theme: Partial<Theme>): Theme;
|
|
12
|
+
export declare function getContrastingSimpleColor(colorHexCode: string): string;
|
package/lib/utils/theme_utils.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.makeStyleFromTheme = makeStyleFromTheme;
|
|
|
7
7
|
exports.getComponents = getComponents;
|
|
8
8
|
exports.changeOpacity = changeOpacity;
|
|
9
9
|
exports.setThemeDefaults = setThemeDefaults;
|
|
10
|
+
exports.getContrastingSimpleColor = getContrastingSimpleColor;
|
|
10
11
|
const constants_1 = require("mattermost-redux/constants");
|
|
11
12
|
function makeStyleFromTheme(getStyleFromTheme) {
|
|
12
13
|
let lastTheme;
|
|
@@ -126,3 +127,27 @@ function setThemeDefaults(theme) {
|
|
|
126
127
|
}
|
|
127
128
|
return processedTheme;
|
|
128
129
|
}
|
|
130
|
+
// getContrastingSimpleColor returns a contrasting color - either black or white, depending on the luminance
|
|
131
|
+
// of the supplied color. Both input and outpur colors are in hexadecimal color code.
|
|
132
|
+
function getContrastingSimpleColor(colorHexCode) {
|
|
133
|
+
const color = colorHexCode.startsWith('#') ? colorHexCode.slice(1) : colorHexCode;
|
|
134
|
+
if (color.length !== 6) {
|
|
135
|
+
return '';
|
|
136
|
+
}
|
|
137
|
+
// split red, green and blue components
|
|
138
|
+
const red = parseInt(color.substring(0, 2), 16);
|
|
139
|
+
const green = parseInt(color.substring(2, 4), 16);
|
|
140
|
+
const blue = parseInt(color.substring(4, 6), 16);
|
|
141
|
+
// calculate relative luminance of each color channel - https://www.w3.org/TR/WCAG21/#dfn-relative-luminance
|
|
142
|
+
const srgb = [red / 255, green / 255, blue / 255];
|
|
143
|
+
const [redLuminance, greenLuminance, blueLuminance] = srgb.map((i) => {
|
|
144
|
+
if (i <= 0.04045) {
|
|
145
|
+
return i / 12.92;
|
|
146
|
+
}
|
|
147
|
+
return Math.pow((i + 0.055) / 1.055, 2.4);
|
|
148
|
+
});
|
|
149
|
+
// calculate luminance of the whole color by adding percieved luminance of each channel
|
|
150
|
+
const colorLuminance = (0.2126 * redLuminance) + (0.7152 * greenLuminance) + (0.0722 * blueLuminance);
|
|
151
|
+
// return black or white based on color's luminance
|
|
152
|
+
return colorLuminance > 0.179 ? '#000000' : '#FFFFFF';
|
|
153
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mattermost-redux",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.8.0",
|
|
4
4
|
"description": "Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mattermost"
|
|
@@ -12,10 +12,18 @@
|
|
|
12
12
|
"lib"
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
"./action_types": "./lib/action_types/index.js",
|
|
16
|
+
"./actions": "./lib/actions/index.js",
|
|
17
|
+
"./client": "./lib/client/index.js",
|
|
18
|
+
"./constants": "./lib/constants/index.js",
|
|
19
|
+
"./reducers": "./lib/reducers/index.js",
|
|
20
|
+
"./reducers/entities": "./lib/reducers/entities/index.js",
|
|
21
|
+
"./reducers/entities/threads": "./lib/reducers/entities/threads/index.js",
|
|
22
|
+
"./reducers/errors": "./lib/reducers/errors/index.js",
|
|
23
|
+
"./reducers/requests": "./lib/reducers/requests/index.js",
|
|
24
|
+
"./selectors/create_selector": "./lib/selectors/create_selector/index.js",
|
|
25
|
+
"./store": "./lib/store/index.js",
|
|
26
|
+
"./*": "./lib/*.js"
|
|
19
27
|
},
|
|
20
28
|
"typesVersions": {
|
|
21
29
|
">=3.1": {
|