Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32385766
D8909.1765333294.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8909.1765333294.diff
View Options
diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js
--- a/lib/shared/mention-utils.js
+++ b/lib/shared/mention-utils.js
@@ -11,6 +11,7 @@
import {
type ThreadInfo,
type RelativeMemberInfo,
+ type ResolvedThreadInfo,
} from '../types/thread-types.js';
export type TypeaheadMatchedStrings = {
@@ -28,7 +29,14 @@
+userInfo: RelativeMemberInfo,
};
-export type MentionTypeaheadSuggestionItem = MentionTypeaheadUserSuggestionItem;
+type MentionTypeaheadChatSuggestionItem = {
+ +type: 'chat',
+ +chat: ResolvedThreadInfo,
+};
+
+export type MentionTypeaheadSuggestionItem =
+ | MentionTypeaheadUserSuggestionItem
+ | MentionTypeaheadChatSuggestionItem;
export type TypeaheadTooltipActionItem<SuggestionItemType> = {
+key: string,
diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js
--- a/native/chat/chat-input-bar.react.js
+++ b/native/chat/chat-input-bar.react.js
@@ -69,11 +69,11 @@
} from 'lib/types/message-types.js';
import type { Dispatch } from 'lib/types/redux-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
-import {
- type ThreadInfo,
- type ClientThreadJoinRequest,
- type ThreadJoinPayload,
- type RelativeMemberInfo,
+import type {
+ ThreadInfo,
+ ClientThreadJoinRequest,
+ ThreadJoinPayload,
+ RelativeMemberInfo,
} from 'lib/types/thread-types.js';
import { type UserInfos } from 'lib/types/user-types.js';
import {
diff --git a/native/utils/typeahead-utils.js b/native/utils/typeahead-utils.js
--- a/native/utils/typeahead-utils.js
+++ b/native/utils/typeahead-utils.js
@@ -6,6 +6,7 @@
import { oldValidUsernameRegexString } from 'lib/shared/account-utils.js';
import {
getNewTextAndSelection,
+ encodeChatMentionText,
type Selection,
type TypeaheadTooltipActionItem,
type MentionTypeaheadSuggestionItem,
@@ -65,6 +66,30 @@
userInfo,
},
});
+ } else if (suggestion.type === 'chat') {
+ const { chat } = suggestion;
+ const mentionText = `@[[${chat.id}:${encodeChatMentionText(
+ chat.uiName,
+ )}]]`;
+ actions.push({
+ key: chat.id,
+ execute: () => {
+ const { newText, newSelectionStart } = getNewTextAndSelection(
+ textBeforeAtSymbol,
+ text,
+ textPrefix,
+ mentionText,
+ );
+ focusAndUpdateTextAndSelection(newText, {
+ start: newSelectionStart,
+ end: newSelectionStart,
+ });
+ },
+ actionButtonContent: {
+ type: 'chat',
+ chat,
+ },
+ });
}
}
return actions;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 10, 2:21 AM (13 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5859908
Default Alt Text
D8909.1765333294.diff (2 KB)
Attached To
Mode
D8909: [native] Replace chat name with raw chat mention
Attached
Detach File
Event Timeline
Log In to Comment