Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3507223
D6420.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
D6420.diff
View Options
diff --git a/lib/hooks/ens-cache.js b/lib/hooks/ens-cache.js
--- a/lib/hooks/ens-cache.js
+++ b/lib/hooks/ens-cache.js
@@ -5,11 +5,9 @@
import { ENSCacheContext } from '../components/ens-cache-provider.react';
import { userIdentifiedByETHAddress } from '../shared/account-utils';
import { stringForUser } from '../shared/user-utils';
-import type { RelativeMemberInfo } from '../types/thread-types';
-import type { RelativeUserInfo } from '../types/user-types';
function useStringForUser(
- user: ?(RelativeUserInfo | RelativeMemberInfo),
+ user: ?{ +username?: ?string, +isViewer?: ?boolean, ... },
): ?string {
const ethAddress = React.useMemo(() => {
if (
diff --git a/lib/shared/user-utils.js b/lib/shared/user-utils.js
--- a/lib/shared/user-utils.js
+++ b/lib/shared/user-utils.js
@@ -5,17 +5,16 @@
import type {
ServerThreadInfo,
RawThreadInfo,
- RelativeMemberInfo,
ThreadInfo,
} from '../types/thread-types';
-import type {
- RelativeUserInfo,
- UserInfo,
- UserInfos,
-} from '../types/user-types';
+import type { UserInfo, UserInfos } from '../types/user-types';
import { memberHasAdminPowers } from './thread-utils';
-function stringForUser(user: RelativeUserInfo | RelativeMemberInfo): string {
+function stringForUser(user: {
+ +username?: ?string,
+ +isViewer?: ?boolean,
+ ...
+}): string {
if (user.isViewer) {
return 'you';
}
@@ -23,9 +22,7 @@
return stringForUserExplicit(user);
}
-function stringForUserExplicit(
- user: RelativeUserInfo | RelativeMemberInfo,
-): string {
+function stringForUserExplicit(user: { +username: ?string, ... }): string {
if (user.username) {
return user.username;
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 7:48 PM (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2688898
Default Alt Text
D6420.diff (1 KB)
Attached To
Mode
D6420: [lib] Make stringForUser and useStringForUser work with any user types
Attached
Detach File
Event Timeline
Log In to Comment