mattermost-redux 10.10.0 → 10.12.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.
@@ -997,7 +997,7 @@ function getNeededAtMentionedUsernamesAndGroups(state, posts) {
997
997
  if (!groupsByName) {
998
998
  groupsByName = (0, groups_2.getAllGroupsByName)(state);
999
999
  }
1000
- const pattern = /\B@(([a-z0-9_.-]*[a-z0-9_])[.-]*)/gi;
1000
+ const pattern = /\B@(([a-z0-9.\-_:]*[a-z0-9_])[.\-:]*)/gi;
1001
1001
  let match;
1002
1002
  while ((match = pattern.exec(text)) !== null) {
1003
1003
  // match[1] is the matched mention including trailing punctuation
@@ -41,6 +41,9 @@ export declare function createTermsOfService(text: string): ActionFuncAsync<impo
41
41
  export declare function getUser(id: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
42
42
  export declare function getUserByUsername(username: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
43
43
  export declare function getUserByEmail(email: string): ActionFuncAsync<UserProfile, import("@mattermost/types/store").GlobalState, AnyAction>;
44
+ export declare function canUserDirectMessage(userId: string, otherUserId: string): ActionFuncAsync<{
45
+ can_dm: boolean;
46
+ }>;
44
47
  export declare function getStatusesByIds(userIds: Array<UserProfile['id']>): ActionFuncAsync<UserStatus[]>;
45
48
  export declare function setStatus(status: UserStatus): ActionFuncAsync<UserStatus>;
46
49
  export declare function setCustomStatus(customStatus: UserCustomStatus): ActionFuncAsync<unknown, import("@mattermost/types/store").GlobalState, AnyAction>;
@@ -33,6 +33,7 @@ exports.createTermsOfService = createTermsOfService;
33
33
  exports.getUser = getUser;
34
34
  exports.getUserByUsername = getUserByUsername;
35
35
  exports.getUserByEmail = getUserByEmail;
36
+ exports.canUserDirectMessage = canUserDirectMessage;
36
37
  exports.getStatusesByIds = getStatusesByIds;
37
38
  exports.setStatus = setStatus;
38
39
  exports.setCustomStatus = setCustomStatus;
@@ -133,9 +134,6 @@ function loadMe() {
133
134
  dispatch((0, teams_1.getMyTeams)()),
134
135
  dispatch((0, teams_1.getMyTeamMembers)()),
135
136
  ]);
136
- if ((0, general_2.getFeatureFlagValue)(getState(), 'CustomProfileAttributes') === 'true') {
137
- dispatch((0, general_1.getCustomProfileAttributeFields)());
138
- }
139
137
  const isCollapsedThreads = (0, preferences_2.isCollapsedThreadsEnabled)(getState());
140
138
  await dispatch((0, teams_1.getMyTeamUnreads)(isCollapsedThreads));
141
139
  await dispatch((0, limits_1.getServerLimits)());
@@ -622,6 +620,19 @@ function getUserByEmail(email) {
622
620
  ],
623
621
  });
624
622
  }
623
+ function canUserDirectMessage(userId, otherUserId) {
624
+ return async (dispatch, getState) => {
625
+ try {
626
+ const result = await client_1.Client4.canUserDirectMessage(userId, otherUserId);
627
+ return { data: result };
628
+ }
629
+ catch (error) {
630
+ (0, helpers_1.forceLogoutIfNecessary)(error, dispatch, getState);
631
+ dispatch((0, errors_1.logError)(error));
632
+ return { error };
633
+ }
634
+ };
635
+ }
625
636
  function getStatusesByIds(userIds) {
626
637
  return async (dispatch, getState) => {
627
638
  if (!userIds || userIds.length === 0) {
@@ -1,5 +1,7 @@
1
1
  import type { Channel, ChannelWithTeamData, ChannelSearchOpts } from '@mattermost/types/channels';
2
+ import type { AccessControlSettings } from '@mattermost/types/config';
2
3
  import type { GlobalState } from '@mattermost/types/store';
4
+ export declare function getAccessControlSettings(state: GlobalState): AccessControlSettings;
3
5
  export declare function getAccessControlPolicy(state: GlobalState, id: string): import("@mattermost/types/access_control").AccessControlPolicy;
4
6
  export declare const getChannelIdsForAccessControlPolicy: (state: GlobalState, parentId: string) => string[];
5
7
  export declare function makeGetChannelsInAccessControlPolicy(): (b: GlobalState, a: {
@@ -3,12 +3,16 @@
3
3
  // See LICENSE.txt for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.getChannelIdsForAccessControlPolicy = void 0;
6
+ exports.getAccessControlSettings = getAccessControlSettings;
6
7
  exports.getAccessControlPolicy = getAccessControlPolicy;
7
8
  exports.makeGetChannelsInAccessControlPolicy = makeGetChannelsInAccessControlPolicy;
8
9
  exports.searchChannelsInheritsPolicy = searchChannelsInheritsPolicy;
9
10
  const channel_utils_1 = require("mattermost-redux/utils/channel_utils");
10
11
  const channels_1 = require("./channels");
11
12
  const create_selector_1 = require("../create_selector");
13
+ function getAccessControlSettings(state) {
14
+ return state.entities.admin.config.AccessControlSettings;
15
+ }
12
16
  function getAccessControlPolicy(state, id) {
13
17
  return state.entities.admin.accessControlPolicies[id];
14
18
  }
@@ -355,8 +355,11 @@ exports.getUnreadStatus = (0, create_selector_1.createSelector)('getUnreadStatus
355
355
  if (!channelExists) {
356
356
  return counts;
357
357
  }
358
+ if ((0, channel_utils_1.isChannelMuted)(membership)) {
359
+ return counts;
360
+ }
358
361
  const mentions = collapsedThreads ? membership.mention_count_root : membership.mention_count;
359
- if (mentions && !(0, channel_utils_1.isChannelMuted)(membership)) {
362
+ if (mentions) {
360
363
  counts.mentions += mentions;
361
364
  }
362
365
  const unreadCount = (0, channel_utils_1.calculateUnreadCount)(messageCounts[channelId], myMembers[channelId], collapsedThreads);
@@ -30,6 +30,7 @@ export declare function getUserStatuses(state: GlobalState): RelationOneToOne<Us
30
30
  export declare function getUserSessions(state: GlobalState): any[];
31
31
  export declare function getUserAudits(state: GlobalState): any[];
32
32
  export declare function getUser(state: GlobalState, id: UserProfile['id']): UserProfile;
33
+ export declare function getUsersByIDs(state: GlobalState, ids: Array<UserProfile['id']>): UserProfile[];
33
34
  export declare const getUsersByUsername: (a: GlobalState) => Record<string, UserProfile>;
34
35
  export declare function getUserByUsername(state: GlobalState, username: UserProfile['username']): UserProfile;
35
36
  export declare const getUsersByEmail: (a: GlobalState) => Record<string, UserProfile>;
@@ -14,6 +14,7 @@ exports.getUserStatuses = getUserStatuses;
14
14
  exports.getUserSessions = getUserSessions;
15
15
  exports.getUserAudits = getUserAudits;
16
16
  exports.getUser = getUser;
17
+ exports.getUsersByIDs = getUsersByIDs;
17
18
  exports.getUserByUsername = getUserByUsername;
18
19
  exports.getUserByEmail = getUserByEmail;
19
20
  exports.filterProfiles = filterProfiles;
@@ -87,6 +88,9 @@ function getUserAudits(state) {
87
88
  function getUser(state, id) {
88
89
  return state.entities.users.profiles[id];
89
90
  }
91
+ function getUsersByIDs(state, ids) {
92
+ return ids.map((userId) => getUser(state, userId));
93
+ }
90
94
  exports.getUsersByUsername = (0, create_selector_1.createSelector)('getUsersByUsername', exports.getUsers, (users) => {
91
95
  const usersByUsername = {};
92
96
  for (const id in users) {
@@ -18,7 +18,7 @@ export declare function profileListToMap(profileList: UserProfile[]): IDMappedOb
18
18
  export declare function removeUserFromList(userId: UserProfile['id'], list: UserProfile[]): UserProfile[];
19
19
  export declare function getSuggestionsSplitBy(term: string, splitStr: string): string[];
20
20
  export declare function getSuggestionsSplitByMultiple(term: string, splitStrs: string[]): string[];
21
- export declare function nameSuggestionsForUser(user: UserProfile): string[];
21
+ export declare function nameSuggestionsForUser(user: UserProfile, includeFullEmail?: boolean): string[];
22
22
  export declare function filterProfilesStartingWithTerm(users: UserProfile[], term: string): UserProfile[];
23
23
  export declare function filterProfilesMatchingWithTerm(users: UserProfile[], term: string): UserProfile[];
24
24
  export declare function sortByUsername(a: UserProfile, b: UserProfile): number;
@@ -144,7 +144,7 @@ function getSuggestionsSplitByMultiple(term, splitStrs) {
144
144
  }, new Set());
145
145
  return [...suggestions];
146
146
  }
147
- function nameSuggestionsForUser(user) {
147
+ function nameSuggestionsForUser(user, includeFullEmail = false) {
148
148
  const profileSuggestions = [];
149
149
  const usernameSuggestions = getSuggestionsSplitByMultiple((user.username || '').toLowerCase(), constants_1.General.AUTOCOMPLETE_SPLIT_CHARACTERS);
150
150
  profileSuggestions.push(...usernameSuggestions);
@@ -155,8 +155,13 @@ function nameSuggestionsForUser(user) {
155
155
  profileSuggestions.push((user.nickname || '').toLowerCase());
156
156
  const positionSuggestions = getSuggestionsSplitBy((user.position || '').toLowerCase(), ' ');
157
157
  profileSuggestions.push(...positionSuggestions);
158
- const email = (user.email || '').toLowerCase().split('@')[0];
159
- profileSuggestions.push(email);
158
+ const email = (user.email || '').toLowerCase();
159
+ const emailPrefix = email.split('@')[0];
160
+ profileSuggestions.push(emailPrefix);
161
+ // Only include full email if explicitly requested (when search contains @)
162
+ if (includeFullEmail && email.includes('@')) {
163
+ profileSuggestions.push(email);
164
+ }
160
165
  return profileSuggestions;
161
166
  }
162
167
  function filterProfilesStartingWithTerm(users, term) {
@@ -165,11 +170,13 @@ function filterProfilesStartingWithTerm(users, term) {
165
170
  if (trimmedTerm.startsWith('@')) {
166
171
  trimmedTerm = trimmedTerm.substr(1);
167
172
  }
173
+ // Include full email in suggestions if the search term contains @
174
+ const includeFullEmail = lowercasedTerm.includes('@');
168
175
  return users.filter((user) => {
169
176
  if (!user) {
170
177
  return false;
171
178
  }
172
- const profileSuggestions = nameSuggestionsForUser(user);
179
+ const profileSuggestions = nameSuggestionsForUser(user, includeFullEmail);
173
180
  return profileSuggestions.filter((suggestion) => suggestion !== '').some((suggestion) => suggestion.startsWith(trimmedTerm));
174
181
  });
175
182
  }
@@ -179,11 +186,13 @@ function filterProfilesMatchingWithTerm(users, term) {
179
186
  if (trimmedTerm.startsWith('@')) {
180
187
  trimmedTerm = trimmedTerm.substr(1);
181
188
  }
189
+ // Include full email in suggestions if the search term contains @
190
+ const includeFullEmail = lowercasedTerm.includes('@');
182
191
  return users.filter((user) => {
183
192
  if (!user) {
184
193
  return false;
185
194
  }
186
- const profileSuggestions = nameSuggestionsForUser(user);
195
+ const profileSuggestions = nameSuggestionsForUser(user, includeFullEmail);
187
196
  return profileSuggestions.filter((suggestion) => suggestion !== '').some((suggestion) => suggestion.includes(trimmedTerm));
188
197
  });
189
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-redux",
3
- "version": "10.10.0",
3
+ "version": "10.12.0",
4
4
  "description": "Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client",
5
5
  "keywords": [
6
6
  "mattermost"
@@ -39,8 +39,8 @@
39
39
  "directory": "webapp/platform/mattermost-redux"
40
40
  },
41
41
  "dependencies": {
42
- "@mattermost/client": "10.10.0",
43
- "@mattermost/types": "10.10.0",
42
+ "@mattermost/client": "10.12.0",
43
+ "@mattermost/types": "10.12.0",
44
44
  "@redux-devtools/extension": "^3.2.3",
45
45
  "lodash": "^4.17.21",
46
46
  "moment-timezone": "^0.5.38",