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 @@ -12,7 +12,6 @@ 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, @@ -54,6 +53,7 @@ } from '../updaters/thread-permission-updaters.js'; import { joinThread } from '../updaters/thread-updaters.js'; import RelationshipChangeset from '../utils/relationship-changeset.js'; +import { isInvalidSidebarSource } from 'lib/types/message-types.js'; const { commbot } = bots; 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 @@ -48,10 +48,10 @@ import SentencePrefixSearchIndex from '../shared/sentence-prefix-search-index.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, + isInvalidSidebarSource, } from '../types/message-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { 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 @@ -140,6 +140,7 @@ import type { CallServerEndpointResultInfoInterface } from '../utils/call-server-endpoint.js'; import { values } from '../utils/objects.js'; import { tID, tNumber, tShape } from '../utils/validation-utils.js'; +import { messageSpecs } from '../shared/messages/message-specs.js'; const composableMessageTypes = new Set([ messageTypes.TEXT, @@ -199,10 +200,11 @@ 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 + (message.type === messageTypes.REACTION || + message.type === messageTypes.EDIT_MESSAGE || + message.type === messageTypes.SIDEBAR_SOURCE || + message.type === messageTypes.TOGGLE_PIN) && + messageSpecs[message.type].canBeSidebarSource ); }