Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3102135
D13684.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13684.diff
View Options
diff --git a/lib/shared/chat-message-item-utils.js b/lib/shared/chat-message-item-utils.js
--- a/lib/shared/chat-message-item-utils.js
+++ b/lib/shared/chat-message-item-utils.js
@@ -40,6 +40,15 @@
return longAbsoluteDate(item.messageInfo.time);
}
+function chatMessageItemHasNonViewerMessage(
+ item: BaseChatMessageItem,
+ viewerID: ?string,
+): boolean {
+ return (
+ item.itemType === 'message' && item.messageInfo.creator.id !== viewerID
+ );
+}
+
type BaseChatMessageItemForEngagementCheck = {
+threadCreatedFromMessage: ?ThreadInfo,
+reactions: ReactionInfo,
@@ -61,5 +70,6 @@
export {
chatMessageItemKey,
chatMessageInfoItemTimestamp,
+ chatMessageItemHasNonViewerMessage,
chatMessageItemHasEngagement,
};
diff --git a/native/chat/chat-list.react.js b/native/chat/chat-list.react.js
--- a/native/chat/chat-list.react.js
+++ b/native/chat/chat-list.react.js
@@ -18,7 +18,10 @@
} from 'react-native';
import { FlatList } from 'react-native-gesture-handler';
-import { chatMessageItemKey } from 'lib/shared/chat-message-item-utils.js';
+import {
+ chatMessageItemKey,
+ chatMessageItemHasNonViewerMessage,
+} from 'lib/shared/chat-message-item-utils.js';
import { localIDPrefix } from 'lib/shared/message-utils.js';
import type { ChatNavigationProp } from './chat.react.js';
@@ -144,6 +147,7 @@
}
const { scrollPos } = this;
+ const { viewerID } = this.props;
let curDataIndex = 0,
prevDataIndex = 0,
@@ -166,10 +170,7 @@
if (curItemKey.startsWith(localIDPrefix)) {
newLocalMessage = true;
- } else if (
- curItem.itemType === 'message' &&
- curItem.messageInfo.creator.id !== this.props.viewerID
- ) {
+ } else if (chatMessageItemHasNonViewerMessage(curItem, viewerID)) {
newRemoteMessageCount++;
}
adjustScrollPos += chatMessageItemHeight(curItem);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 10:28 AM (21 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2391628
Default Alt Text
D13684.diff (1 KB)
Attached To
Mode
D13684: [lib][native] Extract chatMessageItemHasNonViewerMessage
Attached
Detach File
Event Timeline
Log In to Comment