* Init * i18 and types * Acknowledge button, api * Ack button + display ackd users * Saves priority on draft and addresses some comments * Addresses review comments round 2 * Moves fetching userprofiles upon opening ACKs * Adds metadata column in drafts table + Addresses some more review comments. * Small refactor according to review comments * Addresses some review comments * Addresses some review comments * Uses local action when ACKing * Fixes first time selecting priority and other * Updates snapshots * Fixes i18n * Fixes ts errors --------- Co-authored-by: Anurag Shivarathri <anurag6713@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com>
32 lines
933 B
TypeScript
32 lines
933 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {General} from '@constants';
|
|
import {MENTIONS_REGEX} from '@constants/autocomplete';
|
|
|
|
export const getNeededAtMentionedUsernames = (usernames: Set<string>, posts: Post[], excludeUsername?: string) => {
|
|
const usernamesToLoad = new Set<string>();
|
|
|
|
posts.forEach((p) => {
|
|
let match;
|
|
while ((match = MENTIONS_REGEX.exec(p.message)) !== null) {
|
|
const lowercaseMatch = match[1].toLowerCase();
|
|
|
|
if (General.SPECIAL_MENTIONS.has(lowercaseMatch)) {
|
|
continue;
|
|
}
|
|
|
|
if (lowercaseMatch === excludeUsername) {
|
|
continue;
|
|
}
|
|
|
|
if (usernames.has(lowercaseMatch)) {
|
|
continue;
|
|
}
|
|
|
|
usernamesToLoad.add(lowercaseMatch);
|
|
}
|
|
});
|
|
|
|
return usernamesToLoad;
|
|
};
|