Skip to content

Commit e4ff5e6

Browse files
committed
fix: remove messageDraftsEnabled flag from Channel props
1 parent 80676d0 commit e4ff5e6

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

src/components/Channel/Channel.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ type ChannelPropsForwardedToComponentContext = Pick<
157157
>;
158158

159159
export type ChannelProps = ChannelPropsForwardedToComponentContext & {
160-
// todo: move to MessageComposer configuration
160+
// todo: X document the use of config.attachments.fileUploadFilter to replace acceptedFiles prop
161161
/** List of accepted file types */
162162
acceptedFiles?: string[];
163163
/** Custom handler function that runs when the active channel has unread messages and the app is running on a separate browser tab */
@@ -208,11 +208,10 @@ export type ChannelProps = ChannelPropsForwardedToComponentContext & {
208208
LoadingErrorIndicator?: React.ComponentType<LoadingErrorIndicatorProps>;
209209
/** Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount. */
210210
markReadOnMount?: boolean;
211+
// todo: X document how maxNumberOfFiles can be customized with message composer
211212
/** Maximum number of attachments allowed per message */
212213
maxNumberOfFiles?: number;
213-
/** Enables storing message drafts on the server. */
214-
messageDraftsEnabled?: boolean;
215-
// todo: document that multipleUploads is redundant and ignored with message composer
214+
// todo: X document that multipleUploads is redundant and ignored with message composer
216215
/** Whether to allow multiple attachment uploads */
217216
multipleUploads?: boolean;
218217
/** Custom action handler function to run on click of an @mention in a message */
@@ -305,7 +304,6 @@ const ChannelInner = (
305304
LoadingIndicator = DefaultLoadingIndicator,
306305
markReadOnMount = true,
307306
maxNumberOfFiles,
308-
messageDraftsEnabled,
309307
multipleUploads = true,
310308
onMentionsClick,
311309
onMentionsHover,
@@ -555,7 +553,7 @@ const ChannelInner = (
555553
}
556554

557555
if (maxNumberOfFiles) {
558-
// todo: this has to be configured via a template
556+
// todo: X this has to be configured via a template
559557
channel.messageComposer.attachmentManager.config.maxNumberOfFilesPerMessage =
560558
maxNumberOfFiles;
561559
}
@@ -1081,8 +1079,6 @@ const ChannelInner = (
10811079

10821080
const openThread = (message: LocalMessage, event?: React.BaseSyntheticEvent) => {
10831081
event?.preventDefault();
1084-
// todo: revisit how to open a thread
1085-
10861082
dispatch({ channel, message, type: 'openThread' });
10871083
};
10881084

@@ -1161,7 +1157,6 @@ const ChannelInner = (
11611157
imageAttachmentSizeHandler:
11621158
props.imageAttachmentSizeHandler || getImageAttachmentConfiguration,
11631159
maxNumberOfFiles,
1164-
messageDraftsEnabled,
11651160
multipleUploads,
11661161
mutes,
11671162
notifications,

src/components/Channel/__tests__/Channel.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ describe('Channel', () => {
597597
});
598598
getThreadSpy.mockRestore();
599599
});
600-
600+
// todo: remove messageDraftsEnabled tests
601601
it('uses Thread instance when messageDraftsEnabled is true', async () => {
602602
const { channel, chatClient } = await initClient();
603603
const threadMessage = messages[0];

src/components/Channel/hooks/useCreateChannelStateContext.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const useCreateChannelStateContext = (
2727
loadingMore,
2828
maxNumberOfFiles,
2929
members,
30-
messageDraftsEnabled,
3130
messages = [],
3231
multipleUploads,
3332
mutes,
@@ -118,7 +117,6 @@ export const useCreateChannelStateContext = (
118117
loadingMore,
119118
maxNumberOfFiles,
120119
members,
121-
messageDraftsEnabled,
122120
messages,
123121
multipleUploads,
124122
mutes,
@@ -151,7 +149,6 @@ export const useCreateChannelStateContext = (
151149
membersLength,
152150
memoizedMessageData,
153151
memoizedThreadMessageData,
154-
messageDraftsEnabled,
155152
notificationsLength,
156153
readUsersLength,
157154
readUsersLastReads,

src/context/ChannelStateContext.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@ export type ChannelNotifications = Array<{
2222
type: 'success' | 'error';
2323
}>;
2424

25-
// todo: 1. create LocalMessage that would contain the below in stream-chat
26-
// todo: 2. move errorStatusCode, error to stream-chat
27-
// export type StreamMessage =
28-
// // FIXME: we should use only one of the two (either formatted or unformatted)
29-
// (ReturnType<StreamChannelState['formatMessage']> | MessageResponse) & {
30-
// customType?: string;
31-
// errorStatusCode?: number;
32-
// error?: ErrorFromResponse<APIErrorResponse>;
33-
// // editing?: boolean;
34-
// // date?: Date;
35-
// };
36-
3725
export type ChannelState = {
3826
suppressAutoscroll: boolean;
3927
error?: Error | null;
@@ -71,7 +59,6 @@ export type ChannelStateContextValue = Omit<ChannelState, 'typing'> & {
7159
dragAndDropWindow?: boolean;
7260
giphyVersion?: GiphyVersions;
7361
maxNumberOfFiles?: number;
74-
messageDraftsEnabled?: boolean;
7562
mutes?: Array<Mute>;
7663
watcher_count?: number;
7764
};

0 commit comments

Comments
 (0)