Page MenuHomePhabricator

D13449.diff
No OneTemporary

D13449.diff

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

Mime Type
text/plain
Expires
Mon, Sep 30, 12:01 AM (4 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2201544
Default Alt Text
D13449.diff (3 KB)

Event Timeline