Page MenuHomePhabricator

D9323.diff
No OneTemporary

D9323.diff

diff --git a/keyserver/src/creators/thread-creator.js b/keyserver/src/creators/thread-creator.js
--- a/keyserver/src/creators/thread-creator.js
+++ b/keyserver/src/creators/thread-creator.js
@@ -9,10 +9,10 @@
generatePendingThreadColor,
generateRandomColor,
} from 'lib/shared/color-utils.js';
-import { isInvalidSidebarSource } from 'lib/shared/message-utils.js';
import { getThreadTypeParentRequirement } from 'lib/shared/thread-utils.js';
import type { Shape } from 'lib/types/core.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
+import { isInvalidSidebarSource } from 'lib/types/message-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
import {
threadTypes,
diff --git a/keyserver/src/fetchers/message-fetchers.js b/keyserver/src/fetchers/message-fetchers.js
--- a/keyserver/src/fetchers/message-fetchers.js
+++ b/keyserver/src/fetchers/message-fetchers.js
@@ -5,7 +5,6 @@
import {
sortMessageInfoList,
shimUnsupportedRawMessageInfos,
- isInvalidSidebarSource,
} from 'lib/shared/message-utils.js';
import { messageSpecs } from 'lib/shared/messages/message-specs.js';
import { getNotifCollapseKey } from 'lib/shared/notif-utils.js';
@@ -15,6 +14,10 @@
type MessageType,
assertMessageType,
} from 'lib/types/message-types-enum.js';
+import {
+ isInvalidSidebarSource,
+ defaultNumberPerThread,
+} from 'lib/types/message-types.js';
import {
type RawMessageInfo,
type RawComposableMessageInfo,
@@ -29,7 +32,6 @@
type FetchPinnedMessagesResult,
type SearchMessagesResponse,
} from 'lib/types/message-types.js';
-import { defaultNumberPerThread } from 'lib/types/message-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
import { ServerError } from 'lib/utils/errors.js';
diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -655,17 +655,6 @@
return `${localIDPrefix}${nextLocalID}`;
}
-function isInvalidSidebarSource(
- message: RawMessageInfo | MessageInfo,
-): boolean %checks {
- return (
- message.type === messageTypes.REACTION ||
- message.type === messageTypes.EDIT_MESSAGE ||
- message.type === messageTypes.SIDEBAR_SOURCE ||
- message.type === messageTypes.TOGGLE_PIN
- );
-}
-
export {
localIDPrefix,
messageKey,
@@ -695,5 +684,4 @@
modifyItemForResultScreen,
constructChangeRoleEntityText,
useNextLocalID,
- isInvalidSidebarSource,
};
diff --git a/lib/shared/messages/sidebar-source-message-spec.js b/lib/shared/messages/sidebar-source-message-spec.js
--- a/lib/shared/messages/sidebar-source-message-spec.js
+++ b/lib/shared/messages/sidebar-source-message-spec.js
@@ -16,12 +16,12 @@
type SidebarSourceMessageData,
type SidebarSourceMessageInfo,
type ClientDBMessageInfo,
+ isInvalidSidebarSource,
rawSidebarSourceMessageInfoValidator,
} from '../../types/message-types.js';
import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js';
import type { NotifTexts } from '../../types/notif-types.js';
import type { RelativeUserInfo } from '../../types/user-types.js';
-import { isInvalidSidebarSource } from '../message-utils.js';
import { hasMinCodeVersion } from '../version-utils.js';
export const sidebarSourceMessageSpec: MessageSpec<
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -9,7 +9,7 @@
import { generatePendingThreadColor } from './color-utils.js';
import { type ParserRules } from './markdown.js';
import { extractMentionsFromText } from './mention-utils.js';
-import { getMessageTitle, isInvalidSidebarSource } from './message-utils.js';
+import { getMessageTitle } from './message-utils.js';
import { relationshipBlockedInEitherDirection } from './relationship-utils.js';
import threadWatcher from './thread-watcher.js';
import {
@@ -46,6 +46,7 @@
import { getUserAvatarForThread } from '../shared/avatar-utils.js';
import type { CalendarQuery } from '../types/entry-types.js';
import { messageTypes } from '../types/message-types-enum.js';
+import { isInvalidSidebarSource } from '../types/message-types.js';
import {
type RobotextMessageInfo,
type ComposableMessageInfo,
diff --git a/lib/types/message-types.js b/lib/types/message-types.js
--- a/lib/types/message-types.js
+++ b/lib/types/message-types.js
@@ -195,6 +195,17 @@
return ourMessageType;
}
+export function isInvalidSidebarSource(
+ message: RawMessageInfo | MessageInfo,
+): boolean %checks {
+ return (
+ message.type === messageTypes.REACTION ||
+ message.type === messageTypes.EDIT_MESSAGE ||
+ message.type === messageTypes.SIDEBAR_SOURCE ||
+ message.type === messageTypes.TOGGLE_PIN
+ );
+}
+
// *MessageData = passed to createMessages function to insert into database
// Raw*MessageInfo = used by server, and contained in client's local store
// *MessageInfo = used by client in UI code
diff --git a/lib/shared/message-utils.test.js b/lib/types/message-types.test.js
rename from lib/shared/message-utils.test.js
rename to lib/types/message-types.test.js
--- a/lib/shared/message-utils.test.js
+++ b/lib/types/message-types.test.js
@@ -1,29 +1,29 @@
// @flow
-import { isInvalidSidebarSource } from './message-utils.js';
-import { messageTypes } from '../types/message-types-enum.js';
-import type { RawSidebarSourceMessageInfo } from '../types/message-types.js';
-import type { RawAddMembersMessageInfo } from '../types/messages/add-members.js';
-import type { RawChangeRoleMessageInfo } from '../types/messages/change-role.js';
-import type { RawChangeSettingsMessageInfo } from '../types/messages/change-settings.js';
-import type { RawCreateEntryMessageInfo } from '../types/messages/create-entry.js';
-import type { RawCreateSidebarMessageInfo } from '../types/messages/create-sidebar.js';
-import type { RawCreateSubthreadMessageInfo } from '../types/messages/create-subthread.js';
-import type { RawCreateThreadMessageInfo } from '../types/messages/create-thread.js';
-import type { RawDeleteEntryMessageInfo } from '../types/messages/delete-entry.js';
-import type { RawEditEntryMessageInfo } from '../types/messages/edit-entry.js';
-import type { RawEditMessageInfo } from '../types/messages/edit.js';
-import type { RawImagesMessageInfo } from '../types/messages/images.js';
-import type { RawJoinThreadMessageInfo } from '../types/messages/join-thread.js';
-import type { RawLeaveThreadMessageInfo } from '../types/messages/leave-thread.js';
-import type { RawMediaMessageInfo } from '../types/messages/media.js';
-import type { RawReactionMessageInfo } from '../types/messages/reaction.js';
-import type { RawRemoveMembersMessageInfo } from '../types/messages/remove-members.js';
-import type { RawRestoreEntryMessageInfo } from '../types/messages/restore-entry.js';
-import type { RawTextMessageInfo } from '../types/messages/text.js';
-import type { RawTogglePinMessageInfo } from '../types/messages/toggle-pin.js';
-import type { RawUpdateRelationshipMessageInfo } from '../types/messages/update-relationship.js';
-import { threadTypes } from '../types/thread-types-enum.js';
+import { messageTypes } from './message-types-enum.js';
+import { isInvalidSidebarSource } from './message-types.js';
+import type { RawSidebarSourceMessageInfo } from './message-types.js';
+import type { RawAddMembersMessageInfo } from './messages/add-members.js';
+import type { RawChangeRoleMessageInfo } from './messages/change-role.js';
+import type { RawChangeSettingsMessageInfo } from './messages/change-settings.js';
+import type { RawCreateEntryMessageInfo } from './messages/create-entry.js';
+import type { RawCreateSidebarMessageInfo } from './messages/create-sidebar.js';
+import type { RawCreateSubthreadMessageInfo } from './messages/create-subthread.js';
+import type { RawCreateThreadMessageInfo } from './messages/create-thread.js';
+import type { RawDeleteEntryMessageInfo } from './messages/delete-entry.js';
+import type { RawEditEntryMessageInfo } from './messages/edit-entry.js';
+import type { RawEditMessageInfo } from './messages/edit.js';
+import type { RawImagesMessageInfo } from './messages/images.js';
+import type { RawJoinThreadMessageInfo } from './messages/join-thread.js';
+import type { RawLeaveThreadMessageInfo } from './messages/leave-thread.js';
+import type { RawMediaMessageInfo } from './messages/media.js';
+import type { RawReactionMessageInfo } from './messages/reaction.js';
+import type { RawRemoveMembersMessageInfo } from './messages/remove-members.js';
+import type { RawRestoreEntryMessageInfo } from './messages/restore-entry.js';
+import type { RawTextMessageInfo } from './messages/text.js';
+import type { RawTogglePinMessageInfo } from './messages/toggle-pin.js';
+import type { RawUpdateRelationshipMessageInfo } from './messages/update-relationship.js';
+import { threadTypes } from './thread-types-enum.js';
describe('isInvalidSidebarSource', () => {
it('should return false for RawTextMessageInfo', () => {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 5:17 PM (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2494900
Default Alt Text
D9323.diff (8 KB)

Event Timeline