Skip to content

Commit a9ab3f7

Browse files
authored
Merge pull request #1614 from GetStream/develop
v9.1.0
2 parents 10f35ca + af529dc commit a9ab3f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1163
-728
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: 'bug:'
5-
labels: bug
5+
labels: 'bug, status: unconfirmed'
66
assignees: ''
77

88
---

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
E2E_APP_SECRET: ${{ secrets.E2E_APP_SECRET }}
5555
E2E_TEST_USER_1_TOKEN: ${{ secrets.E2E_TEST_USER_1_TOKEN }}
5656
E2E_TEST_USER_2_TOKEN: ${{ secrets.E2E_TEST_USER_2_TOKEN }}
57-
E2E_ADDITIONAL_CHANNELS: mr-channel-1, mr-channel-2
57+
E2E_ADDITIONAL_CHANNELS: mr-channel-1, mr-channel-2, edit-message-channel
5858
E2E_LONG_MESSAGE_LISTS_CHANNEL: navigate-long-message-lists
5959

6060
- name: 🎥 Upload Artifacts

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
# [9.0.0](https://github.com/GetStream/stream-chat-react/compare/v8.2.0...v9.0.0) (2022-05-17)
1+
## [9.0.0](https://github.com/GetStream/stream-chat-react/compare/v8.2.0...v9.0.0) (2022-05-17)
22

3+
### Bug Fixes
34

4-
### Features
5+
* display textarea defaultValue in MessageInput ([#1570](https://github.com/GetStream/stream-chat-react/issues/1570)) ([516a56b](https://github.com/GetStream/stream-chat-react/commit/516a56b8b8a24739f66c0d7b47c159d6bca7d3be))
56

6-
* **MessageInput:** add shouldSubmit, remove keycodeSubmitKeys ([9e69c0b](https://github.com/GetStream/stream-chat-react/commit/9e69c0b5d6169a221c2e478b42bf4c29154b05f9)), closes [#1530](https://github.com/GetStream/stream-chat-react/issues/1530)
7+
### Features
78

9+
* **MessageInput:** add shouldSubmit, remove keycodeSubmitKeys ([8e2cddd](https://github.com/GetStream/stream-chat-react/pull/1534/commits/8e2cdddddd256ec1ab77ba2bc7d59a40cfba7b11)), closes [#1530](https://github.com/GetStream/stream-chat-react/issues/1530)
10+
* add support for React 18 ([#1534](https://github.com/GetStream/stream-chat-react/issues/1534)) ([39cedcb](https://github.com/GetStream/stream-chat-react/commit/39cedcb8d0821e4bb6e8061349ae52132aa32c45))
811

912
### BREAKING CHANGES
1013

1114
* **MessageInput:** property has been fully removed and replaced by the property
1215
which should handle custom submit "trigger" functionality.
13-
Both and usage of key codes were outdated and caused unnecessary issues.
16+
Both `listener.js` and usage of key codes were outdated and caused unnecessary issues.
1417

1518
# [8.2.0](https://github.com/GetStream/stream-chat-react/compare/v8.1.3...v8.2.0) (2022-05-17)
1619

@@ -39,7 +42,6 @@ Both and usage of key codes were outdated and caused unnecessary issues.
3942

4043
* display overlay "X more" on Gallery only if more images uploaded than displayed ([#1526](https://github.com/GetStream/stream-chat-react/issues/1526)) ([ed47cd1](https://github.com/GetStream/stream-chat-react/commit/ed47cd1e0d2df6b2af72ae33e5c1b2efffec1591))
4144

42-
# Changelog
4345

4446
## [8.1.1](https://github.com/GetStream/stream-chat-react/compare/v8.1.0...v8.1.1) (2022-04-18)
4547

docusaurus/docs/React/core-components/channel-list.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ const CustomListItem = (props) => {
6464
</Chat>;
6565
```
6666

67+
In cases where the customizations provided by `Preview` are not enough, e.g. grouping channels under sections based on some
68+
dynamic channel data, the `renderChannels` may be a good fit as all loaded channels are passed as an argument to the function.
69+
70+
```jsx
71+
const renderChannels = (loadedChannels, ChannelPreview) => {
72+
const groups = groupBy(loadedChannels, 'some_custom_channel_data');
73+
return renderGroups(groups); // inside renderGroups you have have headings, etc...
74+
}
75+
76+
<Chat client={client}>
77+
<ChannelList {/* other props */} renderChannels={renderChannels} />
78+
<Channel>
79+
<MessageList />
80+
<MessageInput />
81+
</Channel>
82+
</Chat>;
83+
```
84+
6785
## Event Listeners
6886

6987
In order to handle the requisite, dynamic nature of the `ChannelList`, a variety of
@@ -329,6 +347,14 @@ Custom UI component to display the channel preview in the list.
329347
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
330348
| component | [ChannelPreviewMessenger](https://github.com/GetStream/stream-chat-react/blob/master/src/components/ChannelPreview/ChannelPreviewMessenger.tsx) |
331349

350+
### renderChannels
351+
352+
Function to override the default behavior when rendering channels, so this function is called instead of rendering the Preview directly.
353+
354+
| Type |
355+
| -------- |
356+
| function |
357+
332358
### sendChannelsToList
333359

334360
If true, sends the list's currently loaded channels to the `List` component as the `loadedChannels` prop.

e2e/add-message.test.ts

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,132 @@
1+
/* eslint-disable jest/expect-expect */
12
/* eslint-disable jest/no-done-callback */
23
/* eslint-disable jest/require-top-level-describe */
34
import selectors from './user/selectors';
45
import { test } from './user/test';
56

7+
import ChannelPreview from './user/components/ChannelPreview';
8+
import MessageList from './user/components/MessageList/MessageList';
9+
import MessageActions from './user/components/MessageActions/MessageActions';
10+
import Thread from './user/components/Thread/Thread';
11+
import MessageInput from './user/components/MessageInput';
12+
613
const CHANNEL_NAME = 'add-message' as const;
714
const ADDED_MESSAGE_MAIN_LIST = 'Hello world!' as const;
815
const ADDED_MESSAGE_THREAD = 'Hello world back!' as const;
916

1017
test.describe('add text message', () => {
11-
12-
test.beforeEach(async ({controller, user}) => {
18+
test.beforeEach(async ({ controller, user }) => {
1319
await controller.openStory('add-message--user1', selectors.channelPreviewButton);
14-
await user.clicks.ChannelPreview.text(CHANNEL_NAME);
20+
await user.clicks(ChannelPreview).text(CHANNEL_NAME);
1521
});
1622

17-
test('message list and preview button should be clear', async ({controller, user}) => {
18-
await controller.clearChannel()
19-
await user.sees.MessageList.empty();
20-
await user.sees.ChannelPreview(CHANNEL_NAME).empty();
23+
test('message list and preview button should be clear', async ({ controller, user }) => {
24+
await controller.clearChannel();
25+
await user.sees(MessageList).empty();
26+
await user.sees(ChannelPreview)(CHANNEL_NAME).empty();
2127
});
2228

23-
test('message list should update for current user', async ({controller, user}) => {
29+
test('message list should update for current user', async ({ controller, user }) => {
2430
await controller.sendMessage();
2531

26-
await user.sees.MessageList.not.empty();
27-
await user.sees.MessageList.contains.nthMessage(ADDED_MESSAGE_MAIN_LIST);
28-
await user.sees.ChannelPreview(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_MAIN_LIST);
32+
await user.sees(MessageList).not.empty();
33+
await user.sees(MessageList).contains.nthMessage(ADDED_MESSAGE_MAIN_LIST);
34+
await user.sees(ChannelPreview)(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_MAIN_LIST);
2935
});
3036
});
3137

3238
test.describe('receive a message', () => {
33-
34-
test.beforeEach(async ({controller, user}) => {
39+
test.beforeEach(async ({ controller, user }) => {
3540
await controller.openStory('add-message--user1', selectors.channelPreviewButton);
3641

37-
await user.clicks.ChannelPreview.text(CHANNEL_NAME);
42+
await user.clicks(ChannelPreview).text(CHANNEL_NAME);
3843

3944
await controller.sendMessage();
4045

4146
await controller.openStory('add-message--user2', selectors.channelPreviewButton);
4247
});
4348

44-
test('channel list should update for channel members and show unread', async ({user}) => {
45-
await user.sees.ChannelPreview(CHANNEL_NAME).not.read();
46-
await user.sees.ChannelPreview(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_MAIN_LIST);
49+
test('channel list should update for channel members and show unread', async ({ user }) => {
50+
await user.sees(ChannelPreview)(CHANNEL_NAME).not.read();
51+
await user.sees(ChannelPreview)(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_MAIN_LIST);
4752
});
4853

49-
test('message list should update for different users on the channel', async ({user, page}) => {
54+
test('message list should update for different users on the channel', async ({ page, user }) => {
5055
await Promise.all([
5156
page.waitForResponse((r) => r.url().includes('/read') && r.ok()),
52-
user.clicks.ChannelPreview.text(CHANNEL_NAME)
57+
user.clicks(ChannelPreview).text(CHANNEL_NAME),
5358
]);
54-
await user.sees.MessageList.not.empty();
55-
await user.sees.ChannelPreview(CHANNEL_NAME).read();
56-
await user.sees.MessageList.contains.nthMessage(ADDED_MESSAGE_MAIN_LIST);
59+
await user.sees(MessageList).not.empty();
60+
await user.sees(ChannelPreview)(CHANNEL_NAME).read();
61+
await user.sees(MessageList).contains.nthMessage(ADDED_MESSAGE_MAIN_LIST);
5762
});
5863
});
5964

60-
6165
test.describe('reply to a message', () => {
62-
test.beforeEach(async ({controller, user}) => {
66+
test.beforeEach(async ({ controller, user }) => {
6367
await controller.openStory('add-message--user1', selectors.channelPreviewButton);
64-
await user.clicks.ChannelPreview.text(CHANNEL_NAME);
68+
await user.clicks(ChannelPreview).text(CHANNEL_NAME);
6569
});
6670

67-
test.afterEach(async ({user}) => {
68-
await user.clicks.Thread.close();
69-
})
71+
test.afterEach(async ({ user }) => {
72+
await user.clicks(Thread).close();
73+
});
7074

71-
test('thread with no replies contains only parent message', async ({controller, user}) => {
75+
test('thread with no replies contains only parent message', async ({ controller, user }) => {
7276
await controller.clearChannel();
7377
await controller.sendMessage();
74-
await user.clicks.MessageActions.reply(ADDED_MESSAGE_MAIN_LIST);
75-
await user.sees.Thread.empty();
78+
await user.clicks(MessageActions).reply(ADDED_MESSAGE_MAIN_LIST);
79+
await user.sees(Thread).empty();
7680
});
7781

78-
test('reply to a message should appear at the bottom of the thread and in channel preview', async ({ user}) => {
79-
await user.clicks.MessageActions.reply(ADDED_MESSAGE_MAIN_LIST);
80-
await user.submits.MessageInput.reply(ADDED_MESSAGE_THREAD);
81-
await user.sees.Thread.not.empty();
82-
await user.sees.Thread.inViewport.nthMessage(ADDED_MESSAGE_THREAD, -1);
82+
test('reply to a message should appear at the bottom of the thread and in channel preview', async ({
83+
user,
84+
}) => {
85+
await user.clicks(MessageActions).reply(ADDED_MESSAGE_MAIN_LIST);
86+
await user.submits(MessageInput).reply(ADDED_MESSAGE_THREAD);
87+
await user.sees(Thread).not.empty();
88+
await user.sees(Thread).inViewport.nthMessage(ADDED_MESSAGE_THREAD, -1);
8389
// todo: channel preview does not reflect new messages from thread
84-
// await user.sees.ChannelPreview(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_THREAD);
90+
// await user.sees(ChannelPreview(CHANNEL_NAME)).contains.lastMessage(ADDED_MESSAGE_THREAD);
8591
});
86-
})
92+
});
8793

8894
test.describe('receive the reply', () => {
89-
test.beforeEach(async ({controller, user: user1, page}) => {
95+
test.beforeEach(async ({ controller, page, user: user1 }) => {
9096
await controller.openStory('add-message--user1', selectors.channelPreviewButton);
91-
await user1.clicks.ChannelPreview.text(CHANNEL_NAME);
97+
await user1.clicks(ChannelPreview).text(CHANNEL_NAME);
9298
await controller.clearChannel();
9399
await controller.sendMessage();
94-
await user1.clicks.MessageActions.reply(ADDED_MESSAGE_MAIN_LIST);
100+
await user1.clicks(MessageActions).reply(ADDED_MESSAGE_MAIN_LIST);
95101
await Promise.all([
96102
page.waitForResponse((r) => r.url().includes('/message') && r.ok()),
97-
user1.submits.MessageInput.reply(ADDED_MESSAGE_THREAD)
98-
])
103+
user1.submits(MessageInput).reply(ADDED_MESSAGE_THREAD),
104+
]);
99105
await controller.openStory('add-message--user2', selectors.channelPreviewButton);
100106
});
101107

102108
// todo: channel preview does not reflect new messages from thread
103109
// test('for the other user channel preview displays correct last message showed unread', async ({user: user2}) => {
104-
// await user2.sees.ChannelPreview(CHANNEL_NAME).not.read();
105-
// await user2.sees.ChannelPreview(CHANNEL_NAME).contains.lastMessage(ADDED_MESSAGE_THREAD);
110+
// await user2.sees(ChannelPreview(CHANNEL_NAME)).not.read();
111+
// await user2.sees(ChannelPreview(CHANNEL_NAME)).contains.lastMessage(ADDED_MESSAGE_THREAD);
106112
// });
107113

108-
test('the other user sees that reply to a message appeared at the bottom of the thread and in channel preview', async ({user: user2, page}) => {
114+
test('the other user sees that reply to a message appeared at the bottom of the thread and in channel preview', async ({
115+
page,
116+
user: user2,
117+
}) => {
109118
await Promise.all([
110119
page.waitForResponse((r) => r.url().includes('/read') && r.ok()),
111-
user2.clicks.ChannelPreview.text(CHANNEL_NAME)
120+
user2.clicks(ChannelPreview).text(CHANNEL_NAME),
112121
]);
113122

114123
await Promise.all([
115124
page.waitForResponse((r) => r.url().includes('/replies') && r.ok()),
116-
user2.clicks.MessageActions.reply(ADDED_MESSAGE_MAIN_LIST),
125+
user2.clicks(MessageActions).reply(ADDED_MESSAGE_MAIN_LIST),
117126
]);
118127

119-
await user2.sees.Thread.not.empty();
120-
await user2.sees.ChannelPreview(CHANNEL_NAME).read();
121-
await user2.sees.Thread.inViewport.nthMessage(ADDED_MESSAGE_THREAD, -1);
128+
await user2.sees(Thread).not.empty();
129+
await user2.sees(ChannelPreview)(CHANNEL_NAME).read();
130+
await user2.sees(Thread).inViewport.nthMessage(ADDED_MESSAGE_THREAD, -1);
122131
});
123132
});

e2e/autocomplete-mention.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22
/* eslint-disable jest/require-top-level-describe */
33
import { expect } from '@playwright/test';
44

5-
import {test} from './user/test';
5+
import { test } from './user/test';
66
import { getMessageInput } from './user/components/MessageInput';
77
import selectors from './user/selectors';
88

9+
import AutocompleteSuggestionItem from './user/components/AutocompleteSuggestionList';
10+
import MessageInput from './user/components/MessageInput';
11+
912
const MENTION_TRIGGER = '@';
1013

1114
test.describe('autocomplete a mention', () => {
12-
test('should fill in textarea with username', async ({ controller, user, page }) => {
13-
await controller.openStory('hello--basic-setup', selectors.messageInput );
15+
test('should fill in textarea with username', async ({ controller, page, user }) => {
16+
await controller.openStory('hello--basic-setup', selectors.messageInput);
1417

15-
await user.typesTo.MessageInput.text(MENTION_TRIGGER);
18+
await user.typesTo(MessageInput).text(MENTION_TRIGGER);
1619

17-
const autocompleteSuggestionItem = await user.clicks.AutocompleteSuggestionItem.nth(1)
20+
const autocompleteSuggestionItem = await user.clicks(AutocompleteSuggestionItem).nth(1);
1821
const textContent = await autocompleteSuggestionItem.textContent();
1922

2023
await expect(getMessageInput(page)).toContainText(`${MENTION_TRIGGER}${textContent}`);
2124
});
22-
})
25+
});

0 commit comments

Comments
 (0)