Page MenuHomePhabricator

D3894.diff
No OneTemporary

D3894.diff

diff --git a/lib/hooks/inline-sidebar-text.react.js b/lib/hooks/inline-sidebar-text.react.js
--- a/lib/hooks/inline-sidebar-text.react.js
+++ b/lib/hooks/inline-sidebar-text.react.js
@@ -2,16 +2,11 @@
import * as React from 'react';
-import { relativeMemberInfoSelectorForMembersOfThread } from '../selectors/user-selectors';
-import { stringForUser } from '../shared/user-utils';
import type { ThreadInfo } from '../types/thread-types';
-import { useSelector } from '../utils/redux-utils';
-import { pluralizeAndTrim } from '../utils/text-utils';
function useInlineSidebarText(
threadInfo: ThreadInfo,
): {
- sendersText: string,
repliesText: string,
} {
const repliesCount = threadInfo.repliesCount || 1;
@@ -19,22 +14,11 @@
repliesCount > 1 ? 'replies' : 'reply'
}`;
- const threadMembers = useSelector(
- relativeMemberInfoSelectorForMembersOfThread(threadInfo.id),
- );
- const sendersText = React.useMemo(() => {
- const senders = threadMembers
- .filter(member => member.isSender)
- .map(stringForUser);
- return senders.length > 0 ? `${pluralizeAndTrim(senders, 25)} sent ` : '';
- }, [threadMembers]);
-
return React.useMemo(
() => ({
- sendersText,
repliesText,
}),
- [sendersText, repliesText],
+ [repliesText],
);
}
diff --git a/lib/utils/text-utils.js b/lib/utils/text-utils.js
--- a/lib/utils/text-utils.js
+++ b/lib/utils/text-utils.js
@@ -31,17 +31,4 @@
return text.substr(0, maxLength - 3) + '...';
}
-function pluralizeAndTrim(
- nouns: $ReadOnlyArray<string>,
- maxLength: number,
-): string {
- for (let maxNumberOfNouns = 3; maxNumberOfNouns >= 2; --maxNumberOfNouns) {
- const text = pluralize(nouns, maxNumberOfNouns);
- if (text.length <= maxLength) {
- return text;
- }
- }
- return pluralize(nouns, 1);
-}
-
-export { pluralize, trimText, pluralizeAndTrim };
+export { pluralize, trimText };
diff --git a/native/chat/inline-sidebar.react.js b/native/chat/inline-sidebar.react.js
--- a/native/chat/inline-sidebar.react.js
+++ b/native/chat/inline-sidebar.react.js
@@ -17,7 +17,7 @@
};
function InlineSidebar(props: Props): React.Node {
const { threadInfo } = props;
- const { sendersText, repliesText } = useInlineSidebarText(threadInfo);
+ const { repliesText } = useInlineSidebarText(threadInfo);
const navigateToThread = useNavigateToThread();
const onPress = React.useCallback(() => {
@@ -47,10 +47,7 @@
<View style={[styles.content, alignStyle]}>
<Button style={styles.sidebar} onPress={onPress}>
{nonViewerIcon}
- <Text style={[styles.name, unreadStyle]}>
- {sendersText}
- {repliesText}
- </Text>
+ <Text style={[styles.name, unreadStyle]}>{repliesText}</Text>
{viewerIcon}
</Button>
</View>
diff --git a/web/chat/inline-sidebar.react.js b/web/chat/inline-sidebar.react.js
--- a/web/chat/inline-sidebar.react.js
+++ b/web/chat/inline-sidebar.react.js
@@ -14,16 +14,13 @@
};
function InlineSidebar(props: Props): React.Node {
const { threadInfo } = props;
- const { sendersText, repliesText } = useInlineSidebarText(threadInfo);
+ const { repliesText } = useInlineSidebarText(threadInfo);
const onClick = useOnClickThread(threadInfo);
return (
<div className={css.container} onClick={onClick}>
- <div>
- {sendersText}
- {repliesText}
- </div>
+ <div>{repliesText}</div>
</div>
);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 8:56 AM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574752
Default Alt Text
D3894.diff (3 KB)

Event Timeline