Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3299749
D13449.id44529.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D13449.id44529.diff
View Options
diff --git a/lib/types/thread-types-enum.js b/lib/types/thread-types-enum.js
--- a/lib/types/thread-types-enum.js
+++ b/lib/types/thread-types-enum.js
@@ -161,6 +161,11 @@
threadTypes.THICK_SIDEBAR,
]);
+export const personalThreadTypes: $ReadOnlyArray<number> = Object.freeze([
+ threadTypes.PERSONAL,
+ threadTypes.GENESIS_PERSONAL,
+]);
+
export function threadTypeIsCommunityRoot(threadType: ThreadType): boolean {
return communityThreadTypes.includes(threadType);
}
@@ -174,3 +179,7 @@
export function threadTypeIsSidebar(threadType: ThreadType): boolean {
return sidebarThreadTypes.includes(threadType);
}
+
+export function threadTypeIsPersonal(threadType: ThreadType): boolean {
+ return personalThreadTypes.includes(threadType);
+}
diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js
--- a/native/chat/settings/thread-settings.react.js
+++ b/native/chat/settings/thread-settings.react.js
@@ -46,9 +46,9 @@
import type { RelationshipButton } from 'lib/types/relationship-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
import {
- threadTypes,
threadTypeIsSidebar,
threadTypeIsThick,
+ threadTypeIsPersonal,
} from 'lib/types/thread-types-enum.js';
import type { UserInfos } from 'lib/types/user-types.js';
import {
@@ -768,9 +768,7 @@
});
}
- const threadIsPersonal =
- threadInfo.type === threadTypes.GENESIS_PERSONAL;
- if (threadIsPersonal && viewerID) {
+ if (threadInfo && threadTypeIsPersonal(threadInfo.type) && viewerID) {
const otherMemberID = getSingleOtherUser(threadInfo, viewerID);
if (otherMemberID) {
const otherUserInfo = userInfos[otherMemberID];
diff --git a/web/modals/threads/settings/thread-settings-modal.react.js b/web/modals/threads/settings/thread-settings-modal.react.js
--- a/web/modals/threads/settings/thread-settings-modal.react.js
+++ b/web/modals/threads/settings/thread-settings-modal.react.js
@@ -19,7 +19,10 @@
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import type { RelationshipButton } from 'lib/types/relationship-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
-import { threadTypes } from 'lib/types/thread-types-enum.js';
+import {
+ threadTypeIsPersonal,
+ threadTypes,
+} from 'lib/types/thread-types-enum.js';
import { type ThreadChanges } from 'lib/types/thread-types.js';
import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js';
@@ -91,11 +94,15 @@
const otherUserInfo = otherMemberID ? userInfos[otherMemberID] : null;
const availableRelationshipActions = React.useMemo(() => {
- if (!otherUserInfo) {
+ if (
+ !otherUserInfo ||
+ !threadInfo?.type ||
+ !threadTypeIsPersonal(threadInfo.type)
+ ) {
return ([]: RelationshipButton[]);
}
return getAvailableRelationshipButtons(otherUserInfo);
- }, [otherUserInfo]);
+ }, [otherUserInfo, threadInfo?.type]);
const canEditThreadName = useThreadHasPermission(
threadInfo,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 3:17 PM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535135
Default Alt Text
D13449.id44529.diff (3 KB)
Attached To
Mode
D13449: [web][native] fix relationship buttons in thread settings
Attached
Detach File
Event Timeline
Log In to Comment