Page MenuHomePhabricator

D6041.diff
No OneTemporary

D6041.diff

diff --git a/lib/shared/typeahead-utils.js b/lib/shared/typeahead-utils.js
new file mode 100644
--- /dev/null
+++ b/lib/shared/typeahead-utils.js
@@ -0,0 +1,21 @@
+// @flow
+
+import type { RelativeMemberInfo } from '../types/thread-types';
+import SearchIndex from './search-index';
+import { stringForUserExplicit } from './user-utils';
+
+function getTypeaheadUserSuggestions(
+ userSearchIndex: SearchIndex,
+ usersInThread: $ReadOnlyArray<RelativeMemberInfo>,
+ typedPrefix: string,
+): $ReadOnlyArray<RelativeMemberInfo> {
+ const userIDs = userSearchIndex.getSearchResults(typedPrefix);
+
+ return usersInThread
+ .filter(user => typedPrefix.length === 0 || userIDs.includes(user.id))
+ .sort((userA, userB) =>
+ stringForUserExplicit(userA).localeCompare(stringForUserExplicit(userB)),
+ );
+}
+
+export { getTypeaheadUserSuggestions };
diff --git a/web/chat/typeahead-tooltip.react.js b/web/chat/typeahead-tooltip.react.js
--- a/web/chat/typeahead-tooltip.react.js
+++ b/web/chat/typeahead-tooltip.react.js
@@ -5,6 +5,7 @@
import SearchIndex from 'lib/shared/search-index';
import { threadOtherMembers } from 'lib/shared/thread-utils';
+import { getTypeaheadUserSuggestions } from 'lib/shared/typeahead-utils';
import type { RelativeMemberInfo } from 'lib/types/thread-types';
import Button from '../components/button.react';
@@ -14,7 +15,6 @@
import {
getTypeaheadTooltipActions,
getTypeaheadTooltipPosition,
- getTypeaheadUserSuggestions,
} from './typeahead-utils';
export type TypeaheadTooltipProps = {
diff --git a/web/chat/typeahead-utils.js b/web/chat/typeahead-utils.js
--- a/web/chat/typeahead-utils.js
+++ b/web/chat/typeahead-utils.js
@@ -3,7 +3,6 @@
import * as React from 'react';
import { oldValidUsernameRegexString } from 'lib/shared/account-utils';
-import SearchIndex from 'lib/shared/search-index';
import { stringForUserExplicit } from 'lib/shared/user-utils';
import type { RelativeMemberInfo } from 'lib/types/thread-types';
@@ -25,20 +24,6 @@
+left: number,
};
-function getTypeaheadUserSuggestions(
- userSearchIndex: SearchIndex,
- usersInThread: $ReadOnlyArray<RelativeMemberInfo>,
- typedPrefix: string,
-): $ReadOnlyArray<RelativeMemberInfo> {
- const userIDs = userSearchIndex.getSearchResults(typedPrefix);
-
- return usersInThread
- .filter(user => typedPrefix.length === 0 || userIDs.includes(user.id))
- .sort((userA, userB) =>
- stringForUserExplicit(userA).localeCompare(stringForUserExplicit(userB)),
- );
-}
-
function getCaretOffsets(
textarea: HTMLTextAreaElement,
text: string,
@@ -152,7 +137,6 @@
export {
typeaheadRegex,
- getTypeaheadUserSuggestions,
getCaretOffsets,
getTypeaheadTooltipActions,
getTypeaheadTooltipPosition,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 12:08 AM (18 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574422
Default Alt Text
D6041.diff (2 KB)

Event Timeline